break; } $res['cache_contacts'] = serialize($im_arr); } else { $res['cache_contacts'] = serialize(array('qq' => $memberinfo['qq'], 'icq' => $memberinfo['icq'], 'skype' => $memberinfo['skype'], 'yahoo' => $memberinfo['yahoo'], 'msn' => $memberinfo['msn'])); } } $tradefield_res['prim_tel'] = $_POST['data']['prim_tel']; $tradefield_res['prim_telnumber'] = $_POST['data']['prim_telnumber']; $tradefield_res['prim_im'] = $_POST['data']['prim_im']; $tradefield_res['prim_imaccount'] = $_POST['data']['prim_imaccount']; $res['industry_id'] = PbController::getMultiId($_POST['industry']['id']); $res['area_id'] = PbController::getMultiId($_POST['area']['id']); $res['highlight'] = 0; if (!empty($id)) { $item_ids = $form->Add($id, $_POST['data']['formitem']); $res['formattribute_ids'] = $item_ids; $tradefield_res['trade_id'] = $id; $res['modified'] = $time_stamp; unset($res['member_id'], $res['company_id']); $res = $trade->save($res, "update", $id, null, $conditions); } else { if ($g['max_offer'] && $now_offer_amount >= $g['max_offer']) { flash('one_day_max'); } $res['member_id'] = $the_memberid; $res['company_id'] = $company_id; $res['submit_time'] = $res['created'] = $res['modified'] = $time_stamp; if (!empty($_POST['expire_days'])) { if (array_key_exists($_POST['expire_days'], $trade_controller->getOfferExpires())) { $res['expire_days'] = $_POST['expire_days'];
if (isset($_POST['id'])) { $id = intval($_POST['id']); } if (!empty($_FILES['pic']['name'])) { $attach_id = empty($id) ? "product-" . $the_memberid . "-" . ($product->getMaxId() + 1) : "product-" . $the_memberid . "-" . $id; $attachment->rename_file = $attach_id; $attachment->upload_process(); $product->params['data']['product']['picture'] = $attachment->file_full_url; } $form_type_id = 2; $product->params['data']['product']['tag_ids'] = $tag->setTagId($_POST['data']['tag']); $product->params['data']['product']['cache_companyname'] = $companyinfo['name']; $product->params['data']['product']['industry_id'] = PbController::getMultiId($_POST['industry']['id']); $product->params['data']['product']['area_id'] = PbController::getMultiId($_POST['area']['id']); if (!empty($id)) { $item_ids = $form->Add($id, $_POST['data']['formitem'], 1, $form_type_id); $product->params['data']['product']['modified'] = $time_stamp; $product->params['data']['product']['formattribute_ids'] = $item_ids; $result = $product->save($product->params['data']['product'], "update", $id, null, $conditions); } else { if ($g['max_product'] && $now_product_amount >= $g['max_product']) { flash('one_day_max'); } $product->params['data']['product']['member_id'] = $the_memberid; $product->params['data']['product']['company_id'] = $company_id; $product->params['data']['product']['created'] = $product->params['data']['product']['modified'] = $time_stamp; $result = $product->save($product->params['data']['product']); $new_id = $product->table_name . "_id"; $product_id = $product->{$new_id}; $item_ids = $form->Add($product_id, $_POST['data']['formitem'], 1, $form_type_id); if ($item_ids) {