} if ($n = del_train_news($id, $_SESSION['uid'])) { showmsg("删除成功!共删除 {$n} 行", 2); } else { showmsg("删除失败!", 0); } } elseif ($act == 'train_img') { $link[0]['text'] = "完善机构资料"; $link[0]['href'] = '?act=train_profile'; $link[1]['text'] = "会员中心首页"; $link[1]['href'] = 'train_index.php'; if (empty($train_profile['trainname'])) { showmsg("请完善您的机构资料再上传机构图片!", 1, $link); } $smarty->assign('title', '机构图片 - 机构会员中心 - ' . $_CFG['site_name']); $smarty->assign('img', get_train_img(0, 60, $_SESSION['uid'])); $smarty->display('member_train/train_img.htm'); } elseif ($act == 'train_img_save') { $n = $db->get_total("SELECT COUNT(*) AS num FROM " . table('train_img') . " WHERE uid='" . intval($_SESSION['uid']) . "'"); if ($n >= 8) { showmsg('机构图片最多发布8张!', 1); } require_once QISHI_ROOT_PATH . 'include/upload.php'; !$_FILES['img']['name'] ? showmsg('请上传图片!', 1) : ""; $datedir = date("Y/m/d/"); $up_dir = "../../data/train_img/original/" . $datedir; make_dir($up_dir); $setsqlarr['img'] = _asUpFiles($up_dir, "img", 800, 'gif/jpg/bmp/png', true); if ($setsqlarr['img']) { $img_src = $up_dir . $setsqlarr['img']; $thumb_dir = "../../data/train_img/thumb/" . $datedir;
} $_GET['audit'] != "" ? $wheresqlarr['i.audit'] = intval($_GET['audit']) : ''; if (is_array($wheresqlarr)) { $wheresql = wheresql($wheresqlarr); } if (!empty($_GET['settr'])) { $settr = strtotime("-" . intval($_GET['settr']) . " day"); $wheresql = empty($wheresql) ? " WHERE i.addtime> " . $settr : $wheresql . " AND i.addtime> " . $settr; } $joinsql = " LEFT JOIN " . table('train_profile') . " AS t ON i.train_id=t.id "; $total_sql = "SELECT COUNT(*) AS num FROM " . table('train_img') . " AS i" . $joinsql . $wheresql; $total_val = $db->get_total($total_sql); $page = new page(array('total' => $total_val, 'perpage' => $perpage, 'getarray' => $_GET)); $currenpage = $page->nowindex; $offset = ($currenpage - 1) * $perpage; $clist = get_train_img($offset, $perpage, $joinsql . $wheresql . $oederbysql); $smarty->assign('pageheader', "机构图片"); $smarty->assign('clist', $clist); $smarty->assign('page', $page->show(3)); $smarty->display('train/admin_train_img.htm'); } elseif ($act == 'del_train_img') { check_permissions($_SESSION['admin_purview'], "tra_img_del"); check_token(); $id = !empty($_REQUEST['id']) ? $_REQUEST['id'] : adminmsg("你没有选择图片!", 1); $num = del_train_img($id); if ($num > 0) { adminmsg("删除成功!共删除" . $num . "行", 2); } else { adminmsg("删除失败!", 0); } } elseif ($act == 'edit_img_audit') {