if ($_SESSION['galleriesData'][$_SESSION['id']] or $_SESSION['id'] == 0) { if (@$_SESSION['galleriesData'][$_SESSION['id']]['password'] != '' and @(!in_array($_SESSION['id'], $_SESSION['member']['memberPermGalleries']))) { //$privateGalleryID = ($config['EncryptIDs']) ? : ; not needed header("location: {$siteURL}/gallery.login.php?id={$galleryID}"); // gallery login page exit; } if ($_SESSION['id'] != 0) { $seoGalleryName = ''; /* * Get the prints assigned to this gallery */ $printsResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}prints\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}prints.print_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'prints')\r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}prints.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}prints.attachment = 'galleries' OR {$dbinfo[pre]}prints.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}prints.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'prints' AND item_id = {$dbinfo[pre]}prints.print_id AND gallery_id = '{$_SESSION[id]}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}prints.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}prints.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}prints.sortorder\r\n\t\t\t\t\t\t\t"); if ($returnRows = mysqli_num_rows($printsResult)) { while ($prints = mysqli_fetch_assoc($printsResult)) { $printsArray[] = printsList($prints); } $smarty->assign('printRows', $returnRows); $smarty->assign('prints', $printsArray); } /* * Get the products assigned to this gallery */ $productsResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}products\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}products.prod_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'products') \r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}products.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}products.attachment = 'galleries' OR {$dbinfo[pre]}products.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}products.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'products' AND item_id = {$dbinfo[pre]}products.prod_id AND gallery_id = '{$_SESSION[id]}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}products.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}products.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}products.sortorder\r\n\t\t\t\t\t\t\t"); if ($returnRows = mysqli_num_rows($productsResult)) { while ($products = mysqli_fetch_assoc($productsResult)) { $productsArray[] = productsList($products); } $smarty->assign('productRows', $returnRows); $smarty->assign('products', $productsArray); }
break; } switch ($print['credits_calc']) { case 'add': $print['credits'] = $mediaCredits + $print['credits']; break; case 'sub': $print['credits'] = $mediaCredits - $print['credits']; break; case 'mult': $print['credits'] = $mediaCredits * $print['credits']; break; } //echo $mediaCredits.'-'.$print['credits'].'-'.$print['credits_calc']."/"; if ($print['quantity'] != '0') { $printsArray[$print['print_id']] = printsList($print, $mediaID); $optionsResult = mysqli_query($db, "SELECT og_id FROM {$dbinfo[pre]}option_grp WHERE parent_type = 'prints' AND parent_id = '{$print[print_id]}' AND deleted = 0"); // See if there are any options for this item if (mysqli_num_rows($optionsResult)) { $printsArray[$print['print_id']]['addToCartLink'] = $printsArray[$print['print_id']]['linkto']; // Workbox popup $printsArray[$print['print_id']]['directToCart'] = false; // Workbox popup } else { if ($config['EncryptIDs']) { $printsArray[$print['print_id']]['addToCartLink'] = "{$siteURL}/cart.php?mode=add&type=print&id=" . $printsArray[$print['print_id']]['encryptedID'] . "&mediaID={$media[encryptedID]}"; } else { $printsArray[$print['print_id']]['addToCartLink'] = "{$siteURL}/cart.php?mode=add&type=print&id={$print[print_id]}&mediaID={$media[media_id]}"; } // Direct to cart $printsArray[$print['print_id']]['directToCart'] = true;
} switch ($print['credits_calc']) { case 'add': $print['credits'] = $mediaCredits + $print['credits']; break; case 'sub': $print['credits'] = $mediaCredits - $print['credits']; break; case 'mult': $print['credits'] = $mediaCredits * $print['credits']; break; } $smarty->assign('mediaID', $mediaID); $smarty->assign('media', $media); } $printArray = printsList($print); $printArray['options'] = getProductOptions('prints', $printArray['print_id'], $print['taxable']); /* * If editing this then select the correctly selected items */ if ($edit) { if ($printArray['options']) { foreach ($printArray['options'] as $key => $value) { foreach ($printArray['options'][$key]['options'] as $key2 => $value2) { if ($optionSelections[$key . '-' . $key2]) { $printArray['options'][$key]['options'][$key2]['selected'] = true; } // Set selected option to true } } }
if ($config['settings']['skip_shipping'] and $cartItem['paytype'] == 'cred') { // The skip shipping when using credits setting is on } else { $cartTotals['shippingRequired'] = true; // This is a physical item - shipping will be required $cartItemsArray[$cartItem['oi_id']]['shippingRequired'] = true; // Add it at the item level just in case it is needed in the future } } $discountForThisItem = ''; switch ($cartItem['item_type']) { case "print": $printResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT * FROM {$dbinfo[pre]}prints \r\n\t\t\t\t\t\t\tWHERE print_id = '{$cartItem[item_id]}'\r\n\t\t\t\t\t\t\t"); // Select print here $print = mysqli_fetch_assoc($printResult); $printDetails = printsList($print, $cartItem['asset_id']); $printDetails['cartEditLink'] .= '&edit=' . $cartItem['oi_id']; // Add edit var if (!$cartItem['paytype']) { $cartItem['paytype'] = 'cur'; } // Make sure the payType is set just in case $cartItemsArray[$cartItem['oi_id']]['usePayType'] = $cartItem['paytype']; // Set the payType to the item $cartItemsArray[$cartItem['oi_id']]['payTypeCount'] = 0; // Number of options available to pay $numOfPrints += $cartItem['quantity']; // Count the number of print items in the cart /* * Currency */
$featuredNewsArray[] = $featuredNews; } $smarty->assign('featuredNewsRows', count($featuredNewsArray)); $smarty->assign('featuredNews', $featuredNewsArray); } catch (Exception $e) { die(exceptionError($e)); } } /* * Get featured homepage prints */ if ($config['settings']['hpprints']) { try { $featuredPrintsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}prints\r\n\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\tON ({$dbinfo[pre]}prints.print_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'prints') \r\n\t\t\t\tWHERE {$dbinfo[pre]}prints.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}prints.homepage = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}prints.deleted = 0\r\n\t\t\t\tAND ({$dbinfo[pre]}prints.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\tORDER BY {$dbinfo[pre]}prints.sortorder\r\n\t\t\t\t"); while ($featuredPrints = mysqli_fetch_assoc($featuredPrintsResult)) { $featuredPrintsArray[] = printsList($featuredPrints); } $smarty->assign('featuredPrintsRows', count($featuredPrintsArray)); $smarty->assign('featuredPrints', $featuredPrintsArray); /* if($returnRows = mysqli_num_rows($featuredPrintsResult)) { while($featuredPrints = mysqli_fetch_assoc($featuredPrintsResult)) $featuredPrintsArray[] = printsList($featuredPrints); $smarty->assign('featuredPrintsRows',$returnRows); $smarty->assign('featuredPrints',$featuredPrintsArray); } */ } catch (Exception $e) { die(exceptionError($e));
} $packagesInCart[$key]['originalValue'] = $value; $packagesInCart[$key]['package_media_percentage'] = $package_media_percentage; } } $smarty->assign('packagesInCart', $packagesInCart); } $arrayNum = 0; /* * Prints within the package */ $printsResult = mysqli_query($db, "\r\n\t\t\t\t\tSELECT * \r\n\t\t\t\t\tFROM {$dbinfo[pre]}package_items \r\n\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}prints \r\n\t\t\t\t\tON {$dbinfo[pre]}package_items.item_id = {$dbinfo[pre]}prints.print_id\r\n\t\t\t\t\tWHERE {$dbinfo[pre]}prints.deleted='0' \r\n\t\t\t\t\tAND {$dbinfo[pre]}package_items.pack_id = '{$package[pack_id]}'\r\n\t\t\t\t\tAND {$dbinfo[pre]}package_items.item_type = 'print'\r\n\t\t\t\t\tORDER BY {$dbinfo[pre]}prints.sortorder,{$dbinfo[pre]}prints.item_name\r\n\t\t\t\t\t"); if ($printRows = mysqli_num_rows($printsResult)) { while ($print = mysqli_fetch_array($printsResult)) { $arrayNum++; $printDetails = printsList($print); if ($package['allowoptions']) { $tempOptions = getProductOptions('prints', $print['print_id'], $print['taxable']); } if ($print['groupmult'] == 0) { for ($x = 0; $x < $print['iquantity']; $x++) { $printsArray[$arrayNum] = $printDetails; $printsArray[$arrayNum]['options'] = $tempOptions; $printsArray[$arrayNum]['quantityDisplay'] = 1; $printsArray[$arrayNum]['selectedPhoto'] = 0; $printsArray[$arrayNum]['existingMedia'] = $mediaIDs[$arrayNum]; /* * If editing this then select the correctly selected items */ if ($edit) { if ($printsArray[$arrayNum]['options']) {