} if ($do == "edit") { $news_info = null; include CACHE_PATH . "cache_area.php"; include CACHE_PATH . "cache_industry.php"; 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", $user_types); setvar("NewstypeOptions", $newstype->getTypeOptions()); 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)) { setvar("item", $item_info); } $tpl_file = "news.edit";
$tag = new Tags(); $conditions = array(); $viewhelper->setTitle(L("info", "tpl")); $viewhelper->setPosition(L("info", "tpl"), "news/"); if (isset($_GET['title'])) { $title = rawurldecode(trim($_GET['title'])); $res = $news->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { require CACHE_PATH . "cache_type.php"; $news->clicked($id); $info = $news->read("*", $id); if (empty($info) or !$info) { flash("data_not_exists", '', 0); } if (!empty($info['tag_ids'])) { $tag->getTagsByIds($info['tag_ids'], true); $info['tag'] = $tag->tag; } if (!empty($info['picture'])) { $info['image'] = pb_get_attachmenturl($info['picture'], '', 'small'); } $info['pubdate'] = df($info['created']); $info['typename'] = $_PB_CACHE['newstype'][$info['type_id']]; $viewhelper->setTitle($info['typename']); $viewhelper->setPosition($info['typename'], "news/list.php?typeid=" . $info['type_id']); $viewhelper->setTitle($info['title']);