if (!empty($names)) { foreach ($names as $val) { $name = $val; if (!empty($name)) { $tmp_name[] = "('" . $name . "','" . $vals['level_id'] . "','" . $vals['parent_id'] . "','" . $vals['created'] . "')"; } } $values = implode(",", $tmp_name); $sql = "INSERT INTO {$tb_prefix}newstypes (name,level_id,parent_id,created) VALUES " . $values; $result = $pdb->Execute($sql); } } if (!$result) { flash(); } $cache->updateTypes(); } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == 'search') { if (isset($_GET['newstype']['name'])) { $conditions[] = "Newstype.name like '%" . trim($_GET['newstype']['name']) . "%'"; } } if ($do == "del" && !empty($id)) { $newstype->del($id); } if ($do == "edit") {
require "session_cp.inc.php"; require LIB_PATH . "cache.class.php"; include CACHE_PATH . "cache_type.php"; $cache = new Caches(); $tpl_file = "industrytype"; if (isset($_POST['do'])) { $do = trim($_POST['do']); if ($do == "save") { $ins_arr = array(); $tmp_arr = explode("\r\n", $_POST['data']['sort']); array_filter($tmp_arr); $i = 1; foreach ($tmp_arr as $key => $val) { $ins_arr[$i] = "(" . $i . ",'" . $val . "')"; $i++; } if (!empty($ins_arr)) { $ins_str = "REPLACE INTO {$tb_prefix}industrytypes (id,name) VALUES " . implode(",", $ins_arr) . ";"; $pdb->Execute($ins_str); } if ($cache->updateTypes()) { flash("success"); } else { flash(); } } } if (!empty($_PB_CACHE['industrytype'])) { setvar("sorts", implode("\r\n", $_PB_CACHE['industrytype'])); } template($tpl_file);
foreach ($names as $val) { $name = $val; if (!empty($name)) { $tmp_name[] = "('" . $name . "','" . $vals['level'] . "','" . $vals['parent_id'] . "')"; } } $values = implode(",", $tmp_name); $sql = "INSERT INTO {$tb_prefix}productcategories (name,level,parent_id) VALUES " . $values; $result = $pdb->Execute($sql); } } } if (!$result) { flash(); } else { $cache->updateTypes(); flash("success"); } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == "del" && !empty($id)) { $productcategories->del($id); } if ($do == "search") { if (isset($_GET['q'])) { $conditions[] = "name like '%" . trim($_GET['q']) . "%'"; }