$offer = new Tradefields(); $area = new Areas(); $industry = new Industries(); $company = new Companies(); $trade = new Trade(); $trade_model = new Trades(); $member = new Members(); $typeoption = new Typeoption(); $form = new Forms(); setvar("Genders", $typeoption->get_cache_type('gender')); setvar("PhoneTypes", $typeoption->get_cache_type('phone_type')); $viewhelper->setTitle(L("offer", "tpl")); $viewhelper->setPosition(L("offer", "tpl"), "offer/"); if (isset($_GET['title'])) { $title = rawurldecode(trim($_GET['title'])); $res = $trade_model->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $trade->setInfoById($id); $info = $trade->info; if (empty($info['id'])) { flash("data_not_exists", '', 0); } $info['title'] .= ($_PB_CACHE['setting']['offer_expire_method'] == 1 || $_PB_CACHE['setting']['offer_expire_method'] == 3) && $info['expdate'] < $time_stamp ? "[" . L("has_expired", "tpl") . "]" : ''; $info['title'] .= !empty($info['if_urgent']) ? "[" . L("urgent_buy", "tpl") . "]" : ''; if ($info['expdate'] < $time_stamp && $_PB_CACHE['setting']['offer_expire_method'] == 2) { flash("has_been_expired", URL, 0, $info['title']);
function add() { global $G; require CLASS_PATH . "validation.class.php"; $validate = new Validation(); uses("trade", "member", "tradefield", "tag"); $tag = new Tags(); $offer = $tradefield = new Tradefields(); $member = new Members(); $trade = new Trades(); if (isset($_POST['visit_post'])) { capt_check("capt_post_free"); pb_submit_check('visit_post'); $_POST['data']['trade']['title'] = pb_lang_merge($_POST['data']['multi']); $trade->setParams(); $tradefield->setParams(); $if_title_exists = $trade->findByTitle($trade->params['data']['trade']['title']); if (!empty($if_title_exists)) { $trade->validationErrors[] = L("semilar_offer_post"); } if (!$validate->notEmpty($trade->params['data']['trade']['title'])) { $trade->validationErrors[] = L("title_cant_be_empty"); } $trade->params['expire_days'] = $_POST['expire_days']; $if_check = $G['setting']['vis_post_check']; $msg = null; $words = $trade->dbstuff->GetArray("SELECT * FROM {$trade->table_prefix}words"); if (!empty($words)) { foreach ($words as $word_val) { if (!empty($word_val['title'])) { str_replace($word_val['title'], "***", $trade->params['data']['trade']['title']); str_replace($word_val['title'], "***", $trade->params['data']['trade']['content']); } } $item['forbid_word'] = implode("\r\n", $tmp_str); } if ($if_check) { $trade->params['data']['trade']['status'] = 0; $msg = 'pls_wait_for_check'; } else { $trade->params['data']['trade']['status'] = 1; $msg = 'success'; } if (!empty($trade->validationErrors)) { setvar("item", am($trade->params['data']['trade'], $tradefield->params['data']['tradefield'])); setvar("Errors", $validate->show($trade)); render("offer/post"); } else { $trade->params['data']['trade']['industry_id'] = implode(",", $_POST['industry']['id']); $trade->params['data']['trade']['area_id'] = implode(",", $_POST['area']['id']); $result = $trade->Add(); if ($result) { flash($msg); } else { flash(); } } } }
$trade_controller = new Trade(); $tradefield = new Tradefields(); $expires = $trade_controller->getOfferExpires(); setvar("Genders", $typeoption->get_cache_type("gender", null, array("0", "-1"))); setvar("PhoneTypes", $typeoption->get_cache_type("phone_type")); setvar("ImTypes", $typeoption->get_cache_type("im_type")); $if_visit_post = $_PB_CACHE['setting']['vis_post']; if (!$if_visit_post) { $smarty->flash('visitor_forbid', URL, 0); } capt_check("capt_post_free"); if (isset($_POST['visit_post'])) { pb_submit_check('visit_post'); $trade->setParams(); $tradefield->setParams(); $if_title_exists = $trade->findByTitle($trade->params['data']['trade']['title']); if (!empty($if_title_exists)) { $trade->validationErrors[] = L("semilar_offer_post"); } if (!$validate->notEmpty($trade->params['data']['trade']['title'])) { $trade->validationErrors[] = L("title_cant_be_empty"); } $trade->params['expire_days'] = $_POST['expire_days']; //$trade->params['data']['trade']['tag_ids'] = $tag->setTagId($_POST['data']['tag']);; $if_check = $_PB_CACHE['setting']['vis_post_check']; $msg = null; $words = $pdb->GetArray("SELECT * FROM {$tb_prefix}words"); if (!empty($words)) { foreach ($words as $word_val) { if (!empty($word_val['title'])) { str_replace($word_val['title'], "***", $trade->params['data']['trade']['title']);