Esempio n. 1
0
            if (empty($sim)) {
                //content
                if (preg_match($remote_content_match, $temp, $match)) {
                    $content = addslashes(trim($match[1]));
                }
                $u++;
                $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")";
            }
        } else {
            //content
            if (preg_match($remote_content_match, $temp, $match)) {
                $content = addslashes(trim($match[1]));
            }
            $u++;
            $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")";
        }
    }
    $sql = array_filter($sql);
    if (!empty($sql)) {
        $ins_str = "INSERT INTO {$tb_prefix}newses (title,content,type_id,created) VALUES " . implode(",", $sql);
        $result = $pdb->Execute($ins_str);
    }
    if ($result) {
        flash("success");
    } else {
        flash();
    }
}
setvar("NewstypeOptions", $newstype->getTypeOptions());
setvar("AskAction", $typeoption->get_cache_type("common_option"));
template($tpl_file);
Esempio n. 2
0
     $news->del($id);
     $attachment->deleteBySource($attach_filename);
 }
 if ($do == "edit") {
     $news_info = null;
     $_PB_CACHE['area'] = cache_read("area");
     $_PB_CACHE['industry'] = cache_read("industry");
     setvar("CacheAreas", $_PB_CACHE['area']);
     setvar("CacheIndustries", $_PB_CACHE['industry']);
     $result = $membertype->findAll("id,name", null, $conditions, " id desc");
     $user_types = array();
     foreach ($result as $key => $val) {
         $user_types[$val['id']] = $val['name'];
     }
     setvar("Membertypes", pb_lang_split_recursive($user_types));
     $_newstypes = $newstype->getTypeOptions();
     setvar("NewstypeOptions", $_newstypes);
     if (!empty($id)) {
         $item_info = $news->read("*", $id);
         if ($item_info['picture']) {
             $item_info['image'] = pb_get_attachmenturl($item_info['picture'], "../", 'small');
         }
         $tag->getTagsByIds($item_info['tag_ids'], true);
         $item_info['tag'] = $tag->tag;
     }
     if ($action == "convert") {
         if (!empty($_GET['companynewsid'])) {
             $item_info['title'] = $pdb->GetOne("SELECT title FROM {$tb_prefix}companynewses WHERE id=" . intval($_GET['companynewsid']));
         }
     }
     if (!empty($item_info)) {