function FormatTimeStamp($DATE, $spacer = '/') { global $system; $DATE = explode($spacer, $DATE); if ($system->SETTINGS['datesformat'] == 'USA') { $F_date = _gmmktime(0, 0, 0, $DATE[0], $DATE[1], $DATE[2]); } else { $F_date = _gmmktime(0, 0, 0, $DATE[1], $DATE[0], $DATE[2]); } return $F_date; }
function CheckSellData() { /* return codes: 017 = item title missing 018 = item description missing 019 = minimum bid missing 020 = minimum bid not valid 021 = reserve price missing 022 = reserve price not valid 023 = category missing 024 = payment method missing 025 = payment method missing 060 = start time has already happened 061 = buy now price inserted is not correct 062 = may not set a reserve price in a Dutch Auction 063 = may not use custom increments in a Dutch Auction 064 = may not use the Buy Now feature in a Dutch Auction 600 = wrong auction type 601 = wrong quantity of items */ global $title, $description, $minimum_bid, $with_reserve, $reserve_price, $buy_now, $buy_now_only, $buy_now_price, $payment, $category; global $atype, $iquantity, $increments, $customincrement, $system, $_SESSION; global $payments, $num, $nnum, $a_starts, $start_now, $relist; if (empty($title)) { return '017'; } if (empty($description)) { return '018'; } if (!$system->CheckMoney($minimum_bid) && $buy_now_only == 'n') { return '058'; } // format the info correctly $clean_minimum_bid = $system->input_money($minimum_bid); $clean_reserve_price = $system->input_money($reserve_price); $clean_buy_now_price = $system->input_money($buy_now_price); if ((empty($minimum_bid) || floatval($clean_minimum_bid) <= 0) && ($buy_now_only == 'n' || !$buy_now_only)) { return '019'; } if (empty($reserve_price) && $with_reserve == 'yes' && $buy_now_only == 'n') { return '021'; } if ($increments == 2 && (empty($customincrement) || floatval($system->input_money($customincrement)) == 0)) { return '056'; } if (!(empty($customincrement) || floatval($system->input_money($customincrement)) == 0) && !$system->CheckMoney($customincrement)) { return '057'; } if ($with_reserve == 'yes' && !$system->CheckMoney($reserve_price)) { return '022'; } if ($buy_now_only == 'y') { $buy_now = 'yes'; } if ($buy_now == 'yes' && (!$system->CheckMoney($buy_now_price) || empty($buy_now_price) || floatval($clean_buy_now_price) == 0)) { return '061'; } $numpay = count($payment); if ($numpay == 0) { return '024'; } else { $payment_ok = 1; } if (!isset($system->SETTINGS['auction_types'][intval($atype)])) { return '600'; } if (intval($iquantity) < 1) { return '601'; } if ($atype == 2) { if ($with_reserve == 'yes') { $with_reserve = 'no'; $reserve_price = ''; return '062'; } if ($increments == 2) { $increments = 1; $customincrement = ''; return '063'; } if ($buy_now == 'yes') { $buy_now = 'no'; $buy_now_price = ''; return '064'; } } if ($with_reserve == 'yes' && $clean_reserve_price <= $clean_minimum_bid) { return '5045'; } if ($buy_now == 'yes' && $buy_now_only == 'n') { if ($with_reserve == 'yes' && $clean_buy_now_price <= $clean_reserve_price || $clean_buy_now_price <= $clean_minimum_bid) { return '5046'; } } if ($system->SETTINGS['autorelist'] == 'y') { if (!empty($relist) && !is_numeric($relist)) { return '714'; } elseif ($relist > $system->SETTINGS['autorelist_max'] && !empty($relist)) { return '715'; } } if (!(strpos($a_starts, '-') === false) && empty($start_now) && $_SESSION['SELL_action'] != 'edit') { $a_starts = _gmmktime(substr($a_starts, 11, 2), substr($a_starts, 14, 2), substr($a_starts, 17, 2), substr($a_starts, 0, 2), substr($a_starts, 3, 2), substr($a_starts, 6, 4), 0); if ($a_starts < $system->ctime) { return '060'; } } }
$shippingtext = ''; if ($shipping == 1) { $shippingtext = $MSG['033']; } elseif ($shipping == 2) { $shippingtext = $MSG['032']; } elseif ($shipping == 3) { $shippingtext = $MSG['867']; } $template->assign_vars(array('TITLE' => $title, 'SUBTITLE' => $subtitle, 'ERROR' => $ERR == 'ERR_' ? '' : ${$ERR}, 'PAGE' => 2, 'MINTEXT' => $atype == 2 ? $MSG['038'] : $MSG['020'], 'AUC_DESCRIPTION' => stripslashes($description), 'PIC_URL' => empty($pict_url) ? $MSG['114'] : '<img src="' . $uploaded_path . session_id() . '/' . $pict_url . '" style="max-width:100%; max-height:100%;">', 'MIN_BID' => $system->print_money($minimum_bid, false), 'RESERVE' => $system->print_money($reserve_price, false), 'BN_PRICE' => $system->print_money($buy_now_price, false), 'SHIPPING_COST' => $system->print_money($shipping_cost, false), 'ADDITIONAL_SHIPPING_COST' => $system->print_money($additional_shipping_cost, false), 'STARTDATE' => empty($start_now) ? FormatDate($a_starts) : FormatDate($system->ctime), 'DURATION' => mysql_result($res, 0, 'description'), 'INCREMENTS' => $increments == 1 ? $MSG['614'] : $system->print_money($customincrement, false), 'ATYPE' => $system->SETTINGS['auction_types'][$atype], 'ATYPE_PLAIN' => $atype, 'SHIPPING' => $shippingtext, 'INTERNATIONAL' => $international ? $MSG['033'] : $MSG['043'], 'SHIPPING_TERMS' => nl2br(stripslashes($shipping_terms)), 'PAYMENTS_METHODS' => $payment_methods, 'CAT_LIST1' => $category_string1, 'CAT_LIST2' => $category_string2, 'FEE' => number_format(get_fee($minimum_bid), $system->SETTINGS['moneydecimals']), 'B_USERAUTH' => $system->SETTINGS['usersauth'] == 'y', 'B_BN_ONLY' => !($system->SETTINGS['buy_now'] == 2 && $buy_now_only == 'y'), 'B_BN' => $system->SETTINGS['buy_now'] == 2, 'B_GALLERY' => $system->SETTINGS['picturesgallery'] == 1 && isset($_SESSION['UPLOADED_PICTURES']) && count($_SESSION['UPLOADED_PICTURES']) > 0, 'B_CUSINC' => $system->SETTINGS['cust_increment'] == 1, 'B_FEES' => $system->SETTINGS['fees'] == 'y', 'B_SUBTITLE' => $system->SETTINGS['subtitle'] == 'y')); break; } case 1: // enter auction details // check time format is timestamp. If not change to timestamp if (!(strpos($a_starts, '-') === false)) { $a_starts = _gmmktime(substr($a_starts, 11, 2), substr($a_starts, 14, 2), substr($a_starts, 17, 2), substr($a_starts, 0, 2), substr($a_starts, 3, 2), substr($a_starts, 6, 4), 0); } $category_string1 = get_category_string($sellcat1); $category_string2 = get_category_string($sellcat2); // auction types $TPL_auction_type = '<select name="atype" id="atype">' . "\n"; foreach ($system->SETTINGS['auction_types'] as $key => $val) { $TPL_auction_type .= "\t" . '<option value="' . $key . '" ' . ($key == $atype ? 'selected="true"' : '') . '>' . $val . '</option>' . "\n"; } $TPL_auction_type .= '</select>' . "\n"; // duration $time_passed = $_SESSION['SELL_action'] != 'edit' ? 0 : (time() - $a_starts) / (3600 * 24); // get time passed in days $query = "SELECT * FROM " . $DBPrefix . "durations WHERE days > " . floor($time_passed) . " ORDER BY days"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__);