require_once '../..' . __WEBADMIN_ROOT . '/checklogin.php'; $objWebInit = new weixin_teachers(); $objWebInit->db(); //访问权限检查 if (!$objWebInit->checkPopedomG($_SESSION['user_id'], 'r')) { check::AlertExit('对不起,您没有读权限', -1); } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['type_id']) || empty($_POST['title']) || empty($_POST['intro'])) { check::AlertExit("错误:有必填选项没填!", -1); } if ($_POST['title'] != '') { $_POST['title_md5'] = md5($_POST['title']); } //判断是否发布重复信息 $arrTemp = $objWebInit->getInfoList("where title_md5='{$_POST['title_md5']}' and user_id = '{$_SESSION['user_id']}' and type_id='{$_POST['type_id']}'", "", 0, 1); if ($arrTemp['COUNT_ROWS'] != 0) { check::AlertExit("错误:相同的信息请不要重复发布!需要刷新排列的话,请使用列表下方“提前”选项!", -1); } //新图上传 set_time_limit(0); foreach ($_FILES as $key => $val) { if (strrpos($key, 'Filedata') === false) { continue; } $num = substr($key, strlen('Filedata')); if (!empty($_FILES['Filedata' . $num]['name'])) { $arrTemp = array(); $arrTemp['photo'] = $objWebInit->uploadInfoImage($_FILES['Filedata' . $num], $num, $objWebInit->arrGPic['FileListPicSize'], $objWebInit->arrGPic['FileSourPicSize']); $arrTemp['photo_narrate'] = $_POST['photo_narrate' . $num]; $_POST['photo'][$num] = $arrTemp;
$arrWhere[] = "tag LIKE '%{$v}%'"; } } } $arrLink[] = 'keywords=' . urlencode($strKeywords); } else { check::AlertExit("错误:关键词必须填写!", -1); } if (empty($_GET['page'])) { $intPage = 1; } else { $intPage = intval($_GET['page']); } $strWhere = implode(' AND ', $arrWhere); $strWhere = 'where ' . $strWhere; $arrInfoList = $objWebInit->getInfoList($strWhere, ' ORDER BY topflag DESC,submit_date DESC', ($intPage - 1) * $arrGPage['page_size'], $arrGPage['page_size']); $intRows = $arrInfoList['COUNT_ROWS']; unset($arrInfoList['COUNT_ROWS']); // 输出到模板 if ($intRows == '1') { //有单条记录 $strUrl = $arrGWeb['WEB_ROOT_pre'] . '/' . $arrGWeb['module_id'] . '/detail.php?id=' . $arrInfoList[0]['id']; header("Location: {$strUrl}"); exit; } //翻页跳转link $strPage = $objWebInit->makeInfoListPage($intRows, $strLink, $link_type = $arrGWeb['URL_static'], '4'); // 输出到模板 $arrMOutput["smarty_assign"]['arrInfoList'] = $arrInfoList; $arrMOutput["smarty_assign"]['strPage'] = $strPage; $arrMOutput["smarty_assign"]['page'] = $intPage;
$objWebInit->fetchAllChildID($_REQUEST['type_id'], $arrMType, $arrChild); $typeStr = implode($arrChild['type_id'], ','); $arrWhere[] = "type_id in ( " . $typeStr . ")"; $arrLink[] = "type_id=" . $intTypeID; } if (!empty($arrMType)) { foreach ($arrMType as $k => $v) { if ($v['type_id'] == intval($_GET['type_id'])) { $arrMOutput["smarty_assign"]['strTypeTitle'] = $v['type_title']; break; } } } $strWhere = implode(' AND ', $arrWhere); $strWhere = 'where ' . $strWhere; $arrInfoList = $objWebInit->getInfoList($strWhere, ' ORDER BY topflag DESC,submit_date DESC', ($intPage - 1) * $arrGPage['page_size'], $arrGPage['page_size'], 'id,type_id,title,thumbnail,submit_date,bedeck,summary'); $arrInfoListTmp = $objWebInit->getInfoList($strWhere, ' ORDER BY topflag DESC,submit_date DESC', ($intPage - 1) * $arrGPage['page_size'], $arrGPage['page_size'], 'structon_tb'); for ($i = 0; $i < count($arrInfoListTmp) - 1; $i++) { $TmpVideo[$i] = $arrInfoListTmp[$i]['video']; } for ($i = 0; $i < count($arrInfoList) - 1; $i++) { $arrInfoList[$i]['video'] = $TmpVideo[$i]; } //print_r($arrInfoListTmp);die; //print_r($arrInfoList);die; $intRows = $arrInfoList['COUNT_ROWS']; unset($arrInfoList['COUNT_ROWS']); //print_r($arrInfoList);die; // 单条信息跳转详细页 /* if($intRows == '1'){//有单条记录
if (empty($_GET['sort'])) { $strOrder = ' ORDER BY submit_date DESC'; } elseif ($_GET['sort'] == 1) { $strOrder = ' ORDER BY topflag DESC,submit_date DESC'; } elseif ($_GET['sort'] == 2) { $strOrder = ' ORDER BY recommendflag DESC,submit_date DESC'; } elseif ($_GET['sort'] == 3) { $strOrder = ' ORDER BY ID DESC'; } elseif ($_GET['sort'] == 4) { $strOrder = ' ORDER BY ID ASC'; } $arrLink[] = 'sort=' . $_GET['sort']; if (!isset($_GET['page']) || $_GET['page'] == '') { $_GET['page'] = $arrGPage['page']; } $arrData = $objWebInit->getInfoList($strWhere, $strOrder, ($_GET['page'] - 1) * $arrGPage['page_size'], $arrGPage['page_size'], true); //翻页跳转link $strLink = ''; if (!empty($arrLink)) { $strLink = implode('&', $arrLink); } $strPage = $objWebInit->makeInfoListPage($arrData['COUNT_ROWS'], $strLink); unset($arrData['COUNT_ROWS']); $arrMType = $objWebInit->getTypeList(); // 取类别标题 if (is_array($arrMType) && !empty($arrMType)) { $objWebInit->makeTypeCache($arrGWeb['module_id']); foreach ($arrData as $k => $data) { foreach ($arrMType as $k1 => $type) { if ($data['type_id'] == $type['type_id']) { $arrData[$k]['type_title'] = $type['type_title'];
$strTitle = $arrInfo['meta_Title']; } else { $strTitle = $arrInfo['title']; } if (!empty($arrInfo['meta_Description'])) { $strDescription = $arrInfo['meta_Description']; } else { $strDescription = $strTitle . ',' . $arrInfo['summary']; } if (!empty($arrInfo['meta_Keywords'])) { $strKeywords = $arrInfo['meta_Keywords']; } else { $strKeywords = $arrInfo['title']; } //下五条 $strWhereNext = "where id < {$intID}"; $arrInfoListNext = $objWebInit->getInfoList($strWhereNext, ' ORDER BY topflag DESC,submit_date DESC,id DESC', 0, 1, 'id,title,submit_date,bedeck', '', false); $strWhereNext = "where id > {$intID}"; $arrInfoListLast = $objWebInit->getInfoList($strWhereNext, ' ORDER BY topflag DESC,submit_date DESC,id DESC', 0, 1, 'id,title,submit_date,bedeck', '', false); // 输出到模板 $arrMOutput["smarty_assign"]['arrData'] = $arrInfo; $arrMOutput["smarty_assign"]['arrInfoListNext'] = $arrInfoListNext; $arrMOutput["smarty_assign"]['arrInfoListLast'] = $arrInfoListLast; $arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath']; $arrMOutput["smarty_assign"]['arrMType'] = $arrMType; $arrMOutput["smarty_assign"]['arrGWeb']['css'][] = 'weixin_teachers02.css'; $arrMOutput['smarty_assign']['Title'] = $strTitle . ' - ' . $arrGWeb['name']; $arrMOutput['smarty_assign']['Description'] = $strDescription . ' - ' . $arrGWeb['name']; $arrMOutput['smarty_assign']['Keywords'] = $strKeywords . ' - ' . $arrGWeb['name']; $arrMOutput["smarty_assign"]['MAIN'] = $arrGSmarty['main_dir'] . 'detail.html'; $objWebInit->output($arrMOutput);