コード例 #1
0
ファイル: offer_controller.php プロジェクト: reboxhost/phpb2b
 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();
             }
         }
     }
 }
コード例 #2
0
ファイル: post.php プロジェクト: renduples/alibtob
$member = new Members();
$trade = new Trades();
$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) {