function get_user_tpl($type, $tpldir) { global $db; $type = intval($type); $result = $db->query("select * from " . table('tpl') . " where tpl_type='{$type}'"); while ($row = $db->fetch_array($result)) { $row['info'] = get_templates_info("../templates/" . $tpldir . "/" . $row['tpl_dir'] . "/info.txt"); $row_arr[] = $row; } return $row_arr; }
$setsqlarr['tpl_name'] = trim($_POST['tpl_name'][$i]); $setsqlarr['tpl_display'] = intval($_POST['tpl_display'][$i]); $setsqlarr['tpl_val'] = intval($_POST['tpl_val'][$i]); !$db->updatetable(table('tpl'), $setsqlarr, " tpl_id=" . intval($_POST['tpl_id'][$i])) ? adminmsg("保存加失败!", 0) : ""; } } adminmsg("保存成功!", 2); } elseif ($act == 'refresh_tpl') { check_token(); $type = intval($_GET['type']); $tpl_dir = trim($_GET['tpl_dir']); $tab_dir = get_user_tpl_dir($type); $dirs = getsubdirs('../templates/' . $tpl_dir); foreach ($dirs as $str) { if (!in_array($str, $tab_dir)) { $info = get_templates_info("../templates/" . $tpl_dir . "/" . $str . "/info.txt"); $db->query("INSERT INTO " . table('tpl') . " (tpl_name,tpl_dir,tpl_type) VALUES ('{$info['name']}','{$str}','{$type}')"); } $dararray[] = " tpl_dir!='{$str}' "; } if (!empty($dararray)) { $db->query("Delete from " . table('tpl') . " WHERE " . implode(" and ", $dararray) . " AND tpl_type='{$type}'"); } adminmsg('刷新成功', 2); } elseif ($act == 'resume_tpl') { get_token(); check_permissions($_SESSION['admin_purview'], "tpl_resume"); $smarty->assign('pageheader', "模板设置"); $smarty->assign('navlabel', "resume_tpl"); $smarty->assign('list', get_user_tpl(2, "tpl_resume")); $smarty->display('tpl/admin_resume_tpl_list.htm');
} $smarty->assign('type', $type); } $smarty->assign('ad_category', $ad_category); $dirs = getsubdirs('../templates'); unset($dirs[array_search("tpl_company", $dirs)]); unset($dirs[array_search("tpl_resume", $dirs)]); unset($dirs[array_search("tpl_hunter", $dirs)]); unset($dirs[array_search("tpl_train", $dirs)]); unset($dirs[array_search("tpl_shop", $dirs)]); unset($dirs[array_search("tpl_campus", $dirs)]); unset($dirs[array_search("tpl_evaluation", $dirs)]); $list = array(); foreach ($dirs as $k => $val) { $list[$k]['dir'] = $val; $list[$k]['info'] = get_templates_info("../templates/" . $val . "/info.txt"); } $smarty->assign('list', $list); $smarty->assign('pageheader', "广告管理"); get_token(); $smarty->display('ads/admin_ad_category_edit.htm'); } elseif ($act == 'ad_category_edit_save') { check_permissions($_SESSION['admin_purview'], "ad_category"); check_token(); $link[0]['text'] = "返回广告位列表"; $link[0]['href'] = "?act=ad_category"; if (intval($_POST['admin_set']) != 1) { $setsqlarr['categoryname'] = trim($_POST['categoryname']) ? trim($_POST['categoryname']) : adminmsg('您没有广告位名称!', 1); $setsqlarr['alias'] = trim($_POST['alias']) ? trim($_POST['alias']) : adminmsg('您没有填写调用名称!', 1); substr($setsqlarr['alias'], 0, 3) == 'QS_' ? adminmsg('自定义广告位调用名称不允许 QS_ 开头!', 1) : ''; ck_category_alias($setsqlarr['alias'], $_POST['id']) ? adminmsg('调用名称已经存在,请换一个调用名称!', 1) : '';