本文整理汇总了PHP中fn_parse_date函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_parse_date函数的具体用法?PHP fn_parse_date怎么用?PHP fn_parse_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_parse_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_buy_together_update_chain
function fn_buy_together_update_chain($item_id, $product_id, $item_data, $auth, $lang_code = CART_LANGUAGE)
{
if (empty($product_id) || $product_id == 0) {
return false;
}
SecurityHelper::sanitizeObjectData('buy_together_chain', $item_data);
$show_notice = true;
$item_data['product_id'] = $product_id;
if (!empty($item_data['products'])) {
foreach ($item_data['products'] as $key => $product) {
// Delete products with empty amount
if (empty($product['amount']) || intval($product['amount']) == 0) {
unset($item_data['products'][$key]);
continue;
}
$item_data['products'][$key]['modifier'] = floatval($item_data['products'][$key]['modifier']);
$is_restricted = false;
fn_set_hook('buy_together_restricted_product', $product['product_id'], $auth, $is_restricted, $show_notice);
if ($is_restricted) {
unset($item_data['products'][$key]);
}
}
$item_data['products'] = serialize($item_data['products']);
} else {
$item_data['products'] = array();
}
if (!empty($item_data['date_from'])) {
$item_data['date_from'] = fn_parse_date($item_data['date_from']);
}
if (!empty($item_data['date_to'])) {
$item_data['date_to'] = fn_parse_date($item_data['date_to']);
}
if (empty($item_id) || $item_id == 0) {
//Create a new chain
$item_id = db_query("INSERT INTO ?:buy_together ?e", $item_data);
if (empty($item_id)) {
return false;
}
$_data = array();
$_data['chain_id'] = $item_id;
$_data['name'] = !empty($item_data['name']) ? $item_data['name'] : '';
$_data['description'] = !empty($item_data['description']) ? $item_data['description'] : '';
foreach (fn_get_translation_languages() as $_data['lang_code'] => $v) {
db_query("INSERT INTO ?:buy_together_descriptions ?e", $_data);
}
} else {
//Update already existing chain
$_data = array();
$_data['chain_id'] = $item_id;
$_data['name'] = !empty($item_data['name']) ? $item_data['name'] : '';
$_data['description'] = !empty($item_data['description']) ? $item_data['description'] : '';
db_query("UPDATE ?:buy_together SET ?u WHERE chain_id = ?i", $item_data, $item_id);
db_query("UPDATE ?:buy_together_descriptions SET ?u WHERE chain_id = ?i AND lang_code = ?s", $_data, $item_id, $lang_code);
}
return $item_id;
}
示例2: fn_update_news
function fn_update_news($news_id, $news_data, $lang_code = CART_LANGUAGE)
{
// news title required
if (empty($news_data['news'])) {
return false;
}
$_data = $news_data;
$_data['date'] = fn_parse_date($news_data['date']);
if (isset($_data['localization'])) {
$_data['localization'] = empty($_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
}
if (empty($news_id)) {
$create = true;
$news_id = $_data['news_id'] = db_query("REPLACE INTO ?:news ?e", $_data);
if (empty($news_id)) {
return false;
}
// Adding descriptions
foreach ((array) Registry::get('languages') as $_data['lang_code'] => $v) {
db_query("INSERT INTO ?:news_descriptions ?e", $_data);
}
} else {
if (!empty($news_data['block_id'])) {
fn_add_items_to_block($news_data['block_id'], $news_data['add_items'], $news_id, 'news');
}
db_query("UPDATE ?:news SET ?u WHERE news_id = ?i", $_data, $news_id);
// update news descriptions
$_data = $news_data;
db_query("UPDATE ?:news_descriptions SET ?u WHERE news_id = ?i AND lang_code = ?s", $_data, $news_id, $lang_code);
}
// Log news update/add
fn_log_event('news', !empty($create) ? 'create' : 'update', array('news_id' => $news_id));
fn_set_hook('update_news', $news_data, $news_id, $lang_code);
return $news_id;
}
示例3: foreach
foreach ($packages as $products) {
foreach ($products['data']['products'] as $product) {
if (!empty($product['product_type']) && $product['product_type'] == 18) {
$settings_shipping_spsr['insurance_type'] = 'INS';
}
}
}
}
if ($settings_shipping_spsr['insurance_type'] == 'INS') {
$total_invoices_cost_ins += $invoice['cost'];
}
if ($settings_shipping_spsr['insurance_type'] == 'VAL') {
$total_invoices_cost_val += $invoice['cost'];
}
if (!empty($spsr_invoice['delivery_date'])) {
$spsr_invoice['delivery_date'] = date('Y-m-d', fn_parse_date($spsr_invoice['delivery_date'])) . 'T00:00:00.000';
}
$invoice_for_xml = array('Action' => "N", 'ShipRefNum' => $invoice['ship_ref_num'], 'PickUpType' => $spsr_invoice['pick_up_type'], 'ProductCode' => $spsr_invoice['invoice_product_code'], 'FullDescription' => fn_html_escape($invoice_full_desc), 'PiecesCount' => count($packages), 'DeliveryDate' => $spsr_invoice['delivery_date'], 'DeliveryTime' => $spsr_invoice['delivery_time'], 'InsuranceType' => $additional_params['insurance_type'], 'InsuranceSum' => $invoice['cost']);
if ($settings_shipping_spsr['cod'] == 1) {
$invoice_for_xml['CODGoodsSum'] = $invoice['cost'] + $invoice['invoice_shipping_cost'];
$invoice_for_xml['CODDeliverySum'] = $invoice['invoice_shipping_cost'];
$total_invoices_cost_cod += $invoice_for_xml['CODGoodsSum'];
}
$invoice_xml = RusSpsr::invoiceXml($invoice_for_xml, $pieces_xml, $shipper_xml, $receiver_xml, $additional_services_xml, $sms_xml);
$save_data['invoices'][$shipment_id] = $invoice;
$save_data['invoices'][$shipment_id]['shipper'] = $shipper_for_xml;
$save_data['invoices'][$shipment_id]['receiver_xml'] = $receiver_for_xml;
$save_data['invoices'][$shipment_id]['invoice_for_xml'] = $invoice_for_xml;
$invoices_xml = array_merge($invoices_xml, $invoice_xml);
} else {
unset($invoices[$invoice_key]);
示例4: fn_update_product_filter
function fn_update_product_filter($filter_data, $filter_id, $lang_code = DESCR_SL)
{
if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) {
if (!empty($filter_id) && !fn_check_company_id('product_filters', 'filter_id', $filter_id)) {
fn_company_access_denied_notification();
return false;
}
if (!empty($filter_id)) {
unset($filter_data['company_id']);
}
}
// Parse filter type
if (strpos($filter_data['filter_type'], 'FF-') === 0 || strpos($filter_data['filter_type'], 'RF-') === 0 || strpos($filter_data['filter_type'], 'DF-') === 0) {
$filter_data['feature_id'] = str_replace(array('RF-', 'FF-', 'DF-'), '', $filter_data['filter_type']);
$filter_data['feature_type'] = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $filter_data['feature_id']);
} else {
$filter_data['field_type'] = str_replace(array('R-', 'B-'), '', $filter_data['filter_type']);
$filter_fields = fn_get_product_filter_fields();
}
if (isset($filter_data['display_more_count']) && isset($filter_data['display_count']) && $filter_data['display_more_count'] < $filter_data['display_count']) {
$filter_data['display_more_count'] = $filter_data['display_count'];
}
if (!empty($filter_id)) {
db_query('UPDATE ?:product_filters SET ?u WHERE filter_id = ?i', $filter_data, $filter_id);
db_query('UPDATE ?:product_filter_descriptions SET ?u WHERE filter_id = ?i AND lang_code = ?s', $filter_data, $filter_id, $lang_code);
} else {
$filter_data['filter_id'] = $filter_id = db_query('INSERT INTO ?:product_filters ?e', $filter_data);
foreach (fn_get_translation_languages() as $filter_data['lang_code'] => $_d) {
db_query("INSERT INTO ?:product_filter_descriptions ?e", $filter_data);
}
}
$delete_all_ranges = false;
// if filter has ranges
if (!empty($filter_data['feature_type']) && strpos('ODN', $filter_data['feature_type']) !== false || !empty($filter_data['field_type']) && !empty($filter_fields[$filter_data['field_type']]['is_range'])) {
$range_ids = array();
foreach ($filter_data['ranges'] as $k => $range) {
if (!empty($filter_data['feature_type']) && $filter_data['feature_type'] == 'D') {
$range['to'] = fn_parse_date($filter_data['dates_ranges'][$k]['to']);
$range['from'] = fn_parse_date($filter_data['dates_ranges'][$k]['from']);
}
$range['filter_id'] = $filter_id;
if (!empty($filter_data['feature_id'])) {
$range['feature_id'] = $filter_data['feature_id'];
}
if (!empty($range['range_id'])) {
db_query("UPDATE ?:product_filter_ranges SET ?u WHERE range_id = ?i", $range, $range['range_id']);
db_query('UPDATE ?:product_filter_ranges_descriptions SET ?u WHERE range_id = ?i AND lang_code = ?s', $range, $range['range_id'], $lang_code);
} elseif ((!empty($range['from']) || !empty($range['to'])) && !empty($range['range_name'])) {
$range['range_id'] = db_query("INSERT INTO ?:product_filter_ranges ?e", $range);
foreach (fn_get_translation_languages() as $range['lang_code'] => $_d) {
db_query("INSERT INTO ?:product_filter_ranges_descriptions ?e", $range);
}
}
if (!empty($range['range_id'])) {
$range_ids[] = $range['range_id'];
}
}
if (!empty($range_ids)) {
$deleted_ranges = db_get_fields("SELECT range_id FROM ?:product_filter_ranges WHERE filter_id = ?i AND range_id NOT IN (?n)", $filter_id, $range_ids);
if (!empty($deleted_ranges)) {
db_query("DELETE FROM ?:product_filter_ranges WHERE range_id IN (?n)", $deleted_ranges);
db_query("DELETE FROM ?:product_filter_ranges_descriptions WHERE range_id IN (?n)", $deleted_ranges);
}
} else {
$delete_all_ranges = true;
}
} else {
$delete_all_ranges = true;
}
if ($delete_all_ranges) {
$deleted_ranges = db_get_fields("SELECT range_id FROM ?:product_filter_ranges WHERE filter_id = ?i", $filter_id);
db_query("DELETE FROM ?:product_filter_ranges WHERE filter_id = ?i", $filter_id);
db_query("DELETE FROM ?:product_filter_ranges_descriptions WHERE range_id IN (?n)", $deleted_ranges);
}
fn_set_hook('update_product_filter', $filter_data, $filter_id, $lang_code);
return $filter_id;
}
示例5: fn_create_periods
function fn_create_periods($params)
{
$period_name = empty($params['period']) ? null : $params['period'];
$available_periods = array(DateTimeHelper::PERIOD_TODAY, DateTimeHelper::PERIOD_YESTERDAY, DateTimeHelper::PERIOD_THIS_WEEK, DateTimeHelper::PERIOD_LAST_WEEK, DateTimeHelper::PERIOD_THIS_MONTH, DateTimeHelper::PERIOD_LAST_MONTH, DateTimeHelper::PERIOD_THIS_YEAR, DateTimeHelper::PERIOD_LAST_YEAR, DateTimeHelper::PERIOD_DAY_AGO_TILL_NOW, DateTimeHelper::PERIOD_WEEK_AGO_TILL_NOW, DateTimeHelper::PERIOD_MONTH_AGO_TILL_NOW);
if (in_array($period_name, $available_periods)) {
$period = DateTimeHelper::getPeriod($period_name);
$time_from = $period['from']->getTimestamp();
$time_to = $period['to']->getTimestamp();
} elseif ($period_name == 'HC' && isset($params['last_days'])) {
$period = DateTimeHelper::createCustomPeriod("-{$params['last_days']} day", 'now');
$time_from = $period['from']->getTimestamp();
$time_to = $period['to']->getTimestamp();
} else {
$time_from = empty($params['time_from']) ? 0 : fn_parse_date($params['time_from']);
$time_to = empty($params['time_to']) ? TIME : fn_parse_date($params['time_to'], true);
}
Tygh::$app['view']->assign('time_from', $time_from);
Tygh::$app['view']->assign('time_to', $time_to);
return array($time_from, $time_to);
}
示例6: fn_create_periods
function fn_create_periods($params)
{
$today = getdate(TIME);
$period = !empty($params['period']) ? $params['period'] : null;
$time_from = !empty($params['time_from']) ? fn_parse_date($params['time_from']) : 0;
$time_to = !empty($params['time_to']) ? fn_parse_date($params['time_to'], true) : TIME;
// Current dates
if ($period == 'D') {
$time_from = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
$time_to = TIME;
} elseif ($period == 'W') {
$wday = empty($today['wday']) ? "6" : ($today['wday'] == 1 ? "0" : $today['wday'] - 1);
$wstart = getdate(strtotime("-{$wday} day"));
$time_from = mktime(0, 0, 0, $wstart['mon'], $wstart['mday'], $wstart['year']);
$time_to = TIME;
} elseif ($period == 'M') {
$time_from = mktime(0, 0, 0, $today['mon'], 1, $today['year']);
$time_to = TIME;
} elseif ($period == 'Y') {
$time_from = mktime(0, 0, 0, 1, 1, $today['year']);
$time_to = TIME;
// Last dates
} elseif ($period == 'LD') {
$today = getdate(strtotime("-1 day"));
$time_from = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
$time_to = mktime(23, 59, 59, $today['mon'], $today['mday'], $today['year']);
} elseif ($period == 'LW') {
$today = getdate(strtotime("-1 week"));
$wday = empty($today['wday']) ? 6 : ($today['wday'] == 1 ? 0 : $today['wday'] - 1);
$wstart = getdate(strtotime("-{$wday} day", mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year'])));
$time_from = mktime(0, 0, 0, $wstart['mon'], $wstart['mday'], $wstart['year']);
$wend = getdate(strtotime("+6 day", $time_from));
$time_to = mktime(23, 59, 59, $wend['mon'], $wend['mday'], $wend['year']);
} elseif ($period == 'LM') {
$today = getdate(strtotime("-1 month"));
$time_from = mktime(0, 0, 0, $today['mon'], 1, $today['year']);
$time_to = mktime(23, 59, 59, $today['mon'], date('t', strtotime("-1 month")), $today['year']);
} elseif ($period == 'LY') {
$today = getdate(strtotime("-1 year"));
$time_from = mktime(0, 0, 0, 1, 1, $today['year']);
$time_to = mktime(23, 59, 59, 12, 31, $today['year']);
// Last dates
} elseif ($period == 'HH') {
$today = getdate(strtotime("-23 hours"));
$time_from = mktime($today['hours'], $today['minutes'], $today['seconds'], $today['mon'], $today['mday'], $today['year']);
$time_to = TIME;
} elseif ($period == 'HW') {
$today = getdate(strtotime("-6 day"));
$time_from = mktime($today['hours'], $today['minutes'], $today['seconds'], $today['mon'], $today['mday'], $today['year']);
$time_to = TIME;
} elseif ($period == 'HM') {
$today = getdate(strtotime("-29 day"));
$time_from = mktime($today['hours'], $today['minutes'], $today['seconds'], $today['mon'], $today['mday'], $today['year']);
$time_to = TIME;
} elseif ($period == 'HC') {
$today = getdate(strtotime('-' . $params['last_days'] . ' day'));
$time_from = mktime($today['hours'], $today['minutes'], $today['seconds'], $today['mon'], $today['mday'], $today['year']);
$time_to = TIME;
}
Registry::get('view')->assign('time_from', $time_from);
Registry::get('view')->assign('time_to', $time_to);
return array($time_from, $time_to);
}
示例7: fn_banners_update_banner
function fn_banners_update_banner($data, $banner_id, $lang_code = DESCR_SL)
{
if (isset($data['timestamp'])) {
$data['timestamp'] = fn_parse_date($data['timestamp']);
}
$data['localization'] = empty($data['localization']) ? '' : fn_implode_localizations($data['localization']);
if (!empty($banner_id)) {
db_query("UPDATE ?:banners SET ?u WHERE banner_id = ?i", $data, $banner_id);
db_query("UPDATE ?:banner_descriptions SET ?u WHERE banner_id = ?i AND lang_code = ?s", $data, $banner_id, $lang_code);
$banner_image_id = fn_get_banner_image_id($banner_id, $lang_code);
$banner_image_exist = !empty($banner_image_id);
$banner_is_multilang = Registry::get('addons.banners.banner_multilang') == 'Y';
$image_is_update = fn_banners_need_image_update();
if ($banner_is_multilang) {
if ($banner_image_exist && $image_is_update) {
fn_delete_image_pairs($banner_image_id, 'promo');
db_query("DELETE FROM ?:banner_images WHERE banner_id = ?i AND lang_code = ?s", $banner_id, $lang_code);
$banner_image_exist = false;
}
} else {
if (isset($data['url'])) {
db_query("UPDATE ?:banner_descriptions SET url = ?s WHERE banner_id = ?i", $data['url'], $banner_id);
}
}
if ($image_is_update && !$banner_image_exist) {
$banner_image_id = db_query("INSERT INTO ?:banner_images (banner_id, lang_code) VALUE(?i, ?s)", $banner_id, $lang_code);
}
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!$banner_is_multilang && !$banner_image_exist) {
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
} else {
$banner_id = $data['banner_id'] = db_query("REPLACE INTO ?:banners ?e", $data);
foreach (Languages::getAll() as $data['lang_code'] => $v) {
db_query("REPLACE INTO ?:banner_descriptions ?e", $data);
}
if (fn_banners_need_image_update()) {
$data_banner_image = array('banner_id' => $banner_id, 'lang_code' => $lang_code);
$banner_image_id = db_get_next_auto_increment_id('banner_images');
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!empty($pair_data)) {
db_query("INSERT INTO ?:banner_images ?e", $data_banner_image);
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
}
}
return $banner_id;
}
示例8: fn_update_product
function fn_update_product($product_data, $product_id = 0, $lang_code = CART_LANGUAGE)
{
$_data = $product_data;
if (!empty($product_data['timestamp'])) {
$_data['timestamp'] = fn_parse_date($product_data['timestamp']);
// Minimal data for product record
}
if (!empty($product_data['avail_since'])) {
$_data['avail_since'] = fn_parse_date($product_data['avail_since']);
}
if (isset($product_data['tax_ids'])) {
$_data['tax_ids'] = empty($product_data['tax_ids']) ? '' : fn_create_set($product_data['tax_ids']);
}
if (isset($product_data['localization'])) {
$_data['localization'] = empty($product_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
}
if (isset($product_data['usergroup_ids'])) {
$_data['usergroup_ids'] = empty($product_data['usergroup_ids']) ? '' : implode(',', $_data['usergroup_ids']);
}
if (Registry::get('settings.General.allow_negative_amount') == 'N' && isset($_data['amount'])) {
$_data['amount'] = abs($_data['amount']);
}
// add new product
if (empty($product_id)) {
$create = true;
// product title can't be empty
if (empty($product_data['product'])) {
return false;
}
$product_id = db_query("INSERT INTO ?:products ?e", $_data);
if (empty($product_id)) {
return false;
}
//
// Adding same product descriptions for all cart languages
//
$_data = $product_data;
$_data['product_id'] = $product_id;
$_data['product'] = trim($_data['product'], " -");
foreach ((array) Registry::get('languages') as $_data['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_descriptions ?e", $_data);
}
// update product
} else {
if (isset($product_data['product']) && empty($product_data['product'])) {
unset($product_data['product']);
}
db_query("UPDATE ?:products SET ?u WHERE product_id = ?i", $_data, $product_id);
$_data = $product_data;
if (!empty($_data['product'])) {
$_data['product'] = trim($_data['product'], " -");
}
db_query("UPDATE ?:product_descriptions SET ?u WHERE product_id = ?i AND lang_code = ?s", $_data, $product_id, $lang_code);
}
// Log product add/update
fn_log_event('products', !empty($create) ? 'create' : 'update', array('product_id' => $product_id));
if (!empty($product_data['product_features'])) {
$i_data = array('product_id' => $product_id, 'lang_code' => $lang_code);
foreach ($product_data['product_features'] as $feature_id => $value) {
// Check if feature is applicable for this product
$id_paths = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id = ?i", $product_id);
$_params = array('category_ids' => array_unique(explode('/', implode('/', $id_paths))), 'feature_id' => $feature_id);
list($_feature) = fn_get_product_features($_params);
if (empty($_feature)) {
$_feature = db_get_field("SELECT description FROM ?:product_features_descriptions WHERE feature_id = ?i AND lang_code = ?s", $feature_id, CART_LANGUAGE);
$_product = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $product_id, CART_LANGUAGE);
fn_set_notification('E', fn_get_lang_var('error'), str_replace(array('[feature_name]', '[product_name]'), array($_feature, $_product), fn_get_lang_var('product_feature_cannot_assigned')));
continue;
}
$i_data['feature_id'] = $feature_id;
unset($i_data['value']);
unset($i_data['variant_id']);
unset($i_data['value_int']);
$feature_type = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $feature_id);
// Delete variants in current language
if ($feature_type == 'T') {
db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i AND lang_code = ?s", $feature_id, $product_id, $lang_code);
} else {
db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i AND product_id = ?i", $feature_id, $product_id);
}
if ($feature_type == 'D') {
$i_data['value_int'] = fn_parse_date($value);
} elseif ($feature_type == 'M') {
if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
$value = empty($value) ? array() : $value;
$value[] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
}
if (!empty($value)) {
foreach ($value as $variant_id) {
foreach (Registry::get('languages') as $i_data['lang_code'] => $_d) {
// insert for all languages
$i_data['variant_id'] = $variant_id;
db_query("REPLACE INTO ?:product_features_values ?e", $i_data);
}
}
}
continue;
} elseif (in_array($feature_type, array('S', 'N', 'E'))) {
if (!empty($product_data['add_new_variant'][$feature_id]['variant'])) {
$i_data['variant_id'] = fn_add_feature_variant($feature_id, $product_data['add_new_variant'][$feature_id]);
//.........这里部分代码省略.........
示例9: fn_store_profile_fields
function fn_store_profile_fields($user_data, $object_id, $object_type)
{
// Delete existing fields
if ($object_type == 'UP') {
db_query("DELETE FROM ?:profile_fields_data WHERE (object_id = ?i AND object_type = ?s) OR (object_id = ?i AND object_type = ?s)", $object_id['U'], 'U', $object_id['P'], 'P');
} else {
db_query("DELETE FROM ?:profile_fields_data WHERE object_id = ?i AND object_type = ?s", $object_id, $object_type);
}
if (!empty($user_data['fields'])) {
$fields_info = db_get_hash_array("SELECT field_id, field_type, section FROM ?:profile_fields WHERE field_id IN (?n)", 'field_id', array_keys($user_data['fields']));
$_data = array();
foreach ($user_data['fields'] as $field_id => $value) {
if ($object_type == 'UP') {
$_data['object_type'] = $fields_info[$field_id]['section'] == 'C' ? 'U' : 'P';
$_data['object_id'] = $fields_info[$field_id]['section'] == 'C' ? $object_id['U'] : $object_id['P'];
} else {
$_data['object_type'] = $object_type;
$_data['object_id'] = $object_id;
}
$_data['field_id'] = $field_id;
$_data['value'] = $fields_info[$field_id]['field_type'] == 'D' ? fn_parse_date($value) : $value;
db_query("REPLACE INTO ?:profile_fields_data ?e", $_data);
}
}
return true;
}
示例10: fn_send_form
function fn_send_form($page_id, $form_values)
{
$result = false;
if (!empty($form_values)) {
$page_data = fn_get_page_data($page_id);
if (!empty($page_data['form']['elements'])) {
$result = true;
$attachments = array();
$fb_files = fn_filter_uploaded_data('fb_files');
if (!empty($fb_files)) {
foreach ($fb_files as $k => $v) {
$attachments[$v['name']] = $v['path'];
$form_values[$k] = $v['name'];
}
}
$max_length = 0;
$sender = '';
foreach ($page_data['form']['elements'] as $k => $v) {
if (($l = strlen($v['description'])) > $max_length) {
$max_length = $l;
}
// Check if sender email exists
if ($v['element_type'] == FORM_EMAIL) {
$sender = $form_values[$k];
}
if ($v['element_type'] == FORM_DATE) {
$form_values[$k] = fn_parse_date($form_values[$k]);
}
if ($v['element_type'] == FORM_REFERER) {
$form_values[$k] = $_SESSION['auth']['referer'];
}
if ($v['element_type'] == FORM_IP_ADDRESS) {
$ip = fn_get_ip();
$form_values[$k] = $ip['host'];
}
}
$max_length += 2;
if ($result == true) {
$from = 'default_company_support_department';
$is_html = true;
fn_set_hook('send_form', $page_data, $form_values, $result, $from, $sender, $attachments, $is_html);
if ($result == true) {
Mailer::sendMail(array('to' => $page_data['form']['general'][FORM_RECIPIENT], 'from' => $from, 'reply_to' => $sender, 'data' => array('max_length' => $max_length, 'elements' => $page_data['form']['elements'], 'form_title' => $page_data['page'], 'form_values' => $form_values), 'attachments' => $attachments, 'tpl' => 'addons/form_builder/form.tpl', 'is_html' => $is_html), 'A');
}
}
}
}
return $result;
}
示例11: fn_send_form
function fn_send_form($page_id, $form_values)
{
if (!empty($form_values)) {
$page_data = fn_get_page_data($page_id);
if (empty($page_data['form']['elements'])) {
return false;
}
$attachments = array();
$fb_files = fn_filter_uploaded_data('fb_files');
if (!empty($fb_files)) {
foreach ($fb_files as $k => $v) {
$attachments[$v['name']] = $v['path'];
$form_values[$k] = $v['name'];
}
}
$max_length = 0;
$sender = '';
foreach ($page_data['form']['elements'] as $k => $v) {
if (($l = strlen($v['description'])) > $max_length) {
$max_length = $l;
}
if ($v['element_type'] == FORM_EMAIL_CONFIRM) {
if (!is_array($form_values[$k]) || $form_values[$k][0] != $form_values[$k][1] || empty($form_values[$k][0]) || $form_values[$k][1]) {
return false;
}
$form_values[$k] = $form_values[$k][0];
}
// Check if sender email exists
if ($v['element_type'] == FORM_EMAIL || $v['element_type'] == FORM_EMAIL_CONFIRM) {
$sender = $form_values[$k];
}
if ($v['element_type'] == FORM_DATE) {
$form_values[$k] = fn_parse_date($form_values[$k]);
}
if ($v['element_type'] == FORM_REFERER) {
$form_values[$k] = $_SESSION['auth']['referer'];
}
if ($v['element_type'] == FORM_IP_ADDRESS) {
$ip = fn_get_ip();
$form_values[$k] = $ip['host'];
}
}
$max_length += 2;
fn_set_hook('send_form', $page_data, $form_values);
Registry::get('view_mail')->assign('max_length', $max_length);
Registry::get('view_mail')->assign('elements', $page_data['form']['elements']);
Registry::get('view_mail')->assign('form_title', $page_data['page']);
Registry::get('view_mail')->assign('form_values', $form_values);
fn_send_mail($page_data['form']['general'][FORM_RECIPIENT], Registry::get('settings.Company.company_support_department'), 'addons/form_builder/form_subject.tpl', 'addons/form_builder/form_body.tpl', $attachments, CART_LANGUAGE, $sender);
}
return false;
}
示例12: fn_se_prepare_request_params
function fn_se_prepare_request_params($params)
{
$restrict_by = $query_by = $union = array();
//
// Hide products with empty categories and wrong usergroup categories
//
$restrict_by['empty_categories'] = 'N';
$restrict_by['category_usergroup_ids'] = join('|', $_SESSION['auth']['usergroup_ids']);
//
// Filters
//
$filter_fields = fn_get_product_filter_fields();
$advanced_variant_ids = $simple_variant_ids = $av_ids = $ranges_ids = $fields_ids = $slider_vals = array();
if (!empty($params['features_hash'])) {
list($av_ids, $ranges_ids, $fields_ids, $slider_vals) = fn_parse_features_hash($params['features_hash']);
}
if (!empty($params['multiple_variants']) && !empty($params['advanced_filter'])) {
$simple_variant_ids = $params['multiple_variants'];
}
if (!empty($av_ids)) {
$features_variants_ids = db_get_hash_single_array("SELECT feature_id, GROUP_CONCAT(variant_id) as variant_ids FROM ?:product_feature_variants WHERE variant_id IN (?n) GROUP BY feature_id", array('feature_id', 'variant_ids'), $av_ids);
foreach ($features_variants_ids as $feature_id => $variant_ids) {
$restrict_by['feature_' . $feature_id] = str_replace(',', '|', $variant_ids);
}
}
if (!empty($simple_variant_ids)) {
$features_variants_ids = db_get_hash_single_array("SELECT feature_id, GROUP_CONCAT(variant_id) as variant_ids FROM ?:product_feature_variants WHERE variant_id IN (?n) GROUP BY feature_id", array('feature_id', 'variant_ids'), $simple_variant_ids);
foreach ($features_variants_ids as $feature_id => $variant_ids) {
$restrict_by['feature_' . $feature_id] = $variant_ids;
}
}
// Feature ranges
if (!empty($params['custom_range'])) {
foreach ($params['custom_range'] as $feature_id => $v) {
$is_from = isset($v['from']) && fn_string_not_empty($v['from']);
$is_to = isset($v['to']) && fn_string_not_empty($v['to']);
if ($is_from || $is_to) {
if (!empty($v['type'])) {
if ($v['type'] == 'D') {
$v['from'] = fn_parse_date($v['from']);
$v['to'] = fn_parse_date($v['to']);
}
}
$restrict_by['feature_' . $feature_id] = ($is_from ? $v['from'] : '') . ',' . ($is_to ? $v['to'] : '');
}
}
}
// Product field ranges
if (!empty($params['field_range'])) {
foreach ($params['field_range'] as $field_type => $v) {
$structure = $filter_fields[$field_type];
if (!empty($structure) && (!empty($v['from']) || !empty($v['to']))) {
if ($field_type == 'P') {
// price
$v['cur'] = !empty($v['cur']) ? $v['cur'] : CART_SECONDARY_CURRENCY;
if (empty($v['orig_cur'])) {
// saving the first user-entered values
// will be always search by it
$v['orig_from'] = $v['from'];
$v['orig_to'] = $v['to'];
$v['orig_cur'] = $v['cur'];
$params['field_range'][$field_type] = $v;
}
if ($v['orig_cur'] != CART_PRIMARY_CURRENCY) {
// calc price in primary currency
$cur_prim_coef = Registry::get('currencies.' . $v['orig_cur'] . '.coefficient');
$decimals = Registry::get('currencies.' . CART_PRIMARY_CURRENCY . '.decimals');
$search_from = round($v['orig_from'] * floatval($cur_prim_coef), $decimals);
$search_to = round($v['orig_to'] * floatval($cur_prim_coef), $decimals);
} else {
$search_from = $v['orig_from'];
$search_to = $v['orig_to'];
}
// if user switch the currency, calc new values for displaying in filter
if ($v['cur'] != CART_SECONDARY_CURRENCY) {
if (CART_SECONDARY_CURRENCY == $v['orig_cur']) {
$v['from'] = $v['orig_from'];
$v['to'] = $v['orig_to'];
} else {
$prev_coef = Registry::get('currencies.' . $v['cur'] . '.coefficient');
$cur_coef = Registry::get('currencies.' . CART_SECONDARY_CURRENCY . '.coefficient');
$v['from'] = floor(floatval($v['from']) * floatval($prev_coef) / floatval($cur_coef));
$v['to'] = ceil(floatval($v['to']) * floatval($prev_coef) / floatval($cur_coef));
}
$v['cur'] = CART_SECONDARY_CURRENCY;
$params['field_range'][$field_type] = $v;
}
}
$params["{$structure['db_field']}_from"] = trim(isset($search_from) ? $search_from : $v['from']);
$params["{$structure['db_field']}_to"] = trim(isset($search_to) ? $search_to : $v['to']);
}
}
}
foreach ($ranges_ids as $range_id) {
$range = db_get_row("SELECT * FROM ?:product_filter_ranges WHERE range_id = ?i", $range_id);
if (!empty($range)) {
$feature = 'feature_' . $range['feature_id'];
$restrict_by[$feature] = empty($restrict_by[$feature]) ? "{$range['from']},{$range['to']}" : $restrict_by[$feature] . "|{$range['from']},{$range['to']}";
}
}
//.........这里部分代码省略.........
示例13: elseif
} elseif ($mode == 'm_delete') {
$params = $_REQUEST['courier_ids'];
if (!empty($params)) {
foreach ($params as $c) {
$c = explode('||', $c);
$id = $c[0];
$owner_id = $c[1];
fn_spsr_delete_courier($id, $owner_id);
}
}
$suffix = ".manage";
} elseif ($mode == 'update') {
$params = $_REQUEST['spsr_courier'];
if (!empty($params)) {
RusSpsr::WALogin();
$date = date('Y-m-d', fn_parse_date($params['necesserydate'])) . 'T00:00:00.000';
$service = $params['service'];
$placescount = 1;
$address = explode('||', $params['sbor_addr']);
$sboraddr_id = $address[0];
$sboraddr_owner_id = $address[1];
$fio = $address[2];
$city = $address[3];
$receiver_city = RusSpsr::WAGetCities(array('city' => $city));
$data = array('date' => $date, 'time' => $params['necesserytime'], 'receiver_city_id' => $receiver_city['City_ID'], 'receiver_city_owner_id' => $receiver_city['City_owner_ID'], 'mode' => $service, 'fio' => $fio, 'sboraddr_id' => $sboraddr_id, 'sboraddr_owner_id' => $sboraddr_owner_id, 'order_type' => 0, 'placescount' => $params['placescount'], 'weight' => $params['weight'], 'length' => $params['length'], 'width' => $params['width'], 'depth' => $params['depth'], 'description' => $params['description']);
$order_id = RusSpsr::WACreateOrder($data);
if (!empty($order_id)) {
fn_set_notification('N', __('notice'), __('shippings.spsr.order_add') . ' : ' . $order_id);
} else {
fn_set_notification('E', __('notice'), __('shippings.spsr.not_order_add') . ' : ' . RusSpsr::$last_error);
}
示例14: fn_update_event
function fn_update_event($event_data, $event_id = 0)
{
$event_data['start_date'] = fn_parse_date($event_data['start_date']);
$event_data['end_date'] = fn_parse_date($event_data['end_date'], true);
if ($event_data['start_date'] > TIME) {
$event_data['status'] = 'A';
} elseif ($event_data['end_date'] < TIME) {
$event_data['status'] = 'F';
} else {
$event_data['status'] = 'P';
}
$_data = $event_data;
$_data['user_id'] = $_SESSION['auth']['user_id'];
if (empty($event_id)) {
$event_id = db_query("INSERT INTO ?:giftreg_events ?e", $_data);
} else {
db_query("UPDATE ?:giftreg_events SET ?u WHERE event_id = ?i", $_data, $event_id);
}
fn_update_event_subscribers($event_data, $event_id);
// Generate access key for editing this event
if (AREA == 'C') {
$access_key = fn_event_generate_ekey($event_id, true);
}
// Generate access key for event subscribers (for private event)
if ($_data['type'] == 'U') {
fn_event_generate_ekey($event_id);
}
if (!empty($event_data['fields'])) {
$_data = array('event_id' => $event_id);
db_query("DELETE FROM ?:giftreg_event_fields WHERE event_id = ?i", $event_id);
foreach ($event_data['fields'] as $field_id => $value) {
if (substr_count($value, '/') == 2) {
// FIXME: it's date field
$value = fn_parse_date($value);
}
$_data['field_id'] = $field_id;
$_data['value'] = $value;
db_query("INSERT INTO ?:giftreg_event_fields ?e", $_data);
}
}
fn_set_hook('update_event', $event_data, $event_id);
return array($event_id, empty($access_key) ? '' : $access_key);
}
示例15: die
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (($mode == 'customer_info' || $mode == 'add_profile') && !empty($_REQUEST['user_data']['birthday'])) {
$_REQUEST['user_data']['birthday'] = fn_parse_date($_REQUEST['user_data']['birthday']);
}
}