Example #1
0
  */
 $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);
 }
 /*
  * Get the packages assigned to this gallery
  */
 $packagesResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}packages\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages') \r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}packages.active = 1 \r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}packages.attachment = 'galleries' OR {$dbinfo[pre]}packages.attachment = 'both')\r\n\t\t\t\t\t\t\tAND\t({$dbinfo[pre]}packages.all_galleries = 1 OR (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'packages' AND item_id = {$dbinfo[pre]}packages.pack_id AND gallery_id = '{$_SESSION['id']}'))\r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}packages.deleted = 0\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}packages.sortorder\r\n\t\t\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($packagesResult)) {
     while ($packages = mysqli_fetch_assoc($packagesResult)) {
         $packagesArray[] = packagesList($packages);
     }
     $smarty->assign('packageRows', $returnRows);
     $smarty->assign('packages', $packagesArray);
 }
 /*
  * Get the collections for this gallery
  */
 $collectionsResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\t\tFROM {$dbinfo[pre]}collections\r\n\t\t\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\t\t\tON ({$dbinfo[pre]}collections.coll_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'collections') \r\n\t\t\t\t\t\t\tWHERE {$dbinfo[pre]}collections.active = 1 \r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}collections.deleted = 0 \r\n\t\t\t\t\t\t\tAND {$dbinfo[pre]}collections.colltype = 1\r\n\t\t\t\t\t\t\tAND (SELECT item_id FROM {$dbinfo[pre]}item_galleries WHERE mgrarea = 'collections' AND item_id = {$dbinfo[pre]}collections.coll_id AND gallery_id = '{$_SESSION[id]}')\r\n\t\t\t\t\t\t\tAND ({$dbinfo[pre]}collections.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\t\t\t\tORDER BY {$dbinfo[pre]}collections.sortorder\r\n\t\t\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($collectionsResult)) {
     while ($collections = mysqli_fetch_assoc($collectionsResult)) {
         $collectionsArray[] = collectionsList($collections);
     }
     $smarty->assign('collectionRows', $returnRows);
     $smarty->assign('collections', $collectionsArray);
 }
 $mediaCollectionsPackagesResult = mysqli_query($db, "SELECT * FROM {$dbinfo[pre]}package_items WHERE item_type = 'coll' AND item_id IN ({$collectionsWithAccessFlat})");
 // Select which collections in the package that contain this photo
 $mediaCollectionsRows = mysqli_num_rows($mediaCollectionsPackagesResult);
 while ($mediaCollectionsPackage = mysqli_fetch_array($mediaCollectionsPackagesResult)) {
     $packageIDsArray[] = $mediaCollectionsPackage['pack_id'];
 }
 if ($packageIDsArray) {
     $packagesIDsArrayFlat = implode(",", $packageIDsArray);
 } else {
     $packagesIDsArrayFlat = 0;
 }
 // Now that we have the package ID array select the packages that the customer has access to and assign them to smarty
 $packagesResult = mysqli_query($db, "\r\n\t\t\t\t\tSELECT *\r\n\t\t\t\t\tFROM {$dbinfo[pre]}packages\r\n\t\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\t\tON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages') \r\n\t\t\t\t\tWHERE ({$dbinfo[pre]}packages.pack_id IN ({$packagesIDsArrayFlat}) OR {$dbinfo[pre]}packages.all_galleries = 1)\r\n\t\t\t\t\tAND {$dbinfo[pre]}packages.active = 1 \r\n\t\t\t\t\tAND {$dbinfo[pre]}packages.deleted = 0\r\n\t\t\t\t\tAND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB})) \r\n\t\t\t\t\tORDER BY {$dbinfo[pre]}packages.sortorder\r\n\t\t\t\t\t");
 if ($returnRows = mysqli_num_rows($packagesResult)) {
     while ($package = mysqli_fetch_assoc($packagesResult)) {
         $packagesArray[$package['pack_id']] = packagesList($package, $mediaID);
     }
     $smarty->assign('packageRows', $returnRows);
     $smarty->assign('packages', $packagesArray);
 }
 /*
  * IPTC
  */
 if ($config['settings']['display_iptc']) {
     $iptcResult = mysqli_query($db, "\r\n\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\tFROM {$dbinfo[pre]}media_iptc \r\n\t\t\t\t\t\tWHERE media_id = '{$mediaID}'\r\n\t\t\t\t\t\t");
     if ($iptcRows = mysqli_num_rows($iptcResult)) {
         $iptc = mysqli_fetch_array($iptcResult);
         $media['iptc']['iptc_title'] = $iptc['title'];
         $media['iptc']['iptc_description'] = $iptc['description'];
         $media['iptc']['iptc_instructions'] = $iptc['instructions'];
         $media['iptc']['iptc_date_created'] = $iptc['date_created'];
Example #3
0
        	$smarty->assign('featuredProductsRows',$returnRows);
        	$smarty->assign('featuredProducts',$featuredProductsArray);
        }
        */
    } catch (Exception $e) {
        die(exceptionError($e));
    }
}
/*
 * Get featured homepage packages
 */
