$downloadMemberID = $orderInfo['member_id']; // Member ID $downloadTypeID = $orderInfo['order_id']; // Download Type ID / Order ID } // Downloadable Status - 0 = order not approved | 1 = active/ok | 2 = expired | 3 = downloads exceeded | 4 = Not available for download if ($nowGMT > $itemValue['expires'] and $itemValue['expires'] != '0000-00-00 00:00:00') { $downloadableStatus = 2; } elseif ($itemValue['downloads'] >= $maxDownloadAttempts) { $downloadableStatus = 3; } else { // Check if file is available try { // Get the media information $mediaObj = new mediaTools($itemValue['asset_id']); $media = $mediaObj->getMediaInfoFromDB($itemValue['asset_id']); $folderInfo = $mediaObj->getFolderStorageInfoFromDB($media['folder_id']); //echo $itemValue['asset_id']; print_r($folderInfo); echo "<br /><br /><br /><br />"; // testing if ($itemValue['item_id']) { $mdspResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\t\t\t\t\tFROM {$dbinfo[pre]}media_digital_sizes \r\n\t\t\t\t\t\t\t\t\t\t\tWHERE ds_id = '{$itemValue[item_id]}' \r\n\t\t\t\t\t\t\t\t\t\t\tAND media_id = '{$itemValue[asset_id]}'\r\n\t\t\t\t\t\t\t\t\t\t\t"); if ($mdspRows = mysqli_num_rows($mdspResult)) { $mdsp = mysqli_fetch_assoc($mdspResult); } // Get the digital profile details $dspResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\t\t\t\t\tSELECT * \r\n\t\t\t\t\t\t\t\t\t\t\tFROM {$dbinfo[pre]}digital_sizes \r\n\t\t\t\t\t\t\t\t\t\t\tWHERE ds_id = '{$itemValue[item_id]}'\r\n\t\t\t\t\t\t\t\t\t\t\t"); $dsp = mysqli_fetch_assoc($dspResult); // Get the digital profile details $deliveryMethod = $dsp['delivery_method']; // Delivery method of file // echo $deliveryMethod.'<br>'; // Testing switch ($deliveryMethod) {
// Run the getMediaDetails function to grab all the media file details $mediaArray = $media->getMediaArray(); // Get the array of media $thumbMediaDetailsArray = $media->getDetailsFields('thumb'); //echo $nowGMT . " ---- " . $invoiceItem['expires']; exit; // Testing foreach ($mediaArray as $key => $media) { if ($orderInfo['order_status'] == 1) { // Downloadable Status - 0 = order not approved | 1 = active/ok | 2 = expired | 3 = downloads exceeded | 4 = Not available for download if ($nowGMT > $invoiceItem['expires'] and $invoiceItem['expires'] != '0000-00-00 00:00:00') { $downloadableStatus = 2; } else { // Check if file is available try { // Get the media information $mediaObj = new mediaTools($key); $mediaInfo = $mediaObj->getMediaInfoFromDB($key, $media); $folderInfo = $mediaObj->getFolderStorageInfoFromDB($mediaInfo['folder_id']); //print_r($folderInfo); $filecheck = $mediaObj->verifyMediaFileExists(); // Returns array [stauts,path,filename] /* if($itemValue['item_id']) // This is a variation of the original $filecheck = $mediaObj->verifyMediaDPFileExists($itemValue['item_id']); // Returns array [stauts,path,filename] else $filecheck = $mediaObj->verifyMediaFileExists(); // Returns array [stauts,path,filename] //print_r($filecheck); exit; // Testing */ } catch (Exception $e) { echo $e->getMessage(); exit; }
} } catch (Exception $e) { echo $e->getMessage(); exit; } //print_k($digitalItem); // Testing //echo $_SESSION['downloadAuthorization']; exit; // Testing } } // End authorization check try { idCheck($download['mediaID']); // Make sure ID is numeric // Get the media information $media = new mediaTools($download['mediaID']); $mediaInfo = $media->getMediaInfoFromDB(); $folderInfo = $media->getFolderStorageInfoFromDB($mediaInfo['folder_id']); if ($download['externalLink']) { $externalLink = 1; // External Link $filecheck['status'] = checkExternalFile($download['externalLink']) > 400 ? 0 : 1; $filecheck['path'] = $download['externalLink']; } else { $filecheck = $media->verifyMediaFileExists(); // Returns array [stauts,path,filename] } //$filecheck = $media->verifyMediaFileExists(); // Returns array [stauts,path,filename] // Old //print_r($mediaInfo); //echo $_SESSION['member']['mem_id']; //exit; } catch (Exception $e) {
//$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$dbinfo[pre]}media LEFT JOIN {$dbinfo[pre]}licenses ON {$dbinfo[pre]}media.license = {$dbinfo[pre]}licenses.license_id WHERE media_id = '{$mediaID}'"; $mediaInfo = new mediaList($sql); if ($mediaInfo->getRows()) { $media = $mediaInfo->getSingleMediaDetails('thumb'); $galleryIDArray = $mediaInfo->getMediaGalleryIDs(); // Get an array of galleries this media is in $mediaPrice = getMediaPrice($media); // Get the media price based on the license $mediaCredits = getMediaCredits($media); // Get the media credits based on the license // Grab the correct title for this language $media['title'] = $media['title_' . $selectedLanguage] ? $media['title_' . $selectedLanguage] : $media['title']; } // Get the media information $mediaObj = new mediaTools($mediaID); $mediaObj->getMediaInfoFromDB($mediaID, $media); $folderInfo = $mediaObj->getFolderStorageInfoFromDB($media['folder_id']); //print_r($filecheck); $totalPixels = $media['width'] * $media['height']; if ($id == 0) { // Check if this original is instantly available if ($media['external_link']) { $externalLink = 1; // External Link $filecheck['status'] = checkExternalFile($media['external_link']) > 400 ? 0 : 1; $filecheck['path'] = $media['external_link']; } else { $filecheck = $mediaObj->verifyMediaFileExists(); // Returns array [stauts,path,filename] } $digital['ds_id'] = 0;