print "Done\n";
 if (isset($downloadFileResponse->errorMessage)) {
     foreach ($downloadFileResponse->errorMessage->error as $error) {
         printf("%s: %s\n\n", $error->severity === FileTransfer\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning', $error->message);
     }
 }
 if ($downloadFileResponse->ack !== 'Failure') {
     /**
      * Check that the response has an attachment.
      */
     if ($downloadFileResponse->hasAttachment()) {
         $attachment = $downloadFileResponse->attachment();
         /**
          * Save the attachment to file system's temporary directory.
          */
         $filename = saveAttachment($attachment['data']);
         if ($filename !== false) {
             $xml = unZipArchive($filename);
             if ($xml !== false) {
                 $responses = $merchantDataService->reviseInventoryStatus($xml);
                 foreach ($responses as $response) {
                     if (isset($response->Errors)) {
                         foreach ($response->Errors as $error) {
                             printf("%s: %s\n%s\n\n", $error->SeverityCode === MerchantData\Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning', $error->ShortMessage, $error->LongMessage);
                         }
                     }
                     if ($response->Ack !== 'Failure') {
                         foreach ($response->InventoryStatus as $status) {
                             printf("The Item %s has Quantity of %s and the Start Price of %s\n", $status->ItemID, $status->Quantity, isset($status->StartPrice) ? $status->StartPrice->value : '');
                         }
                     }
예제 #2
0
function updateAttachment($attachmentId, $gameId, $originalName, $description, $attachment)
{
    if (!isAdmin()) {
        return 4;
    }
    $link = getDBConnection();
    $data = array();
    if (mysqli_select_db($link, getDBName())) {
        $attachmentId = intval($attachmentId);
        $gameId = intval($gameId);
        $originalName = mysqli_real_escape_string($link, $originalName);
        $description = mysqli_real_escape_string($link, $description);
        if (mysqli_query($link, "UPDATE attachments SET game = {$gameId}, originalName = '{$originalName}', description = '{$description}' WHERE id = {$attachmentId}")) {
            if ($_FILES[$attachment]["error"] == 0) {
                $result = saveAttachment($attachmentId, $attachment);
                if ($result == true) {
                    return 0;
                } else {
                    return -1;
                }
            } else {
                return 1;
            }
        } else {
            return 2;
        }
    } else {
        return 3;
    }
}