if ($config['settings']['hppacks']) {
    try {
        $featuredPackagesResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}packages\r\n\t\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\t\tON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages') \r\n\t\t\t\tWHERE {$dbinfo[pre]}packages.active = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}packages.homepage = 1 \r\n\t\t\t\tAND {$dbinfo[pre]}packages.deleted = 0\r\n\t\t\t\tAND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t\tAND ({$dbinfo[pre]}packages.quantity = '' OR {$dbinfo[pre]}packages.quantity > '0')\r\n\t\t\t\tORDER BY {$dbinfo[pre]}packages.sortorder\r\n\t\t\t\t");
        while ($featuredPackages = mysqli_fetch_assoc($featuredPackagesResult)) {
            $featuredPackagesArray[] = packagesList($featuredPackages);
        }
        $smarty->assign('featuredPackagesRows', count($featuredPackagesArray));
        $smarty->assign('featuredPackages', $featuredPackagesArray);
        /*
        if($returnRows = mysqli_num_rows($featuredPackagesResult))
        {
        	while($featuredPackages = mysqli_fetch_assoc($featuredPackagesResult))
        		$featuredPackagesArray[] = packagesList($featuredPackages);
        
        	$smarty->assign('featuredPackagesRows',$returnRows);
        	$smarty->assign('featuredPackages',$featuredPackagesArray);
        }
        */
    } catch (Exception $e) {
        die(exceptionError($e));
Example #4
0
     $cartItemsArray[$cartItem['oi_id']]['lineItemCreditsEach'] = $lineItemCreditsEach;
     $cartItemsArray[$cartItem['oi_id']]['lineItemCreditsTotal'] = $lineItemCreditsTotal;
     $cartItemsArray[$cartItem['oi_id']]['itemDetails'] = $productDetails;
     if ($cartItem['asset_id']) {
         // Check if a media file has been attached to this item
         $cartItemsArray[$cartItem['oi_id']]['itemDetails']['media'] = getMediaDetailsForCart($cartItem['asset_id']);
     }
     $cartItemsArray[$cartItem['oi_id']]['itemTypeShort'] = 'prod';
     // Update prices and credits for invoice item in the db
     mysqli_query($db, "\r\n\t\t\t\t\t\t\tUPDATE {$dbinfo[pre]}invoice_items SET \r\n\t\t\t\t\t\t\tprice_total='{$lineItemPriceTotal}',\r\n\t\t\t\t\t\t\tprice='{$lineItemPriceEach}',\r\n\t\t\t\t\t\t\tcredits_total='{$lineItemCreditsTotal}',\r\n\t\t\t\t\t\t\tcredits='{$lineItemCreditsEach}'\r\n\t\t\t\t\t\t\tWHERE oi_id = '{$cartItem[oi_id]}'\r\n\t\t\t\t\t\t");
     break;
 case "package":
     $packageResult = mysqli_query($db, "\r\n\t\t\t\t\t\t\tSELECT * FROM {$dbinfo[pre]}packages \r\n\t\t\t\t\t\t\tWHERE pack_id = '{$cartItem[item_id]}'\r\n\t\t\t\t\t\t\t");
     // Select package here
     $package = mysqli_fetch_assoc($packageResult);
     $packageDetails = packagesList($package, 0);
     $packageDetails['cartEditLink'] .= '&edit=' . $cartItem['oi_id'];
     // Add edit var
     // xxxx See if we should include tax or not?
     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
     $numOfPackages += $cartItem['quantity'];
     // Count the number of package items in the cart
     /*
      * Currency
Example #5
0
 if ($config['EncryptIDs']) {
     $id = k_decrypt($id);
     $mediaID = k_decrypt($mediaID);
 }
 if ($id) {
     idCheck($id);
 }
 // Make sure ID is numeric
 if ($mediaID) {
     idCheck($mediaID);
 }
 // Make sure ID is numeric
 $packageResult = mysqli_query($db, "\r\n\t\t\tSELECT *\r\n\t\t\tFROM {$dbinfo[pre]}packages\r\n\t\t\tLEFT JOIN {$dbinfo[pre]}perms\r\n\t\t\tON ({$dbinfo[pre]}packages.pack_id = {$dbinfo[pre]}perms.item_id AND {$dbinfo[pre]}perms.perm_area = 'packages') \r\n\t\t\tWHERE {$dbinfo[pre]}packages.pack_id = {$id}\r\n\t\t\tAND ({$dbinfo[pre]}packages.everyone = 1 OR {$dbinfo[pre]}perms.perm_value IN ({$memberPermissionsForDB}))\r\n\t\t\t");
 if ($returnRows = mysqli_num_rows($packageResult)) {
     $package = mysqli_fetch_assoc($packageResult);
     $packageArray = packagesList($package);
     /*
      * Get discounts
      */
     $discountsResult = mysqli_query($db, "\r\n\t\t\t\tSELECT *\r\n\t\t\t\tFROM {$dbinfo[pre]}discount_ranges \r\n\t\t\t\tWHERE item_type = 'packages' \r\n\t\t\t\tAND start_discount_number > 0\r\n\t\t\t\tAND item_id = '{$id}' \r\n\t\t\t\tORDER BY start_discount_number\r\n\t\t\t\t");
     if ($discountReturnRows = mysqli_num_rows($discountsResult)) {
         while ($discount = mysqli_fetch_array($discountsResult)) {
             $discountsArray[$discount['dr_id']] = $discount;
         }
         $smarty->assign('discountRows', $discountReturnRows);
         $smarty->assign('discountsArray', $discountsArray);
     }
     if ($edit) {
         //echo k_encrypt($edit); exit;
         $smarty->assign('edit', k_encrypt($edit));
         $invoiceItemsResult = mysqli_query($db, "\r\n\t\t\t\t\tSELECT asset_id,item_list_number,oi_id \r\n\t\t\t\t\tFROM {$dbinfo[pre]}invoice_items \r\n\t\t\t\t\tWHERE pack_invoice_id = {$edit}\r\n\t\t\t\t\tAND deleted = 0\r\n\t\t\t\t\t");