Beispiel #1
0
 public function parseResponse($doc, $format = TWG_DEFAULT_DATA_FORMAT)
 {
     $data = ApiData::parseDocument($doc, $format);
     if (empty($data)) {
         return false;
     }
     if (!empty($data['error'])) {
         $this->errors = ApiData::getObjects($data['error']);
     }
     $this->data = $data;
     return true;
 }
Beispiel #2
0
$lang_code = CART_LANGUAGE;
if (!empty($_REQUEST['language'])) {
    if (in_array($_REQUEST['language'], array_keys(Registry::get('languages')))) {
        $lang_code = $_REQUEST['language'];
    }
}
if (!fn_twg_validate_auth()) {
    $response->addError('ERROR_ACCESS_DENIED', __('access_denied', $lang_code));
    $response->returnResponse();
}
$data = '';
if (!empty($_REQUEST['data'])) {
    $data = ApiData::parseDocument(base64_decode(rawurldecode($_REQUEST['data'])), $format);
    if (!empty($_REQUEST['action'])) {
        $_data = Api::parseApiList($data, $object);
        $data = ApiData::getObjects($_data);
    }
}
$update_actions = array('update', 'delete');
if ($_SERVER['REQUEST_METHOD'] == 'POST' && in_array($_REQUEST['action'], $update_actions)) {
    if (empty($data)) {
        $response->addError('ERROR_WRONG_DATA', __('twgadmin_wrong_api_data'));
    }
    if ($mode == 'post') {
        if ($object == 'users') {
            foreach ($data as $user) {
                if (!empty($user['user_id'])) {
                    if ($_REQUEST['action'] == 'update') {
                        $result = false;
                        $user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i", $user['user_id']);
                        $notify_user = !empty($user['notify_updated_user']) && $user['notify_updated_user'] == 'Y' ? true : false;
Beispiel #3
0
 public static function apiOrdersGetData($order_id, $type, $object_type, $data = array(), $single = true)
 {
     if (empty($data)) {
         $data = db_get_field("SELECT data FROM ?:order_data WHERE order_id = ?i AND type = ?s", $order_id, $type);
         // Payment information
         if ($type == 'P') {
             $data = @unserialize(fn_decrypt_text($data));
             // Coupons, Taxes and Shipping information
         } elseif (strpos('CTL', $type) !== false) {
             $data = @unserialize($data);
         }
         if (empty($data)) {
             return array();
         }
     }
     if ($single) {
         return self::getAsApiObject($object_type, $data);
     }
     return self::getAsList($object_type, ApiData::getObjects($data));
 }