帝国cms分页代码文件t_functions.php

代码为:

  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. define('InEmpireCMSTfun',TRUE);
  7. require_once(ECMS_PATH."e/class/userfun.php");
  8.  
  9. //列表模板分页函数
  10. function sys_ShowListPage($num,$pagenum,$dolink,$dotype,$page,$lencord,$ok,$search="",$add){
  11. global $fun_r;
  12. //文件名
  13. if(empty($add['dofile']))
  14. {
  15. $add['dofile']='index';
  16. }
  17. //静态页数
  18. $repagenum=$add['repagenum'];
  19. //首页
  20. if($pagenum<>1)
  21. {
  22. $pagetop="<a href='".$dolink.$add['dofile'].$dotype."'>".$fun_r['startpage']."</a>&nbsp;&nbsp;";
  23. }
  24. else
  25. {
  26. $pagetop=$fun_r['startpage']."&nbsp;&nbsp;";
  27. }
  28. //上一页
  29. if($pagenum<>1)
  30. {
  31. $pagepr=$pagenum-1;
  32. if($pagepr==1)
  33. {
  34. $prido=$add['dofile'].$dotype;
  35. }
  36. else
  37. {
  38. $prido=$add['dofile'].'_'.$pagepr.$dotype;
  39. }
  40. $pagepri="<a href='".$dolink.$prido."'>".$fun_r['pripage']."</a>&nbsp;&nbsp;";
  41. }
  42. else
  43. {
  44. $pagepri=$fun_r['pripage']."&nbsp;&nbsp;";
  45. }
  46. //下一页
  47. if($pagenum<>$page)
  48. {
  49. $pagenex=$pagenum+1;
  50. $nextpagelink=$repagenum&&$repagenum<$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$dotype;
  51. $pagenext="<a href='".$nextpagelink."'>".$fun_r['nextpage']."</a>&nbsp;&nbsp;";
  52. }
  53. else
  54. {
  55. $pagenext=$fun_r['nextpage']."&nbsp;&nbsp;";
  56. }
  57. //尾页
  58. if($pagenum==$page)
  59. {
  60. $pageeof=$fun_r['lastpage'];
  61. }
  62. else
  63. {
  64. $lastpagelink=$repagenum&&$repagenum<$page?eReturnRewritePageLink2($add,$page):$dolink.$add['dofile'].'_'.$page.$dotype;
  65. $pageeof="<a href='".$lastpagelink."'>".$fun_r['lastpage']."</a>";
  66. }
  67. $options="";
  68. //取得下拉页码
  69. if(empty($search))
  70. {
  71. for($go=1;$go<=$page;$go++)
  72. {
  73. if($go==1)
  74. {$file=$add['dofile'].$dotype;}
  75. else
  76. {$file=$add['dofile'].'_'.$go.$dotype;}
  77. $thispagelink=$repagenum&&$repagenum<$go?eReturnRewritePageLink2($add,$go):$dolink.$file;
  78. if($ok==$go)
  79. {$select=" selected";}
  80. else
  81. {$select="";}
  82. $myoptions.="<option value='".$thispagelink."'>".$fun_r['gotos'].$go.$fun_r['gotol']."</option>";
  83. $options.="<option value='".$thispagelink."'".$select.">".$fun_r['gotos'].$go.$fun_r['gotol']."</option>";
  84. }
  85. }
  86. else
  87. {
  88. $myoptions=$search;
  89. $options=str_replace("value='".$dolink.$add['dofile'].'_'.$ok.$dotype."'>","value='".$dolink.$add['dofile']."_".$ok.$dotype."' selected>",$search);
  90. }
  91. $options="<select name=select onchange=\"self.location.href=this.options[this.selectedIndex].value\">".$options."</select>";
  92. //分页
  93. $pagelink=$pagetop.$pagepri.$pagenext.$pageeof;
  94. //替换模板变量
  95. $pager['showpage']=ReturnListpageStr($pagenum,$page,$lencord,$num,$pagelink,$options);
  96. $pager['option']=$myoptions;
  97. return $pager;
  98. }
  99.  
  100. //列表模板之列表式分页
  101. function sys_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search="",$add){
  102. global $fun_r,$public_r;
  103. if($num<=$line)
  104. {
  105. $pager['showpage']='';
  106. return $pager;
  107. }
  108. //文件名
  109. if(empty($add['dofile']))
  110. {
  111. $add['dofile']='index';
  112. }
  113. //静态页数
  114. $repagenum=$add['repagenum'];
  115. $page_line=$public_r['listpagelistnum'];
  116. $snum=2;
  117. //$totalpage=ceil($num/$line);//取得总页数
  118. $firststr='&nbsp;&nbsp;共有'.$num.'条记录';
  119. //上一页
  120. if($page<>1)
  121. {
  122. $toppage='<a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a>&nbsp;';
  123. $pagepr=$page-1;
  124. if($pagepr==1)
  125. {
  126. $prido=$add['dofile'].$type;
  127. }
  128. else
  129. {
  130. $prido=$add['dofile'].'_'.$pagepr.$type;
  131. }
  132. $prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';
  133. }
  134. //下一页
  135. if($page!=$totalpage)
  136. {
  137. $pagenex=$page+1;
  138. $nextpagelink=$repagenum&&$repagenum<$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$type;
  139. $lastpagelink=$repagenum&&$repagenum<$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add['dofile'].'_'.$totalpage.$type;
  140. $nextpage='&nbsp;<a href="'.$nextpagelink.'">'.$fun_r['nextpage'].'</a>';
  141. $lastpage='&nbsp;<a href="'.$lastpagelink.'">'.$fun_r['lastpage'].'</a>';
  142. }
  143. $starti=$page-$snum<1?1:$page-$snum;
  144. $no=0;
  145. for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
  146. {
  147. $no++;
  148. if($page==$i)
  149. {
  150. $is_1="<b>";
  151. $is_2="</b>";
  152. }
  153. elseif($i==1)
  154. {
  155. $is_1='<a href="'.$dolink.$add['dofile'].$type.'">';
  156. $is_2="</a>";
  157. }
  158. else
  159. {
  160. $thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
  161. $is_1='<a href="'.$thispagelink.'">';
  162. $is_2="</a>";
  163. }
  164. $returnstr.='&nbsp;'.$is_1.$i.$is_2;
  165. }
  166. $returnstr=$toppage.$prepage.$returnstr.$nextpage.$lastpage.$firststr;
  167. $pager['showpage']=$returnstr;
  168. return $pager;
  169. }
  170.  
  171. //返回内容分页
  172. function sys_ShowTextPage($totalpage,$page,$dolink,$add,$type,$search=""){
  173. global $fun_r,$public_r;
  174. if($totalpage==1)
  175. {
  176. return '';
  177. }
  178. $page_line=$public_r['textpagelistnum'];
  179. $snum=2;
  180. //$totalpage=ceil($num/$line);//取得总页数
  181. $firststr='<a title="Page">&nbsp;<b>'.$page.'</b>/<b>'.$totalpage.'</b> </a>&nbsp;&nbsp;';
  182. //上一页
  183. if($page<>1)
  184. {
  185. $toppage='<a href="'.$dolink.$add[filename].$type.'">'.$fun_r['startpage'].'</a>&nbsp;';
  186. $pagepr=$page-1;
  187. if($pagepr==1)
  188. {
  189. $prido=$add[filename].$type;
  190. }
  191. else
  192. {
  193. $prido=$add[filename].'_'.$pagepr.$type;
  194. }
  195. $prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';
  196. }
  197. //下一页
  198. if($page!=$totalpage)
  199. {
  200. $pagenex=$page+1;
  201. $nextpage='&nbsp;<a href="'.$dolink.$add[filename].'_'.$pagenex.$type.'">'.$fun_r['nextpage'].'</a>';
  202. $lastpage='&nbsp;<a href="'.$dolink.$add[filename].'_'.$totalpage.$type.'">'.$fun_r['lastpage'].'</a>';
  203. }
  204. $starti=$page-$snum<1?1:$page-$snum;
  205. $no=0;
  206. for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
  207. {
  208. $no++;
  209. if($page==$i)
  210. {
  211. $is_1="<b>";
  212. $is_2="</b>";
  213. }
  214. elseif($i==1)
  215. {
  216. $is_1='<a href="'.$dolink.$add[filename].$type.'">';
  217. $is_2="</a>";
  218. }
  219. else
  220. {
  221. $is_1='<a href="'.$dolink.$add[filename].'_'.$i.$type.'">';
  222. $is_2="</a>";
  223. }
  224. $returnstr.='&nbsp;'.$is_1.$i.$is_2;
  225. }
  226. $returnstr=$toppage.$prepage.$returnstr.$nextpage.$lastpage.$firststr;
  227. return $returnstr;
  228. }
  229.  
  230. //返回下拉式内容分页导航
  231. function sys_ShowTextPageSelect($thispagenum,$dolink,$add,$filetype,$n_r){
  232. if($thispagenum==1)
  233. {
  234. return '';
  235. }
  236. $titleselect='';
  237. for($j=1;$j<=$thispagenum;$j++)
  238. {
  239. if($j==1)
  240. {
  241. $title=$add[title];
  242. $plink=$add[filename].$filetype;
  243. }
  244. else
  245. {
  246. $k=$j-1;
  247. $ti_r=explode('[/!--empirenews.page--]',$n_r[$k]);
  248. if(count($ti_r)>=2&&$ti_r[0])
  249. {
  250. $title=$ti_r[0];
  251. }
  252. else
  253. {
  254. $title=$add[title].'('.$j.')';
  255. }
  256. $plink=$add[filename].'_'.$j.$filetype;
  257. }
  258. $titleselect.='<option value="'.$dolink.$plink.'?'.$j.'">'.$title.'</option>';
  259. }
  260. $titleselect='<select name="titleselect" onchange="self.location.href=this.options[this.selectedIndex].value">'.$titleselect.'</select>';
  261. return $titleselect;
  262. }
  263.  
  264. //返回sql语句
  265. function sys_ReturnBqQuery($classid,$line,$enews=0,$do=0,$ewhere='',$eorder=''){
  266. global $empire,$public_r,$class_r,$class_zr,$navclassid,$dbtbpre,$fun_r,$class_tr,$emod_r,$etable_r,$eyh_r;
  267. if($enews==24)//按sql查询
  268. {
  269. $query_first=substr($classid,0,7);
  270. if(!($query_first=='select '||$query_first=='SELECT '))
  271. {
  272. return "";
  273. }
  274. $classid=RepSqlTbpre($classid);
  275. $sql=$empire->query1($classid);
  276. if(!$sql)
  277. {
  278. echo"SQL Error: ".ReRepSqlTbpre($classid);
  279. }
  280. return $sql;
  281. }
  282. if($enews==0||$enews==1||$enews==2||$enews==9||$enews==12||$enews==15)//栏目
  283. {
  284. if(strstr($classid,','))//多栏目
  285. {
  286. $son_r=sys_ReturnMoreClass($classid,1);
  287. $classid=$son_r[0];
  288. $where=$son_r[1];
  289. }
  290. else
  291. {
  292. if($classid=='selfinfo')//显示当前栏目信息
  293. {
  294. $classid=$navclassid;
  295. }
  296. if($class_r[$classid][islast])
  297. {
  298. $where="classid='$classid'";
  299. }
  300. else
  301. {
  302. $where=ReturnClass($class_r[$classid][sonclass]);
  303. }
  304. }
  305. $tbname=$class_r[$classid][tbname];
  306. $mid=$class_r[$classid][modid];
  307. $yhid=$class_r[$classid][yhid];
  308. }
  309. elseif($enews==6||$enews==7||$enews==8||$enews==11||$enews==14||$enews==17)//专题
  310. {
  311. echo"Error:Change to use e:indexloop";
  312. return false;
  313. }
  314. elseif($enews==25||$enews==26||$enews==27||$enews==28||$enews==29||$enews==30)//标题分类
  315. {
  316. if(strstr($classid,','))//多标题分类
  317. {
  318. $son_r=sys_ReturnMoreTT($classid);
  319. $classid=$son_r[0];
  320. $where=$son_r[1];
  321. }
  322. else
  323. {
  324. $where="ttid='$classid'";
  325. }
  326. $mid=$class_tr[$classid][mid];
  327. $tbname=$emod_r[$mid][tbname];
  328. $yhid=$class_tr[$classid][yhid];
  329. }
  330. $query='';
  331. $qand=' and ';
  332. if($enews==0)//栏目最新
  333. {
  334. $query=' where ('.$where.')';
  335. $order='newstime';
  336. $yhvar='bqnew';
  337. }
  338. elseif($enews==1)//栏目热门
  339. {
  340. $query=' where ('.$where.')';
  341. $order='onclick';
  342. $yhvar='bqhot';
  343. }
  344. elseif($enews==2)//栏目推荐
  345. {
  346. $query=' where ('.$where.') and isgood>0';
  347. $order='newstime';
  348. $yhvar='bqgood';
  349. }
  350. elseif($enews==9)//栏目评论排行
  351. {
  352. $query=' where ('.$where.')';
  353. $order='plnum';
  354. $yhvar='bqpl';
  355. }
  356. elseif($enews==12)//栏目头条
  357. {
  358. $query=' where ('.$where.') and firsttitle>0';
  359. $order='newstime';
  360. $yhvar='bqfirst';
  361. }
  362. elseif($enews==15)//栏目下载排行
  363. {
  364. $query=' where ('.$where.')';
  365. $order='totaldown';
  366. $yhvar='bqdown';
  367. }
  368. elseif($enews==3)//所有最新
  369. {
  370. $qand=' where ';
  371. $order='newstime';
  372. $tbname=$public_r[tbname];
  373. $mid=$etable_r[$tbname][mid];
  374. $yhvar='bqnew';
  375. $yhid=$etable_r[$tbname][yhid];
  376. }
  377. elseif($enews==4)//所有点击排行
  378. {
  379. $qand=' where ';
  380. $order='onclick';
  381. $tbname=$public_r[tbname];
  382. $mid=$etable_r[$tbname][mid];
  383. $yhvar='bqhot';
  384. $yhid=$etable_r[$tbname][yhid];
  385. }
  386. elseif($enews==5)//所有推荐
  387. {
  388. $query=' where isgood>0';
  389. $order='newstime';
  390. $tbname=$public_r[tbname];
  391. $mid=$etable_r[$tbname][mid];
  392. $yhvar='bqgood';
  393. $yhid=$etable_r[$tbname][yhid];
  394. }
  395. elseif($enews==10)//所有评论排行
  396. {
  397. $qand=' where ';
  398. $order='plnum';
  399. $tbname=$public_r[tbname];
  400. $mid=$etable_r[$tbname][mid];
  401. $yhvar='bqpl';
  402. $yhid=$etable_r[$tbname][yhid];
  403. }
  404. elseif($enews==13)//所有头条
  405. {
  406. $query=' where firsttitle>0';
  407. $order='newstime';
  408. $tbname=$public_r[tbname];
  409. $mid=$etable_r[$tbname][mid];
  410. $yhvar='bqfirst';
  411. $yhid=$etable_r[$tbname][yhid];
  412. }
  413. elseif($enews==16)//所有下载排行
  414. {
  415. $qand=' where ';
  416. $order='totaldown';
  417. $tbname=$public_r[tbname];
  418. $mid=$etable_r[$tbname][mid];
  419. $yhvar='bqdown';
  420. $yhid=$etable_r[$tbname][yhid];
  421. }
  422. elseif($enews==18)//各表最新
  423. {
  424. $qand=' where ';
  425. $order='newstime';
  426. $tbname=$classid;
  427. $mid=$etable_r[$tbname][mid];
  428. $yhvar='bqnew';
  429. $yhid=$etable_r[$tbname][yhid];
  430. }
  431. elseif($enews==19)//各表热门
  432. {
  433. $qand=' where ';
  434. $order='onclick';
  435. $tbname=$classid;
  436. $mid=$etable_r[$tbname][mid];
  437. $yhvar='bqhot';
  438. $yhid=$etable_r[$tbname][yhid];
  439. }
  440. elseif($enews==20)//各表推荐
  441. {
  442. $query=' where isgood>0';
  443. $order='newstime';
  444. $tbname=$classid;
  445. $mid=$etable_r[$tbname][mid];
  446. $yhvar='bqgood';
  447. $yhid=$etable_r[$tbname][yhid];
  448. }
  449. elseif($enews==21)//各表评论排行
  450. {
  451. $qand=' where ';
  452. $order='plnum';
  453. $tbname=$classid;
  454. $mid=$etable_r[$tbname][mid];
  455. $yhvar='bqpl';
  456. $yhid=$etable_r[$tbname][yhid];
  457. }
  458. elseif($enews==22)//各表头条信息
  459. {
  460. $query=' where firsttitle>0';
  461. $order="newstime";
  462. $tbname=$classid;
  463. $mid=$etable_r[$tbname][mid];
  464. $yhvar='bqfirst';
  465. $yhid=$etable_r[$tbname][yhid];
  466. }
  467. elseif($enews==23)//各表下载排行
  468. {
  469. $qand=' where ';
  470. $order='totaldown';
  471. $tbname=$classid;
  472. $mid=$etable_r[$tbname][mid];
  473. $yhvar='bqdown';
  474. $yhid=$etable_r[$tbname][yhid];
  475. }
  476. elseif($enews==25)//标题分类最新
  477. {
  478. $query=' where ('.$where.')';
  479. $order='newstime';
  480. $yhvar='bqnew';
  481. }
  482. elseif($enews==26)//标题分类点击排行
  483. {
  484. $query=' where ('.$where.')';
  485. $order='onclick';
  486. $yhvar='bqhot';
  487. }
  488. elseif($enews==27)//标题分类推荐
  489. {
  490. $query=' where ('.$where.') and isgood>0';
  491. $order='newstime';
  492. $yhvar='bqgood';
  493. }
  494. elseif($enews==28)//标题分类评论排行
  495. {
  496. $query=' where ('.$where.')';
  497. $order='plnum';
  498. $yhvar='bqpl';
  499. }
  500. elseif($enews==29)//标题分类头条
  501. {
  502. $query=' where ('.$where.') and firsttitle>0';
  503. $order='newstime';
  504. $yhvar='bqfirst';
  505. }
  506. elseif($enews==30)//标题分类下载排行
  507. {
  508. $query=' where ('.$where.')';
  509. $order='totaldown';
  510. $yhvar='bqdown';
  511. }
  512. //优化
  513. $yhadd='';
  514. if(!empty($eyh_r[$yhid]['dobq']))
  515. {
  516. $yhadd=ReturnYhSql($yhid,$yhvar);
  517. if(!empty($yhadd))
  518. {
  519. $query.=$qand.$yhadd;
  520. $qand=' and ';
  521. }
  522. }
  523. //不调用
  524. if(!strstr($public_r['nottobq'],','.$classid.','))
  525. {
  526. $notbqwhere=ReturnNottoBqWhere();
  527. if(!empty($notbqwhere))
  528. {
  529. $query.=$qand.$notbqwhere;
  530. $qand=' and ';
  531. }
  532. }
  533. //图片信息
  534. if(!empty($do))
  535. {
  536. $query.=$qand.'ispic=1';
  537. $qand=' and ';
  538. }
  539. //附加条件
  540. if(!empty($ewhere))
  541. {
  542. $query.=$qand.'('.$ewhere.')';
  543. $qand=' and ';
  544. }
  545. //中止
  546. if(empty($tbname))
  547. {
  548. echo $fun_r['BqErrorCid']."=<b>".$classid."</b>".$fun_r['BqErrorNtb']."(".$fun_r['BqErrorDo']."=".$enews.")";
  549. return false;
  550. }
  551. //排序
  552. $addorder=empty($eorder)?$order.' desc':$eorder;
  553. $query='select '.ReturnSqlListF($mid).' from '.$dbtbpre.'ecms_'.$tbname.$query.' order by '.ReturnSetTopSql('bq').$addorder.' limit '.$line;
  554. $sql=$empire->query1($query);
  555. if(!$sql)
  556. {
  557. echo"SQL Error: ".ReRepSqlTbpre($query);
  558. }
  559. return $sql;
  560. }
  561.  
  562. //返回标签模板
  563. function sys_ReturnBqTemp($tempid){
  564. global $empire,$dbtbpre,$fun_r;
  565. $r=$empire->fetch1("select tempid,modid,temptext,showdate,listvar,subnews,rownum,docode from ".GetTemptb("enewsbqtemp")." where tempid='$tempid'");
  566. if(empty($r[tempid]))
  567. {
  568. echo $fun_r['BqErrorNbqtemp']."(ID=".$tempid.")";
  569. }
  570. return $r;
  571. }
  572.  
  573. //替换栏目名
  574. function ReplaceEcmsinfoClassname($temp,$enews,$classid){
  575. global $class_r,$class_zr;
  576. if(strstr($classid,","))
  577. {
  578. return $temp;
  579. }
  580. $thecdo=',0,1,2,9,12,15,';
  581. $thezdo=',6,7,8,11,14,17,';
  582. //栏目
  583. if(strstr($thecdo,",".$enews.","))
  584. {
  585. $classname=$class_r[$classid][classname];
  586. $r[classid]=$classid;
  587. $classurl=sys_ReturnBqClassname($r,9);
  588. }
  589. //专题
  590. elseif(strstr($thezdo,",".$enews.","))
  591. {
  592. $r[ztid]=$classid;
  593. $classname=$class_zr[$classid][ztname];
  594. $classurl=sys_ReturnBqZtname($r);
  595. }
  596. else
  597. {}
  598. if($classname)
  599. {
  600. $temp=str_replace("[!--the.classname--]",$classname,$temp);
  601. $temp=str_replace("[!--the.classurl--]",$classurl,$temp);
  602. $temp=str_replace("[!--the.classid--]",$classid,$temp);
  603. }
  604. return $temp;
  605. }
  606.  
  607. //带模板的标签
  608. function sys_GetEcmsInfo($classid,$line,$strlen,$have_class=0,$enews=0,$tempid,$doing=0,$ewhere='',$eorder=''){
  609. global $empire,$public_r;
  610. $sql=sys_ReturnBqQuery($classid,$line,$enews,$doing,$ewhere,$eorder);
  611. if(!$sql)
  612. {return "";}
  613. //取得模板
  614. $tr=sys_ReturnBqTemp($tempid);
  615. if(empty($tr['tempid']))
  616. {return "";}
  617. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  618. $subnews=$tr[subnews];
  619. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  620. $rownum=$tr[rownum];
  621. $formatdate=$tr[showdate];
  622. $docode=$tr[docode];
  623. //替换变量
  624. $listtemp=ReplaceEcmsinfoClassname($listtemp,$enews,$classid);
  625. if(empty($rownum))
  626. {$rownum=1;}
  627. //字段
  628. $ret_r=ReturnReplaceListF($tr[modid]);
  629. //列表
  630. $list_exp="[!--empirenews.listtemp--]";
  631. $list_r=explode($list_exp,$listtemp);
  632. $listtext=$list_r[1];
  633. $no=1;
  634. $changerow=1;
  635. while($r=$empire->fetch($sql))
  636. {
  637. $r[oldtitle]=$r[title];
  638. //替换列表变量
  639. $repvar=ReplaceListVars($no,$listvar,$subnews,$strlen,$formatdate,$url,$have_class,$r,$ret_r,$docode);
  640. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  641. $changerow+=1;
  642. //超过行数
  643. if($changerow>$rownum)
  644. {
  645. $changerow=1;
  646. $string.=$listtext;
  647. $listtext=$list_r[1];
  648. }
  649. $no++;
  650. }
  651. //多余数据
  652. if($changerow<=$rownum&&$listtext<>$list_r[1])
  653. {
  654. $string.=$listtext;
  655. }
  656. $string=$list_r[0].$string.$list_r[2];
  657. echo $string;
  658. }
  659.  
  660. //灵动标签:返回SQL内容函数
  661. function sys_ReturnEcmsLoopBq($classid=0,$line=10,$enews=3,$doing=0,$ewhere='',$eorder=''){
  662. return sys_ReturnBqQuery($classid,$line,$enews,$doing,$ewhere,$eorder);
  663. }
  664.  
  665. //灵动标签:返回特殊内容函数
  666. function sys_ReturnEcmsLoopStext($r){
  667. global $class_r;
  668. $sr['titleurl']=sys_ReturnBqTitleLink($r);
  669. $sr['classname']=$class_r[$r[classid]][bname]?$class_r[$r[classid]][bname]:$class_r[$r[classid]][classname];
  670. $sr['classurl']=sys_ReturnBqClassname($r,9);
  671. return $sr;
  672. }
  673.  
  674. //返回相关链接操作类型
  675. function sys_OtherLinkQuery($classid,$line,$enews,$doing){
  676. global $empire,$public_r,$class_r,$class_zr,$navinfor,$dbtbpre,$eyh_r,$etable_r,$class_tr;
  677. if($enews==1)//按表
  678. {
  679. $tbname=$classid;
  680. }
  681. elseif($enews==2)//按栏目
  682. {
  683. if($classid=='selfinfo')//当前栏目
  684. {
  685. $classid=$navinfor['classid'];
  686. }
  687. $tbname=$class_r[$classid]['tbname'];
  688. if($class_r[$classid][islast])
  689. {
  690. $and="classid='$classid'";
  691. }
  692. else
  693. {
  694. $and=ReturnClass($class_r[$classid][sonclass]);
  695. }
  696. }
  697. elseif($enews==3)//按标题分类
  698. {
  699. $tbname=$class_tr[$classid]['tbname'];
  700. $and="ttid='$classid'";
  701. }
  702. else//默认
  703. {
  704. $tbname=$class_r[$navinfor[classid]]['tbname'];
  705. }
  706. //关键字
  707. $keys='';
  708. if(!empty($enews))
  709. {
  710. $repadd='';
  711. $keyr=explode(',',$navinfor['keyboard']);
  712. $count=count($keyr);
  713. for($i=0;$i<$count;$i++)
  714. {
  715. if($i==0)
  716. {
  717. $or='';
  718. }
  719. else
  720. {
  721. $or=' or ';
  722. }
  723. $repadd.=$or."[!--f--!] like '%".$keyr[$i]."%'";
  724. }
  725. //搜索范围
  726. if($public_r['newslink']==1)
  727. {
  728. $keys='('.str_replace('[!--f--!]','keyboard',$repadd).')';
  729. }
  730. elseif($public_r['newslink']==2)
  731. {
  732. $keys='('.str_replace('[!--f--!]','keyboard',$repadd).' or '.str_replace('[!--f--!]','title',$repadd).')';
  733. }
  734. else
  735. {
  736. $keys='('.str_replace('[!--f--!]','title',$repadd).')';
  737. }
  738. }
  739. else
  740. {
  741. $keys='id in ('.$navinfor['keyid'].')';
  742. }
  743. //当前信息
  744. if($tbname==$class_r[$navinfor[classid]][tbname])
  745. {
  746. $and.=empty($and)?"id<>'$navinfor[id]'":" and id<>'$navinfor[id]'";
  747. }
  748. //图片信息
  749. if($doing)
  750. {
  751. $and.=empty($and)?"ispic=1":" and ispic=1";
  752. }
  753. if($and)
  754. {
  755. $and.=' and ';
  756. }
  757. if(empty($line))
  758. {
  759. $line=$class_r[$navinfor[classid]]['link_num'];
  760. }
  761. //优化
  762. $yhvar='otherlink';
  763. $yhid=$etable_r[$tbname][yhid];
  764. $yhadd='';
  765. if($yhid)
  766. {
  767. $yhadd=ReturnYhSql($yhid,$yhvar,1);
  768. }
  769. $query="select * from {$dbtbpre}ecms_".$tbname." where ".$yhadd.$and.$keys." order by newstime desc limit $line";
  770. $sql=$empire->query1($query);
  771. if(!$sql)
  772. {
  773. echo"SQL Error: ".ReRepSqlTbpre($query);
  774. }
  775. return $sql;
  776. }
  777.  
  778. //相关链接标签
  779. function sys_GetOtherLinkInfo($tempid,$classid='',$line=0,$strlen=60,$have_class=0,$enews=0,$doing=0){
  780. global $empire,$navinfor,$public_r;
  781. if(empty($navinfor['keyboard'])||(empty($enews)&&!$navinfor['keyid']))
  782. {
  783. return '';
  784. }
  785. $sql=sys_OtherLinkQuery($classid,$line,$enews,$doing);
  786. if(!$sql)
  787. {return "";}
  788. //取得模板
  789. $tr=sys_ReturnBqTemp($tempid);
  790. if(empty($tr['tempid']))
  791. {return "";}
  792. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  793. $subnews=$tr[subnews];
  794. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  795. $rownum=$tr[rownum];
  796. $formatdate=$tr[showdate];
  797. $docode=$tr[docode];
  798. //替换变量
  799. $listtemp=ReplaceEcmsinfoClassname($listtemp,$enews,$classid);
  800. if(empty($rownum))
  801. {$rownum=1;}
  802. //字段
  803. $ret_r=ReturnReplaceListF($tr[modid]);
  804. //列表
  805. $list_exp="[!--empirenews.listtemp--]";
  806. $list_r=explode($list_exp,$listtemp);
  807. $listtext=$list_r[1];
  808. $no=1;
  809. $changerow=1;
  810. while($r=$empire->fetch($sql))
  811. {
  812. $r[oldtitle]=$r[title];
  813. //替换列表变量
  814. $repvar=ReplaceListVars($no,$listvar,$subnews,$strlen,$formatdate,$url,$have_class,$r,$ret_r,$docode);
  815. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  816. $changerow+=1;
  817. //超过行数
  818. if($changerow>$rownum)
  819. {
  820. $changerow=1;
  821. $string.=$listtext;
  822. $listtext=$list_r[1];
  823. }
  824. $no++;
  825. }
  826. //多余数据
  827. if($changerow<=$rownum&&$listtext<>$list_r[1])
  828. {
  829. $string.=$listtext;
  830. }
  831. $string=$list_r[0].$string.$list_r[2];
  832. echo $string;
  833. }
  834.  
  835. //文字标签函数
  836. function sys_GetClassNews($classid,$line,$strlen,$showdate=true,$enews=0,$have_class=0,$formatdate='(m-d)',$ewhere='',$eorder=''){
  837. global $empire;
  838. $sql=sys_ReturnBqQuery($classid,$line,$enews,0,$ewhere,$eorder);
  839. if(!$sql)
  840. {return "";}
  841. $record=0;
  842. while($r=$empire->fetch($sql))
  843. {
  844. $record=1;
  845. $oldtitle=$r[title];
  846. $title=sub($r[title],0,$strlen,false);
  847. //标题属性
  848. $title=DoTitleFont($r[titlefont],$title);
  849. //显示栏目
  850. $myadd=sys_ReturnBqClassname($r,$have_class);
  851. //显示时间
  852. if($showdate)
  853. {
  854. $newstime=date($formatdate,$r[newstime]);
  855. $newstime="&nbsp;".$newstime;
  856. }
  857. //标题链接
  858. $titleurl=sys_ReturnBqTitleLink($r);
  859. $title="·".$myadd."<a href='".$titleurl."' target=_blank title='".$oldtitle."'>".$title."</a>".$newstime;
  860. $allnews.="<tr><td height=20>".$title."</td></tr>";
  861. }
  862. if($record)
  863. {
  864. echo"<table border=0 cellpadding=0 cellspacing=0>$allnews</table>";
  865. }
  866. }
  867.  
  868. //图文信息调用
  869. function sys_GetClassNewsPic($classid,$line,$num,$width,$height,$showtitle=true,$strlen,$enews=0,$ewhere='',$eorder=''){
  870. global $empire;
  871. $sql=sys_ReturnBqQuery($classid,$num,$enews,1,$ewhere,$eorder);
  872. if(!$sql)
  873. {return "";}
  874. //输出
  875. $i=0;
  876. while($r=$empire->fetch($sql))
  877. {
  878. $i++;
  879. if(($i-1)%$line==0||$i==1)
  880. {$class_text.="<tr>";}
  881. //标题链接
  882. $titleurl=sys_ReturnBqTitleLink($r);
  883. //------是否显示标题
  884. if($showtitle)
  885. {
  886. $oldtitle=$r[title];
  887. $title=sub($r[title],0,$strlen,false);
  888. //标题属性
  889. $title=DoTitleFont($r[titlefont],$title);
  890. $title="<br><span style='line-height:15pt'>".$title."</span>";
  891. }
  892. $class_text.="<td align=center><a href='".$titleurl."' target=_blank><img src='".$r[titlepic]."' width='".$width."' height='".$height."' border=0 alt='".$oldtitle."'>".$title."</a></td>";
  893. //分割
  894. if($i%$line==0)
  895. {$class_text.="</tr>";}
  896. }
  897. if($i<>0)
  898. {
  899. $table="<table width=100% border=0 cellpadding=3 cellspacing=0>";$table1="</table>";
  900. $ys=$line-$i%$line;
  901. $p=0;
  902. for($j=0;$j<$ys&&$ys!=$line;$j++)
  903. {
  904. $p=1;
  905. $class_text.="<td></td>";
  906. }
  907. if($p==1)
  908. {
  909. $class_text.="</tr>";
  910. }
  911. }
  912. $text=$table.$class_text.$table1;
  913. echo"$text";
  914. }
  915.  
  916. //广告标签
  917. function sys_GetAd($adid){
  918. global $empire,$public_r,$dbtbpre;
  919. $r=$empire->fetch1("select * from {$dbtbpre}enewsad where adid='$adid'");
  920. //到期
  921. if($r['endtime']<>'0000-00-00'&&time()>to_time($r['endtime']))
  922. {
  923. echo addslashes($r[reptext]);
  924. return '';
  925. }
  926. if($r['ylink'])
  927. {
  928. $ad_url=$r['url'];
  929. }
  930. else
  931. {
  932. $ad_url=$public_r[newsurl]."e/public/ClickAd?adid=".$adid;//广告链接
  933. }
  934. //----------------------文字广告
  935. if($r[t]==1)
  936. {
  937. $r[titlefont]=$r[titlecolor].','.$r[titlefont];
  938. $picurl=DoTitleFont($r[titlefont],$r[picurl]);//文字属性
  939. $h="<a href='".$ad_url."' target=".$r[target]." title='".$r[alt]."'>".addslashes($picurl)."</a>";
  940. //普通显示
  941. if($r[adtype]==1)
  942. {
  943. $html=$h;
  944. }
  945. //可移动透明对话框
  946. else
  947. {
  948. $html="<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>
  949. <div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>";
  950. }
  951. }
  952. //------------------html广告
  953. elseif($r[t]==2)
  954. {
  955. $h=addslashes($r[htmlcode]);
  956. //普通显示
  957. if($r[adtype]==1)
  958. {
  959. $html=$h;
  960. }
  961. //可移动透明对话框
  962. else
  963. {
  964. $html="<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>
  965. <div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>";
  966. }
  967. }
  968. //------------------弹出广告
  969. elseif($r[t]==3)
  970. {
  971. //打开新窗口
  972. if($r[adtype]==8)
  973. {
  974. $html="<script>window.open('".$r[url]."');</script>";
  975. }
  976. //弹出窗口
  977. elseif($r[adtype]==9)
  978. {
  979. $html="<script>window.open('".$r[url]."','','width=".$r[pic_width].",height=".$r[pic_height].",scrollbars=yes');</script>";
  980. }
  981. //普能网页窗口
  982. else
  983. {
  984. $html="<script>window.showModalDialog('".$r[url]."','','dialogWidth:".$r[pic_width]."px;dialogHeight:".$r[pic_height]."px;scroll:no;status:no;help:no');</script>";
  985. }
  986. }
  987. //---------------------图片与flash广告
  988. else
  989. {
  990. $filetype=GetFiletype($r[picurl]);
  991. //flash
  992. if($filetype==".swf")
  993. {
  994. $h="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' name='movie' width='".$r[pic_width]."' height='".$r[pic_height]."' id='movie'><param name='movie' value='".$r[picurl]."'><param name='quality' value='high'><param name='menu' value='false'><embed src='".$r[picurl]."' width='".$r[pic_width]."' height='".$r[pic_height]."' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' id='movie' name='movie' menu='false'></embed><PARAM NAME='wmode' VALUE='Opaque'></object>";
  995. }
  996. else
  997. {
  998. $h="<a href='".$ad_url."' target=".$r[target]."><img src='".$r[picurl]."' border=0 width='".$r[pic_width]."' height='".$r[pic_height]."' alt='".$r[alt]."'></a>";
  999. }
  1000. //普通显示
  1001. if($r[adtype]==1)
  1002. {
  1003. $html=$h;
  1004. }
  1005. //满屏浮动显示
  1006. elseif($r[adtype]==4)
  1007. {
  1008. $html="<script>ns4=(document.layers)?true:false;
  1009. ie4=(document.all)?true:false;
  1010. if(ns4){document.write(\"<layer id=DGbanner2 width=".$r[pic_width]." height=".$r[pic_height]." onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>".$h."</layer>\");}
  1011. else{document.write(\"<div id=DGbanner2 style='position:absolute; width:".$r[pic_width]."px; height:".$r[pic_height]."px; z-index:9; filter: Alpha(Opacity=90)' onmouseover=stopme('DGbanner2') onmouseout=movechip('DGbanner2')>".$h."</div>\");}</script>
  1012. <script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_fullscreen.js></script>";
  1013. }
  1014. //上下浮动显示 - 右
  1015. elseif($r[adtype]==5)
  1016. {
  1017. $html="<script>if (navigator.appName == 'Netscape')
  1018. {document.write(\"<layer id=DGbanner3 top=150 width=".$r[pic_width]." height=".$r[pic_height].">".$h."</layer>\");}
  1019. else{document.write(\"<div id=DGbanner3 style='position: absolute;width:".$r[pic_height].";top:150;visibility: visible;z-index: 1'>".$h."</div>\");}</script>
  1020. <script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_upanddown.js></script>";
  1021. }
  1022. //上下浮动显示 - 左
  1023. elseif($r[adtype]==6)
  1024. {
  1025. $html="<script>if(navigator.appName == 'Netscape')
  1026. {document.write(\"<layer id=DGbanner10 top=150 width=".$r[pic_width]." height=".$r[pic_height].">".$h."</layer>\");}
  1027. else{document.write(\"<div id=DGbanner10 style='position: absolute;width:".$r[pic_width].";top:150;visibility: visible;z-index: 1'>".$h."</div>\");}</script>
  1028. <script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_float_upanddown_L.js></script>";
  1029. }
  1030. //全屏幕渐隐消失
  1031. elseif($r[adtype]==7)
  1032. {
  1033. $html="<script>ns4=(document.layers)?true:false;
  1034. if(ns4){document.write(\"<layer id=DGbanner4Cont onLoad='moveToAbsolute(layer1.pageX-160,layer1.pageY);clip.height=".$r[pic_height].";clip.width=".$r[pic_width]."; visibility=show;'><layer id=DGbanner4News position:absolute; top:0; left:0>".$h."</layer></layer>\");}
  1035. else{document.write(\"<div id=DGbanner4 style='position:absolute;top:0; left:0;'><div id=DGbanner4Cont style='position:absolute;width:".$r[pic_width].";height:".$r[pic_height].";clip:rect(0,".$r[pic_width].",".$r[pic_height].",0)'><div id=DGbanner4News style='position:absolute;top:0;left:0;right:820'>".$h."</div></div></div>\");}</script>
  1036. <script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_fullscreen.js></script>";
  1037. }
  1038. //可移动透明对话框
  1039. elseif($r[adtype]==3)
  1040. {
  1041. $html="<script language=javascript src=".$public_r[newsurl]."d/js/acmsd/ecms_dialog.js></script>
  1042. <div style='position:absolute;left:300px;top:150px;width:".$r[pic_width]."; height:".$r[pic_height].";z-index:1;solid;filter:alpha(opacity=90)' id=DGbanner5 onmousedown='down1(this)' onmousemove='move()' onmouseup='down=false'><table cellpadding=0 border=0 cellspacing=1 width=".$r[pic_width]." height=".$r[pic_height]." bgcolor=#000000><tr><td height=18 bgcolor=#5A8ACE align=right style='cursor:move;'><a href=# style='font-size: 9pt; color: #eeeeee; text-decoration: none' onClick=clase('DGbanner5') >关闭>>><img border='0' src='".$public_r[newsurl]."d/js/acmsd/close_o.gif'></a>&nbsp;</td></tr><tr><td bgcolor=f4f4f4 >&nbsp;".$h."</td></tr></table></div>";
  1043. }
  1044. else
  1045. {
  1046. $html="<script>function closeAd(){huashuolayer2.style.visibility='hidden';huashuolayer3.style.visibility='hidden';}function winload(){huashuolayer2.style.top=109;huashuolayer2.style.left=5;huashuolayer3.style.top=109;huashuolayer3.style.right=5;}//if(document.body.offsetWidth>800){
  1047. {document.write(\"<div id=huashuolayer2 style='position: absolute;visibility:visible;z-index:1'><table width=0 border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=".$public_r[newsurl]."d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>".$h."</td></tr></table></div>\"+\"<div id=huashuolayer3 style='position: absolute;visibility:visible;z-index:1'><table width=0 border=0 cellspacing=0 cellpadding=0><tr><td height=10 align=right bgcolor=666666><a href=javascript:closeAd()><img src=".$public_r[newsurl]."d/js/acmsd/close.gif width=12 height=10 border=0></a></td></tr><tr><td>".$h."</td></tr></table></div>\");}winload()//}</script>";
  1048. }
  1049. }
  1050. echo $html;
  1051. }
  1052.  
  1053. //投票标签
  1054. function sys_GetVote($voteid){
  1055. global $empire,$public_r,$dbtbpre;
  1056. $r=$empire->fetch1("select * from {$dbtbpre}enewsvote where voteid='$voteid'");
  1057. if(empty($r[votetext]))
  1058. {
  1059. return '';
  1060. }
  1061. //模板
  1062. $votetemp=ReturnVoteTemp($r[tempid],0);
  1063. $votetemp=RepVoteTempAllvar($votetemp,$r);
  1064. $listexp="[!--empirenews.listtemp--]";
  1065. $listtemp_r=explode($listexp,$votetemp);
  1066. $r_exp="\r\n";
  1067. $f_exp="::::::";
  1068. //项目数
  1069. $r_r=explode($r_exp,$r[votetext]);
  1070. $checked=0;
  1071. for($i=0;$i<count($r_r);$i++)
  1072. {
  1073. $checked++;
  1074. $f_r=explode($f_exp,$r_r[$i]);
  1075. //投票类型
  1076. if($r[voteclass])
  1077. {$vote="<input type=checkbox name=vote[] value=".$checked.">";}
  1078. else
  1079. {$vote="<input type=radio name=vote value=".$checked.">";}
  1080. $votetext.=RepVoteTempListvar($listtemp_r[1],$vote,$f_r[0]);
  1081. }
  1082. $votetext=$listtemp_r[0].$votetext.$listtemp_r[2];
  1083. echo"$votetext";
  1084. }
  1085.  
  1086. //信息投票标签
  1087. function sys_GetInfoVote($classid,$id){
  1088. global $empire,$public_r,$dbtbpre;
  1089. $r=$empire->fetch1("select * from {$dbtbpre}enewsinfovote where id='$id' and classid='$classid' limit 1");
  1090. if(empty($r[votetext]))
  1091. {
  1092. return '';
  1093. }
  1094. //模板
  1095. $votetemp=ReturnVoteTemp($r[tempid],0);
  1096. $votetemp=RepVoteTempAllvar($votetemp,$r);
  1097. $listexp="[!--empirenews.listtemp--]";
  1098. $listtemp_r=explode($listexp,$votetemp);
  1099. $r_exp="\r\n";
  1100. $f_exp="::::::";
  1101. //项目数
  1102. $r_r=explode($r_exp,$r[votetext]);
  1103. $checked=0;
  1104. for($i=0;$i<count($r_r);$i++)
  1105. {
  1106. $checked++;
  1107. $f_r=explode($f_exp,$r_r[$i]);
  1108. //投票类型
  1109. if($r[voteclass])
  1110. {$vote="<input type=checkbox name=vote[] value=".$checked.">";}
  1111. else
  1112. {$vote="<input type=radio name=vote value=".$checked.">";}
  1113. $votetext.=RepVoteTempListvar($listtemp_r[1],$vote,$f_r[0]);
  1114. }
  1115. $votetext=$listtemp_r[0].$votetext.$listtemp_r[2];
  1116. return $votetext;
  1117. }
  1118.  
  1119. //友情链接
  1120. function sys_GetSitelink($line,$num,$enews=0,$classid=0,$stats=0){
  1121. global $empire,$public_r,$dbtbpre;
  1122. //图片
  1123. if($enews==1)
  1124. {$a=" and lpic<>''";}
  1125. //文字
  1126. elseif($enews==2)
  1127. {$a=" and lpic=''";}
  1128. else
  1129. {$a="";}
  1130. //调用相应的栏目分类
  1131. if(!empty($classid))
  1132. {
  1133. $whereclass=" and classid='$classid'";
  1134. }
  1135. $sql=$empire->query("select * from {$dbtbpre}enewslink where checked=1".$a.$whereclass." order by myorder,lid limit ".$num);
  1136. //输出
  1137. $i=0;
  1138. while($r=$empire->fetch($sql))
  1139. {
  1140. //链接
  1141. if(empty($stats))
  1142. {
  1143. $linkurl=$public_r[newsurl]."e/public/GotoSite/?lid=".$r[lid]."&url=".urlencode($r[lurl]);
  1144. }
  1145. else
  1146. {
  1147. $linkurl=$r[lurl];
  1148. }
  1149. $i++;
  1150. if(($i-1)%$line==0||$i==1)
  1151. {$class_text.="<tr>";}
  1152. //文字
  1153. if(empty($r[lpic]))
  1154. {
  1155. $logo="<a href='".$linkurl."' title='".$r[lname]."' target=".$r[target].">".$r[lname]."</a>";
  1156. }
  1157. //图片
  1158. else
  1159. {
  1160. $logo="<a href='".$linkurl."' target=".$r[target]."><img src='".$r[lpic]."' alt='".$r[lname]."' border=0 width='".$r[width]."' height='".$r[height]."'></a>";
  1161. }
  1162. $class_text.="<td align=center>".$logo."</td>";
  1163. //分割
  1164. if($i%$line==0)
  1165. {$class_text.="</tr>";}
  1166. }
  1167. if($i<>0)
  1168. {
  1169. $table="<table width=100% border=0 cellpadding=3 cellspacing=0>";$table1="</table>";
  1170. $ys=$line-$i%$line;
  1171. $p=0;
  1172. for($j=0;$j<$ys&&$ys!=$line;$j++)
  1173. {
  1174. $p=1;
  1175. $class_text.="<td></td>";
  1176. }
  1177. if($p==1)
  1178. {
  1179. $class_text.="</tr>";
  1180. }
  1181. }
  1182. $text=$table.$class_text.$table1;
  1183. echo"$text";
  1184. }
  1185.  
  1186. //引用文件
  1187. function sys_IncludeFile($file){
  1188. @include($file);
  1189. }
  1190.  
  1191. //读取远程文件
  1192. function sys_ReadFile($http){
  1193. echo ReadFiletext($http);
  1194. }
  1195.  
  1196. //信息统计
  1197. function sys_TotalData($classid,$enews=0,$day=0,$totaltype=0){
  1198. global $empire,$class_r,$class_zr,$dbtbpre,$fun_r,$class_tr;
  1199. if(empty($classid))
  1200. {
  1201. return "";
  1202. }
  1203. //统计类型
  1204. if($totaltype==1)//评论数
  1205. {
  1206. $totalfield='sum(plnum) as total';
  1207. }
  1208. elseif($totaltype==2)//点击数
  1209. {
  1210. $totalfield='sum(onclick) as total';
  1211. }
  1212. elseif($totaltype==3)//下载数
  1213. {
  1214. $totalfield='sum(totaldown) as total';
  1215. }
  1216. else//信息数
  1217. {
  1218. $totalfield='count(*) as total';
  1219. }
  1220. if($day)
  1221. {
  1222. if($day==1)//今日信息
  1223. {
  1224. $date=date("Y-m-d");
  1225. $starttime=$date." 00:00:01";
  1226. $endtime=$date." 23:59:59";
  1227. }
  1228. elseif($day==2)//本月信息
  1229. {
  1230. $date=date("Y-m");
  1231. $starttime=$date."-01 00:00:01";
  1232. $endtime=$date."-".date("t")." 23:59:59";
  1233. }
  1234. elseif($day==3)//本年信息
  1235. {
  1236. $date=date("Y");
  1237. $starttime=$date."-01-01 00:00:01";
  1238. $endtime=($date+1)."-01-01 00:00:01";
  1239. }
  1240. $and=" and newstime>=".to_time($starttime)." and newstime<=".to_time($endtime);
  1241. }
  1242. if($enews==1)//统计标题分类
  1243. {
  1244. if(empty($class_tr[$classid][tbname]))
  1245. {
  1246. echo $fun_r['BqErrorTtid']."=<b>".$classid."</b>".$fun_r['BqErrorNtb'];
  1247. return "";
  1248. }
  1249. $query="select ".$totalfield." from {$dbtbpre}ecms_".$class_tr[$classid][tbname]." where ttid='$classid'".$and;
  1250. }
  1251. elseif($enews==2)//统计数据表
  1252. {
  1253. $query="select ".$totalfield." from {$dbtbpre}ecms_".$classid.(empty($and)?'':' where '.substr($and,5));
  1254. }
  1255. else//统计栏目数据
  1256. {
  1257. if(empty($class_r[$classid][tbname]))
  1258. {
  1259. echo $fun_r['BqErrorCid']."=<b>".$classid."</b>".$fun_r['BqErrorNtb'];
  1260. return "";
  1261. }
  1262. if($class_r[$classid][islast])//终极栏目
  1263. {
  1264. $where="classid='$classid'";
  1265. }
  1266. else//大栏目
  1267. {
  1268. $where=ReturnClass($class_r[$classid][sonclass]);
  1269. }
  1270. $query="select ".$totalfield." from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$where.$and;
  1271. }
  1272. $num=$empire->gettotal($query);
  1273. echo $num;
  1274. }
  1275.  
  1276. //flash幻灯图片信息调用
  1277. function sys_FlashPixpic($classid,$line,$width,$height,$showtitle=true,$strlen,$enews=0,$sec=5,$ewhere='',$eorder=''){
  1278. global $empire,$public_r,$class_r,$class_zr;
  1279. $sql=sys_ReturnBqQuery($classid,$line,$enews,1,$ewhere,$eorder);
  1280. if(!$sql)
  1281. {return "";}
  1282. $i=0;
  1283. while($r=$empire->fetch($sql))
  1284. {
  1285. //标题链接
  1286. $titleurl=sys_ReturnBqTitleLink($r);
  1287. //------是否显示标题
  1288. if($showtitle)
  1289. {
  1290. $title=sub($r[title],0,$strlen,false);
  1291. //标题属性
  1292. $title=addslashes(DoTitleFont($r[titlefont],ehtmlspecialchars($title)));
  1293. }
  1294. $fh="|";
  1295. if($i==0)
  1296. {
  1297. $fh="";
  1298. }
  1299. $url.=$fh.$titleurl;
  1300. $pic.=$fh.$r[titlepic];
  1301. $subject.=$fh.$title;
  1302. $i=1;
  1303. }
  1304. //显示标题
  1305. if($showtitle)
  1306. {
  1307. $text_height=22;
  1308. }
  1309. else
  1310. {
  1311. $text_height=0;
  1312. }
  1313. ?>
  1314. <script type="text/javascript">
  1315. <!--
  1316. var interval_time=<?=$sec?>;
  1317. var focus_width=<?=$width?>;
  1318. var focus_height=<?=$height?>;
  1319. var text_height=<?=$text_height?>;
  1320. var text_align="center";
  1321. var swf_height = focus_height+text_height;
  1322. var swfpath="<?=$public_r[newsurl]?>e/data/images/pixviewer.swf";
  1323. var swfpatha="<?=$public_r[newsurl]?>e/data/images/pixviewer.swf";
  1324.  
  1325. var pics="<?=urlencode($pic)?>";
  1326. var links="<?=urlencode($url)?>";
  1327. var texts="<?=ehtmlspecialchars($subject)?>";
  1328.  
  1329. document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
  1330. document.write('<param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
  1331. document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
  1332. document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'">');
  1333. document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  1334. document.write('</object>');
  1335. //-->
  1336. </script>
  1337. <?
  1338. }
  1339.  
  1340. //搜索关键字
  1341. function sys_ShowSearchKey($line,$num,$classid=0,$enews=0){
  1342. global $empire,$public_r,$dbtbpre;
  1343. if($enews)
  1344. {
  1345. $order="searchid";
  1346. }
  1347. else
  1348. {
  1349. $order="onclick";
  1350. }
  1351. if($classid)
  1352. {
  1353. $add=" and classid='$classid'";
  1354. }
  1355. $sql=$empire->query("select searchid,keyboard from {$dbtbpre}enewssearch where iskey=0".$add." order by ".$order." desc limit ".$num);
  1356. $i=0;
  1357. $returnkey="";
  1358. while($r=$empire->fetch($sql))
  1359. {
  1360. $i++;
  1361. $keyurl=$public_r[newsurl]."e/search/result/?searchid=$r[searchid]";
  1362. $br="";
  1363. if($i%$line==0)
  1364. {
  1365. $br="<br>";
  1366. }
  1367. $jg="&nbsp;";
  1368. if($br)
  1369. {
  1370. $jg="";
  1371. }
  1372. $returnkey.="<a href='".$keyurl."' target=_blank>".$r[keyboard]."</a>".$jg.$br;
  1373. }
  1374. echo $returnkey;
  1375. }
  1376.  
  1377. //带模板的标签显示-循环
  1378. function sys_GetEcmsInfoMore($classid,$line,$strlen,$have_class=0,$ecms=0,$tr,$doing=0,$field,$cr,$dofirstinfo=0,$fsubtitle=0,$fsubnews=0,$fdoing=0,$ewhere='',$eorder=''){
  1379. global $empire,$public_r;
  1380. //操作类型
  1381. if($ecms==0)//栏目最新
  1382. {
  1383. $enews=0;
  1384. }
  1385. elseif($ecms==1)//栏目热门
  1386. {
  1387. $enews=1;
  1388. }
  1389. elseif($ecms==2)//栏目推荐
  1390. {
  1391. $enews=2;
  1392. }
  1393. elseif($ecms==3)//栏目评论排行
  1394. {
  1395. $enews=9;
  1396. }
  1397. elseif($ecms==4)//栏目头条
  1398. {
  1399. $enews=12;
  1400. }
  1401. elseif($ecms==5)//栏目下载排行
  1402. {
  1403. $enews=15;
  1404. }
  1405. elseif($ecms==6)//栏目评分
  1406. {
  1407. $enews=25;
  1408. }
  1409. elseif($ecms==7)//栏目投票
  1410. {
  1411. $enews=26;
  1412. }
  1413. else
  1414. {
  1415. $enews=0;
  1416. }
  1417. $sql=sys_ReturnBqQuery($classid,$line,$enews,$doing,$ewhere,$eorder);
  1418. if(!$sql)
  1419. {return "";}
  1420. //取得模板
  1421. $listtemp=$tr[temptext];
  1422. $subnews=$tr[subnews];
  1423. $listvar=$tr[listvar];
  1424. $rownum=$tr[rownum];
  1425. $formatdate=$tr[showdate];
  1426. $docode=$tr[docode];
  1427. //替换变量
  1428. $listtemp=ReplaceEcmsinfoClassname($listtemp,$enews,$classid);
  1429. $listtemp=sys_ForSonclassDataFirstInfo($listtemp,$cr,$dofirstinfo,$fsubtitle,$fsubnews,$fdoing);
  1430. if(empty($rownum))
  1431. {$rownum=1;}
  1432. //列表
  1433. $list_exp="[!--empirenews.listtemp--]";
  1434. $list_r=explode($list_exp,$listtemp);
  1435. $listtext=$list_r[1];
  1436. $no=1;
  1437. $changerow=1;
  1438. while($r=$empire->fetch($sql))
  1439. {
  1440. $r[oldtitle]=$r[title];
  1441. //替换列表变量
  1442. $repvar=ReplaceListVars($no,$listvar,$subnews,$strlen,$formatdate,$url,$have_class,$r,$field,$docode);
  1443. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  1444. $changerow+=1;
  1445. //超过行数
  1446. if($changerow>$rownum)
  1447. {
  1448. $changerow=1;
  1449. $string.=$listtext;
  1450. $listtext=$list_r[1];
  1451. }
  1452. $no++;
  1453. }
  1454. //多余数据
  1455. if($changerow<=$rownum&&$listtext<>$list_r[1])
  1456. {
  1457. $string.=$listtext;
  1458. }
  1459. $string=$list_r[0].$string.$list_r[2];
  1460. echo $string;
  1461. }
  1462.  
  1463. //循环子栏目显示头条信息
  1464. function sys_ForSonclassDataFirstInfo($temptext,$cr,$ecms=0,$subtitle=0,$subnews=0,$fdoing=0){
  1465. global $empire,$class_r,$public_r,$dbtbpre;
  1466. if($ecms==2||$ecms==3||$ecms==4)
  1467. {
  1468. $where=$class_r[$cr[classid]][islast]?"classid='$cr[classid]'":ReturnClass($class_r[$cr[classid]][sonclass]);
  1469. }
  1470. if($fdoing)
  1471. {
  1472. $add=" and ispic=1";
  1473. }
  1474. if($ecms==1)//栏目缩图
  1475. {
  1476. $id=$cr['classid'];
  1477. $title=$cr['classname'];
  1478. $titleurl=sys_ReturnBqClassname($cr,9);
  1479. $titlepic=$cr['classimg'];
  1480. $smalltext=$cr['intro'];
  1481. }
  1482. elseif($ecms==2)//推荐信息
  1483. {
  1484. $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where isgood>0 and (".$where.")".$add." order by newstime desc limit 1");
  1485. }
  1486. elseif($ecms==3)//头条信息
  1487. {
  1488. $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where firsttitle>0 and (".$where.")".$add." order by newstime desc limit 1");
  1489. }
  1490. elseif($ecms==4)//最新信息
  1491. {
  1492. $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$cr[classid]][tbname]." where (".$where.")".$add." order by newstime desc limit 1");
  1493. }
  1494. else
  1495. {
  1496. return $temptext;
  1497. }
  1498. if($ecms!=1)
  1499. {
  1500. $id=$r['id'];
  1501. $title=$r['title'];
  1502. $titleurl=sys_ReturnBqTitleLink($r);
  1503. $titlepic=$r['titlepic'];
  1504. //简介
  1505. if($r['smalltext'])
  1506. {$smalltext=$r['smalltext'];}
  1507. elseif($r['flashsay'])
  1508. {$smalltext=$r['flashsay'];}
  1509. elseif($r['softsay'])
  1510. {$smalltext=$r['softsay'];}
  1511. elseif($r['moviesay'])
  1512. {$smalltext=$r['moviesay'];}
  1513. elseif($r['picsay'])
  1514. {$smalltext=$r['picsay'];}
  1515. }
  1516. $oldtitle=$title;
  1517. if($subtitle)
  1518. {$title=sub($title,0,$subtitle,false);}
  1519. if(empty($titlepic))
  1520. {$titlepic=$public_r[newsurl]."e/data/images/notimg.gif";}
  1521. if(!empty($subnews))
  1522. {$smalltext=sub($smalltext,0,$subnews,false);}
  1523. $temptext=str_replace('[!--sonclass.id--]',$id,$temptext);
  1524. $temptext=str_replace('[!--sonclass.title--]',$title,$temptext);
  1525. $temptext=str_replace('[!--sonclass.oldtitle--]',$oldtitle,$temptext);
  1526. $temptext=str_replace('[!--sonclass.titlepic--]',$titlepic,$temptext);
  1527. $temptext=str_replace('[!--sonclass.titleurl--]',$titleurl,$temptext);
  1528. $temptext=str_replace('[!--sonclass.text--]',$smalltext,$temptext);
  1529. return $temptext;
  1530. }
  1531.  
  1532. //循环子栏目数据
  1533. function sys_ForSonclassData($classid,$line,$strlen,$have_class=0,$enews=0,$tempid,$doing=0,$cline=0,$dofirstinfo=0,$fsubtitle=0,$fsubnews=0,$fdoing=0,$ewhere='',$eorder=''){
  1534. global $empire,$public_r,$class_r,$class_zr,$navclassid,$dbtbpre;
  1535. //多栏目
  1536. if(strstr($classid,","))
  1537. {
  1538. $son_r=sys_ReturnMoreClass($classid);
  1539. $classid=$son_r[0];
  1540. $where=$son_r[1];
  1541. }
  1542. else
  1543. {
  1544. //当前栏目
  1545. if($classid=="selfinfo")
  1546. {
  1547. $classid=$navclassid;
  1548. }
  1549. $where="bclassid='$classid'";
  1550. }
  1551. //取得模板
  1552. $tr=sys_ReturnBqTemp($tempid);
  1553. if(empty($tr['tempid']))
  1554. {return "";}
  1555. $tr[temptext]=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  1556. $tr[listvar]=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  1557. //限制条数
  1558. if($cline)
  1559. {
  1560. $limit=" limit ".$cline;
  1561. }
  1562. //字段
  1563. $ret_r=ReturnReplaceListF($tr[modid]);
  1564. //栏目字段
  1565. if($dofirstinfo==1)
  1566. {
  1567. $addclassfield=',classname,classimg,intro';
  1568. }
  1569. $csql=$empire->query("select classid".$addclassfield." from {$dbtbpre}enewsclass where ".$where." and wburl='' order by myorder,classid".$limit);
  1570. while($cr=$empire->fetch($csql))
  1571. {
  1572. sys_GetEcmsInfoMore($cr[classid],$line,$strlen,$have_class,$enews,$tr,$doing,$ret_r,$cr,$dofirstinfo,$fsubtitle,$fsubnews,$fdoing,$ewhere,$eorder);
  1573. }
  1574. }
  1575.  
  1576. //带模板的栏目导航标签
  1577. function sys_ShowClassByTemp($classid,$tempid,$show=0,$cline=0){
  1578. global $navclassid,$empire,$class_r,$public_r,$dbtbpre;
  1579. //当前栏目
  1580. if($classid=="selfinfo")
  1581. {
  1582. if(empty($navclassid))
  1583. {$classid=0;}
  1584. else
  1585. {
  1586. $classid=$navclassid;
  1587. //终极类别则显示同级类别
  1588. if($class_r[$classid][islast]&&$class_r[$classid][bclassid])
  1589. {
  1590. $classid=$class_r[$classid][bclassid];
  1591. }
  1592. if($class_r[$classid][islast]&&empty($class_r[$classid][bclassid]))
  1593. {$classid=0;}
  1594. }
  1595. }
  1596. //取得模板
  1597. $tr=sys_ReturnBqTemp($tempid);
  1598. if(empty($tr['tempid']))
  1599. {return "";}
  1600. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  1601. $subnews=$tr[subnews];
  1602. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  1603. $rownum=$tr[rownum];
  1604. $formatdate=$tr[showdate];
  1605. if(empty($rownum))
  1606. {$rownum=1;}
  1607. //限制条数
  1608. if($cline)
  1609. {
  1610. $limit=" limit ".$cline;
  1611. }
  1612. //替换变量
  1613. $bclassname=$class_r[$classid][classname];
  1614. $br[classid]=$classid;
  1615. $bclassurl=sys_ReturnBqClassname($br,9);
  1616. $listtemp=str_replace("[!--bclassname--]",$bclassname,$listtemp);
  1617. $listtemp=str_replace("[!--bclassurl--]",$bclassurl,$listtemp);
  1618. $listtemp=str_replace("[!--bclassid--]",$classid,$listtemp);
  1619. //列表
  1620. $list_exp="[!--empirenews.listtemp--]";
  1621. $list_r=explode($list_exp,$listtemp);
  1622. $listtext=$list_r[1];
  1623. $no=1;
  1624. $changerow=1;
  1625. $sql=$empire->query("select classid,classname,islast,sonclass,tbname,intro,classimg,infos from {$dbtbpre}enewsclass where bclassid='$classid' and showclass=0 order by myorder,classid".$limit);
  1626. while($r=$empire->fetch($sql))
  1627. {
  1628. //显示类别数据数
  1629. if($show)
  1630. {
  1631. $num=ReturnClassInfoNum($r);
  1632. }
  1633. //替换列表变量
  1634. $repvar=ReplaceShowClassVars($no,$listvar,$r,$num,0,$subnews);
  1635. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  1636. $changerow+=1;
  1637. //超过行数
  1638. if($changerow>$rownum)
  1639. {
  1640. $changerow=1;
  1641. $string.=$listtext;
  1642. $listtext=$list_r[1];
  1643. }
  1644. $no++;
  1645. }
  1646. //多余数据
  1647. if($changerow<=$rownum&&$listtext<>$list_r[1])
  1648. {
  1649. $string.=$listtext;
  1650. }
  1651. $string=$list_r[0].$string.$list_r[2];
  1652. echo $string;
  1653. }
  1654.  
  1655. //循环子栏目导航标签
  1656. function sys_ForShowSonClass($classid,$tempid,$show=0,$cline=0){
  1657. global $navclassid,$empire,$class_r,$public_r,$dbtbpre;
  1658. //多栏目
  1659. if(strstr($classid,","))
  1660. {
  1661. $where='classid in ('.$classid.')';
  1662. }
  1663. else
  1664. {
  1665. if($classid=="selfinfo")//当前栏目
  1666. {
  1667. $classid=intval($navclassid);
  1668. }
  1669. $where="bclassid='$classid'";
  1670. }
  1671. //取得模板
  1672. $tr=sys_ReturnBqTemp($tempid);
  1673. if(empty($tr['tempid']))
  1674. {return "";}
  1675. $tr[temptext]=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  1676. $tr[listvar]=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  1677. //限制条数
  1678. if($cline)
  1679. {
  1680. $limit=" limit ".$cline;
  1681. }
  1682. $no=1;
  1683. $sql=$empire->query("select classid,classname,islast,sonclass,tbname,intro,classimg,infos from {$dbtbpre}enewsclass where ".$where." and showclass=0 order by myorder,classid".$limit);
  1684. while($r=$empire->fetch($sql))
  1685. {
  1686. //显示栏目数据数
  1687. if($show)
  1688. {
  1689. $num=ReturnClassInfoNum($r);
  1690. }
  1691. sys_GetShowClassMore($r[classid],$r,$tr,$no,$num,$show);
  1692. $no++;
  1693. }
  1694. }
  1695.  
  1696. //栏目导航标签-循环
  1697. function sys_GetShowClassMore($bclassid,$bcr,$tr,$bno,$bnum,$show=0){
  1698. global $empire,$class_r,$public_r,$dbtbpre;
  1699. //取得模板
  1700. $listtemp=$tr[temptext];
  1701. $subnews=$tr[subnews];
  1702. $listvar=$tr[listvar];
  1703. $rownum=$tr[rownum];
  1704. $formatdate=$tr[showdate];
  1705. if(empty($rownum))
  1706. {$rownum=1;}
  1707. //替换变量
  1708. $listtemp=str_replace("[!--bclassname--]",$bcr[classname],$listtemp);
  1709. $bclassurl=sys_ReturnBqClassname($bcr,9);//栏目链接
  1710. $listtemp=str_replace("[!--bclassurl--]",$bclassurl,$listtemp);
  1711. $listtemp=str_replace("[!--bclassid--]",$bclassid,$listtemp);
  1712. $bclassimg=$bcr[classimg]?$bcr[classimg]:$public_r[newsurl]."e/data/images/notimg.gif";//栏目图片
  1713. $listtemp=str_replace("[!--bclassimg--]",$bclassimg,$listtemp);
  1714. $listtemp=str_replace("[!--bintro--]",nl2br($bcr[intro]),$listtemp);//栏目简介
  1715. $listtemp=str_replace("[!--bno--]",$bno,$listtemp);
  1716. $listtemp=str_replace("[!--bnum--]",$bnum,$listtemp);
  1717. //列表
  1718. $list_exp="[!--empirenews.listtemp--]";
  1719. $list_r=explode($list_exp,$listtemp);
  1720. $listtext=$list_r[1];
  1721. $no=1;
  1722. $changerow=1;
  1723. $sql=$empire->query("select classid,classname,islast,sonclass,tbname,intro,classimg,infos from {$dbtbpre}enewsclass where bclassid='$bclassid' and showclass=0 order by myorder,classid");
  1724. while($r=$empire->fetch($sql))
  1725. {
  1726. //显示栏目数据数
  1727. if($show)
  1728. {
  1729. $num=ReturnClassInfoNum($r);
  1730. }
  1731. //替换列表变量
  1732. $repvar=ReplaceShowClassVars($no,$listvar,$r,$num,0,$subnews);
  1733. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  1734. $changerow+=1;
  1735. //超过行数
  1736. if($changerow>$rownum)
  1737. {
  1738. $changerow=1;
  1739. $string.=$listtext;
  1740. $listtext=$list_r[1];
  1741. }
  1742. $no++;
  1743. }
  1744. //多余数据
  1745. if($changerow<=$rownum&&$listtext<>$list_r[1])
  1746. {
  1747. $string.=$listtext;
  1748. }
  1749. $string=$list_r[0].$string.$list_r[2];
  1750. echo $string;
  1751. }
  1752.  
  1753. //替换栏目导航标签
  1754. function ReplaceShowClassVars($no,$listtemp,$r,$num,$ecms=0,$subnews=0){
  1755. global $public_r,$class_r;
  1756. //栏目链接
  1757. if($ecms==1)
  1758. {
  1759. $classurl=sys_ReturnBqZtname($r);
  1760. $r['classname']=$r['ztname'];
  1761. $r['classid']=$r['ztid'];
  1762. $r['classimg']=$r['ztimg'];
  1763. }
  1764. else
  1765. {
  1766. $classurl=sys_ReturnBqClassname($r,9);
  1767. }
  1768. if($subnews)
  1769. {
  1770. $r[intro]=sub($r[intro],0,$subnews,false);
  1771. }
  1772. $listtemp=str_replace("[!--classurl--]",$classurl,$listtemp);
  1773. //栏目名称
  1774. $listtemp=str_replace("[!--classname--]",$r[classname],$listtemp);
  1775. //栏目id
  1776. $listtemp=str_replace("[!--classid--]",$r[classid],$listtemp);
  1777. //栏目图片
  1778. if(empty($r[classimg]))
  1779. {
  1780. $r[classimg]=$public_r[newsurl]."e/data/images/notimg.gif";
  1781. }
  1782. $listtemp=str_replace("[!--classimg--]",$r[classimg],$listtemp);
  1783. //栏目简介
  1784. $listtemp=str_replace("[!--intro--]",nl2br($r[intro]),$listtemp);
  1785. //记录数
  1786. $listtemp=str_replace("[!--num--]",$num,$listtemp);
  1787. //序号
  1788. $listtemp=str_replace("[!--no--]",$no,$listtemp);
  1789. return $listtemp;
  1790. }
  1791.  
  1792. //留言调用
  1793. function sys_ShowLyInfo($line,$tempid,$bid=0){
  1794. global $empire,$dbtbpre,$public_r;
  1795. $a="";
  1796. if($bid)
  1797. {
  1798. $a=" and bid='$bid'";
  1799. }
  1800. //取得模板
  1801. $tr=sys_ReturnBqTemp($tempid);
  1802. if(empty($tr['tempid']))
  1803. {return "";}
  1804. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  1805. $subnews=$tr[subnews];
  1806. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  1807. $rownum=$tr[rownum];
  1808. $formatdate=$tr[showdate];
  1809. if(empty($rownum))
  1810. {$rownum=1;}
  1811. //列表
  1812. $list_exp="[!--empirenews.listtemp--]";
  1813. $list_r=explode($list_exp,$listtemp);
  1814. $listtext=$list_r[1];
  1815. $no=1;
  1816. $changerow=1;
  1817. $sql=$empire->query("select lyid,name,email,lytime,lytext,retext from {$dbtbpre}enewsgbook where checked=0".$a." order by lyid desc limit ".$line);
  1818. while($r=$empire->fetch($sql))
  1819. {
  1820. //替换列表变量
  1821. $repvar=ReplaceShowLyVars($no,$listvar,$r,$formatdate,$subnews);
  1822. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  1823. $changerow+=1;
  1824. //超过行数
  1825. if($changerow>$rownum)
  1826. {
  1827. $changerow=1;
  1828. $string.=$listtext;
  1829. $listtext=$list_r[1];
  1830. }
  1831. $no++;
  1832. }
  1833. //多余数据
  1834. if($changerow<=$rownum&&$listtext<>$list_r[1])
  1835. {
  1836. $string.=$listtext;
  1837. }
  1838. $string=$list_r[0].$string.$list_r[2];
  1839. echo $string;
  1840. }
  1841.  
  1842. //替换留言标签
  1843. function ReplaceShowLyVars($no,$listtemp,$r,$formatdate,$subnews=0){
  1844. global $public_r;
  1845. if($subnews)
  1846. {
  1847. $r['lytext']=sub($r['lytext'],0,$subnews,false);
  1848. }
  1849. $listtemp=str_replace("[!--lyid--]",$r['lyid'],$listtemp);//id
  1850. $listtemp=str_replace("[!--lytext--]",nl2br($r['lytext']),$listtemp);//留言内容
  1851. $listtemp=str_replace("[!--retext--]",nl2br($r['retext']),$listtemp);//回复
  1852. $listtemp=str_replace("[!--lytime--]",format_datetime($r['lytime'],$formatdate),$listtemp);
  1853. $listtemp=str_replace("[!--name--]",$r['name'],$listtemp);
  1854. $listtemp=str_replace("[!--email--]",$r['email'],$listtemp);
  1855. //序号
  1856. $listtemp=str_replace("[!--no--]",$no,$listtemp);
  1857. return $listtemp;
  1858. }
  1859.  
  1860. //专题调用
  1861. function sys_ShowZtData($tempid,$zcid=0,$cline=0,$classid=0){
  1862. global $empire,$dbtbpre,$public_r;
  1863. $a='';
  1864. if($zcid)
  1865. {
  1866. $a.=' and zcid in ('.$zcid.')';
  1867. }
  1868. if($classid)
  1869. {
  1870. $a.=' and classid in ('.$classid.')';
  1871. }
  1872. //取得模板
  1873. $tr=sys_ReturnBqTemp($tempid);
  1874. if(empty($tr['tempid']))
  1875. {return "";}
  1876. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  1877. $subnews=$tr[subnews];
  1878. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  1879. $rownum=$tr[rownum];
  1880. $formatdate=$tr[showdate];
  1881. if(empty($rownum))
  1882. {$rownum=1;}
  1883. //限制条数
  1884. if($cline)
  1885. {
  1886. $limit=" limit ".$cline;
  1887. }
  1888. //列表
  1889. $list_exp="[!--empirenews.listtemp--]";
  1890. $list_r=explode($list_exp,$listtemp);
  1891. $listtext=$list_r[1];
  1892. $no=1;
  1893. $changerow=1;
  1894. $sql=$empire->query("select ztid,ztname,intro,ztimg from {$dbtbpre}enewszt where showzt=0".$a." order by myorder,ztid desc".$limit);
  1895. while($r=$empire->fetch($sql))
  1896. {
  1897. //替换列表变量
  1898. $repvar=ReplaceShowClassVars($no,$listvar,$r,$num,1,$subnews);
  1899. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  1900. $changerow+=1;
  1901. //超过行数
  1902. if($changerow>$rownum)
  1903. {
  1904. $changerow=1;
  1905. $string.=$listtext;
  1906. $listtext=$list_r[1];
  1907. }
  1908. $no++;
  1909. }
  1910. //多余数据
  1911. if($changerow<=$rownum&&$listtext<>$list_r[1])
  1912. {
  1913. $string.=$listtext;
  1914. }
  1915. $string=$list_r[0].$string.$list_r[2];
  1916. echo $string;
  1917. }
  1918.  
  1919. //图库模型分页标签
  1920. function sys_PhotoMorepage($tempid,$spicwidth=0,$spicheight=0){
  1921. global $navinfor;
  1922. $morepic=$navinfor['morepic'];
  1923. if(empty($morepic))
  1924. {
  1925. return "";
  1926. }
  1927. //取得标签
  1928. $tempr=sys_ReturnBqTemp($tempid);
  1929. if(empty($tempr['tempid']))
  1930. {return "";}
  1931. $rexp="\r\n";
  1932. $fexp="::::::";
  1933. $gs="";
  1934. if($spicwidth)
  1935. {$gs=" width='".$spicwidth."'";}
  1936. if($spicheight)
  1937. {$gs.=" height='".$spicheight."'";}
  1938. $rstr="";
  1939. $sdh="";
  1940. $firstpic="";
  1941. $optionstr="";
  1942. $titleoption="";
  1943. $listpage="";
  1944. $nbsp="";
  1945. $rr=explode($rexp,$morepic);
  1946. $count=count($rr);
  1947. for($i=0;$i<$count;$i++)
  1948. {
  1949. $j=$i+1;
  1950. $fr=explode($fexp,$rr[$i]);
  1951. $smallpic=$fr[0]; //小图
  1952. $bigpic=$fr[1]; //大图
  1953. if(empty($bigpic))
  1954. {
  1955. $bigpic=$smallpic;
  1956. }
  1957. $picname=ehtmlspecialchars($fr[2]); //名称
  1958. $showpic=ReplaceMorePagelistvar($tempr['listvar'],$picname,$bigpic);
  1959. $sdh.=$nbsp."<a href='#ecms' onclick='GotoPhPage(".$j.");' title='".$picname."'><img src='".$smallpic."' alt='".$picname."' border=0".$gs."></a>";
  1960. if($i==0)
  1961. {
  1962. $firstpic=$showpic;
  1963. }
  1964. $rstr.="photosr[".$j."]=\"".addslashes($showpic)."\";
  1965. ";
  1966. $optionstr.="<option value=".$j.">第 ".$j." 页</option>";
  1967. $titleoption.="<option value=".$j.">".$j."、".$picname."</option>";
  1968. $listpage.=$nbsp."<a href='#ecms' onclick='GotoPhPage(".$j.");' title='".$picname."'>".$j."</a>";
  1969. $nbsp="&nbsp;";
  1970. }
  1971. echo ReplaceMorePagetemp($tempr['temptext'],$rstr,$sdh,$optionstr,$titleoption,$firstpic,$listpage);
  1972. }
  1973.  
  1974. //替换图片集分页模板
  1975. function ReplaceMorePagetemp($temp,$rstr,$sdh,$select,$titleselect,$showpic,$listpage){
  1976. $temp=str_replace("[!--photor--]",$rstr,$temp);
  1977. $temp=str_replace("[!--smalldh--]",$sdh,$temp);
  1978. $temp=str_replace("[!--select--]",$select,$temp);
  1979. $temp=str_replace("[!--titleselect--]",$titleselect,$temp);
  1980. $temp=str_replace("[!--listpage--]",$listpage,$temp);
  1981. $temp=str_replace("<!--list.var1-->",$showpic,$temp);
  1982. return $temp;
  1983. }
  1984.  
  1985. //替换图片集listvar模板
  1986. function ReplaceMorePagelistvar($temp,$picname,$picurl){
  1987. $temp=str_replace("[!--picname--]",$picname,$temp);
  1988. $temp=str_replace("[!--picurl--]",$picurl,$temp);
  1989. return $temp;
  1990. }
  1991.  
  1992. //输出复选框字段内容
  1993. function sys_EchoCheckboxFValue($f,$exp='<br>'){
  1994. global $navinfor;
  1995. $r=explode('|',$navinfor[$f]);
  1996. $count=count($r);
  1997. for($i=1;$i<$count-1;$i++)
  1998. {
  1999. if($i==1)
  2000. {
  2001. $str.=$r[$i];
  2002. }
  2003. else
  2004. {
  2005. $str.=$exp.$r[$i];
  2006. }
  2007. }
  2008. echo $str;
  2009. }
  2010.  
  2011. //评论调用
  2012. function sys_ShowPlInfo($line,$tempid,$classid=0,$id=0,$isgood=0,$enews=0){
  2013. global $empire,$dbtbpre,$class_r,$public_r;
  2014. $a="";
  2015. if($isgood)
  2016. {
  2017. $a.=" and isgood='$isgood'";
  2018. }
  2019. if($classid)
  2020. {
  2021. if($class_r[$classid][islast])
  2022. {
  2023. $where="classid='$classid'";
  2024. }
  2025. else
  2026. {
  2027. $where=ReturnClass($class_r[$classid][sonclass]);
  2028. }
  2029. $a.=" and ".$where;
  2030. }
  2031. if($id)
  2032. {
  2033. $a.=" and id='$id'";
  2034. }
  2035. //排序
  2036. if($enews==1)//支持
  2037. {
  2038. $order='zcnum desc,plid desc';
  2039. }
  2040. elseif($enews==2)//反对
  2041. {
  2042. $order='fdnum desc,plid desc';
  2043. }
  2044. else//发布时间
  2045. {
  2046. $order='plid desc';
  2047. }
  2048. //取得模板
  2049. $tr=sys_ReturnBqTemp($tempid);
  2050. if(empty($tr['tempid']))
  2051. {return "";}
  2052. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  2053. $subnews=$tr[subnews];
  2054. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  2055. $rownum=$tr[rownum];
  2056. $formatdate=$tr[showdate];
  2057. if(empty($rownum))
  2058. {$rownum=1;}
  2059. //列表
  2060. $list_exp="[!--empirenews.listtemp--]";
  2061. $list_r=explode($list_exp,$listtemp);
  2062. $listtext=$list_r[1];
  2063. $no=1;
  2064. $changerow=1;
  2065. $sql=$empire->query("select plid,userid,username,saytime,id,classid,zcnum,fdnum,saytext from {$dbtbpre}enewspl_".$public_r['pldeftb']." where checked=0".$a." order by ".$order." limit ".$line);
  2066. while($r=$empire->fetch($sql))
  2067. {
  2068. //替换列表变量
  2069. $repvar=ReplaceShowPlVars($no,$listvar,$r,$formatdate,$subnews);
  2070. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  2071. $changerow+=1;
  2072. //超过行数
  2073. if($changerow>$rownum)
  2074. {
  2075. $changerow=1;
  2076. $string.=$listtext;
  2077. $listtext=$list_r[1];
  2078. }
  2079. $no++;
  2080. }
  2081. //多余数据
  2082. if($changerow<=$rownum&&$listtext<>$list_r[1])
  2083. {
  2084. $string.=$listtext;
  2085. }
  2086. $string=$list_r[0].$string.$list_r[2];
  2087. echo $string;
  2088. }
  2089.  
  2090. //替换评论标签
  2091. function ReplaceShowPlVars($no,$listtemp,$r,$formatdate,$subnews=0){
  2092. global $public_r,$empire,$dbtbpre,$class_r;
  2093. //标题
  2094. $infor=$empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]' limit 1");
  2095. $r['saytext']=stripSlashes($r['saytext']);
  2096. if($subnews)
  2097. {
  2098. $r['saytext']=sub($r['saytext'],0,$subnews,false);
  2099. }
  2100. if($r['userid'])
  2101. {
  2102. $r['username']="<a href='".$public_r[newsurl]."e/space/?userid=$r[userid]' target='_blank'>$r[username]</a>";
  2103. }
  2104. if(empty($r['username']))
  2105. {
  2106. $r['username']='匿名';
  2107. }
  2108. $titleurl=sys_ReturnBqTitleLink($infor);
  2109. $listtemp=str_replace("[!--titleurl--]",$titleurl,$listtemp);
  2110. $listtemp=str_replace("[!--title--]",$infor['title'],$listtemp);
  2111. $listtemp=str_replace("[!--plid--]",$r['plid'],$listtemp);
  2112. $listtemp=str_replace("[!--pltext--]",RepPltextFace($r['saytext']),$listtemp);
  2113. $listtemp=str_replace("[!--id--]",$r['id'],$listtemp);
  2114. $listtemp=str_replace("[!--classid--]",$r['classid'],$listtemp);
  2115. $listtemp=str_replace("[!--pltime--]",date($formatdate,$r['saytime']),$listtemp);
  2116. $listtemp=str_replace("[!--username--]",$r['username'],$listtemp);
  2117. $listtemp=str_replace("[!--zcnum--]",$r['zcnum'],$listtemp);
  2118. $listtemp=str_replace("[!--fdnum--]",$r['fdnum'],$listtemp);
  2119. //序号
  2120. $listtemp=str_replace("[!--no--]",$no,$listtemp);
  2121. return $listtemp;
  2122. }
  2123.  
  2124. //显示单个会员信息
  2125. function sys_ShowMemberInfo($userid=0,$fields=''){
  2126. global $empire,$dbtbpre,$public_r,$navinfor,$level_r;
  2127. if(empty($userid)&&$navinfor[ismember]==0)
  2128. {
  2129. return '';
  2130. }
  2131. if(!defined('InEmpireCMSUser'))
  2132. {
  2133. include_once ECMS_PATH.'e/member/class/user.php';
  2134. }
  2135. $uid=$userid?$userid:$navinfor[userid];
  2136. $uid=(int)$uid;
  2137. if(empty($fields))
  2138. {
  2139. $fields='u.*,ui.*';
  2140. }
  2141. $r=$empire->fetch1("select ".$fields." from ".eReturnMemberTable()." u LEFT JOIN {$dbtbpre}enewsmemberadd ui ON u.".egetmf('userid')."=ui.userid where u.".egetmf('userid')."='$uid' limit 1");
  2142. $field_groupid=egetmf('groupid');
  2143. $r['groupname']=$level_r[$r[$field_groupid]][groupname];//会员组
  2144. return $r;
  2145. }
  2146.  
  2147. //调用会员列表
  2148. function sys_ListMemberInfo($line=10,$ecms=0,$groupid=0,$userids=0,$fields=''){
  2149. global $empire,$dbtbpre,$public_r,$navinfor,$level_r;
  2150. if(!defined('InEmpireCMSUser'))
  2151. {
  2152. include_once ECMS_PATH.'e/member/class/user.php';
  2153. }
  2154. //操作类型
  2155. if($ecms==1)//积分排行
  2156. {
  2157. $order='u.'.egetmf('userfen').' desc';
  2158. }
  2159. elseif($ecms==2)//资金排行
  2160. {
  2161. $order='u.'.egetmf('money').' desc';
  2162. }
  2163. elseif($ecms==3)//空间人气排行
  2164. {
  2165. $order='ui.viewstats desc';
  2166. }
  2167. else//用户ID排行
  2168. {
  2169. $order='u.'.egetmf('userid').' desc';
  2170. }
  2171. $where='';
  2172. if($groupid)
  2173. {
  2174. $where.=' and u.'.egetmf('groupid').' in ('.$groupid.')';
  2175. }
  2176. if($userids)
  2177. {
  2178. $where.=' and u.'.egetmf('userid').' in ('.$userids.')';
  2179. }
  2180. if(empty($fields))
  2181. {
  2182. $fields='u.*,ui.*';
  2183. }
  2184. $sql=$empire->query("select ".$fields." from ".eReturnMemberTable()." u LEFT JOIN {$dbtbpre}enewsmemberadd ui ON u.".egetmf('userid')."=ui.userid where u.".egetmf('checked')."=1".$where." order by ".$order." limit ".$line);
  2185. return $sql;
  2186. }
  2187.  
  2188. //显示TAGS
  2189. function sys_eShowTags($cid,$num=0,$line=0,$order='',$isgood='',$isgoodshow='',$showjg='',$shownum=0,$cs='',$vartype=''){
  2190. global $empire,$dbtbpre,$public_r,$navinfor;
  2191. $str='';
  2192. if(empty($showjg))
  2193. {
  2194. $showjg=' &nbsp; ';
  2195. }
  2196. $ln=0;
  2197. if($cid=='selfinfo')
  2198. {
  2199. if(empty($navinfor['infotags']))
  2200. {
  2201. return '';
  2202. }
  2203. $jg='';
  2204. $r=explode(',',$navinfor['infotags']);
  2205. $count=count($r);
  2206. for($i=0;$i<$count;$i++)
  2207. {
  2208. $ln++;
  2209. $br='';
  2210. if($line)
  2211. {
  2212. if($ln%$line==0)
  2213. {
  2214. $br='<br>';
  2215. }
  2216. }
  2217. if(empty($cs))
  2218. {
  2219. $rewriter=eReturnRewriteTagsUrl(0,$r[$i],1);
  2220. $tagsurl=$rewriter['pageurl'];
  2221. }
  2222. else
  2223. {
  2224. $tagsurl=$public_r[newsurl].'e/tags/?tagname='.urlencode($r[$i]).$cs;
  2225. }
  2226. $str.=$jg.'<a href="'.$tagsurl.'" target="_blank">'.$r[$i].'</a>'.$br;
  2227. $jg=$br?'':$showjg;
  2228. }
  2229. }
  2230. else
  2231. {
  2232. $and='';
  2233. $where='';
  2234. if($cid)
  2235. {
  2236. $where=strstr($cid,',')?"cid in ($cid)":"cid='$cid'";
  2237. $and=' and ';
  2238. }
  2239. if($isgood)
  2240. {
  2241. $where.=$and.'isgood=1';
  2242. }
  2243. if($where)
  2244. {
  2245. $where=' where '.$where;
  2246. }
  2247. $order=$order?' '.$order:' tagid desc';
  2248. $limit='';
  2249. if($num)
  2250. {
  2251. $limit=' limit '.$num;
  2252. }
  2253. //推荐标红
  2254. $gfont1='';
  2255. $gfont2='';
  2256. if($isgoodshow)
  2257. {
  2258. if(strstr($isgoodshow,'r'))
  2259. {
  2260. $gfont1='<font color="red">';
  2261. $gfont2='</font>';
  2262. }
  2263. if(strstr($isgoodshow,'s'))
  2264. {
  2265. $gfont1=$gfont1.'<b>';
  2266. $gfont2='</b>'.$gfont2;
  2267. }
  2268. }
  2269. $jg='';
  2270. $snum='';
  2271. $sql=$empire->query("select tagid,tagname,num,isgood from {$dbtbpre}enewstags".$where." order by".$order.$limit);
  2272. while($r=$empire->fetch($sql))
  2273. {
  2274. if($shownum)
  2275. {
  2276. $snum='('.$r[num].')';
  2277. }
  2278. $font1='';
  2279. $font2='';
  2280. if($isgoodshow&&$r[isgood])
  2281. {
  2282. $font1=$gfont1;
  2283. $font2=$gfont2;
  2284. }
  2285. $ln++;
  2286. $br='';
  2287. if($line)
  2288. {
  2289. if($ln%$line==0)
  2290. {
  2291. $br='<br>';
  2292. }
  2293. }
  2294. if(empty($cs)&&$vartype<>'tagid')
  2295. {
  2296. $rewriter=eReturnRewriteTagsUrl($r['tagid'],$r['tagname'],1);
  2297. $tagsurl=$rewriter['pageurl'];
  2298. }
  2299. else
  2300. {
  2301. $tagsurl=$public_r[newsurl].'e/tags/?'.($vartype=='tagid'?'tagid='.$r[tagid]:'tagname='.urlencode($r[tagname])).$cs;
  2302. }
  2303. $str.=$jg.'<a href="'.$tagsurl.'" target="_blank">'.$font1.$r[tagname].$snum.$font2.'</a>'.$br;
  2304. $jg=$br?'':$showjg;
  2305. }
  2306. }
  2307. echo $str;
  2308. }
  2309.  
  2310. //索引灵动标签:返回SQL内容函数
  2311. function sys_ReturnEcmsIndexLoopBq($id=0,$line=10,$enews=3,$classid='',$mid='',$ewhere=''){
  2312. global $navclassid;
  2313. if($enews==1)//专题最新
  2314. {
  2315. $type='zt';
  2316. $eorder='newstime desc';
  2317. $selectf=',ztid,cid,isgood';
  2318. }
  2319. elseif($enews==2)//专题最早
  2320. {
  2321. $type='zt';
  2322. $eorder='newstime asc';
  2323. $selectf=',ztid,cid,isgood';
  2324. }
  2325. elseif($enews==3)//专题推荐
  2326. {
  2327. $type='zt';
  2328. $eorder='newstime asc';
  2329. $selectf=',ztid,cid,isgood';
  2330. $where=' and isgood>0';
  2331. }
  2332. elseif($enews==4)//专题子类最新
  2333. {
  2334. $type='ztc';
  2335. $eorder='newstime desc';
  2336. $selectf=',ztid,cid,isgood';
  2337. }
  2338. elseif($enews==5)//专题子类最早
  2339. {
  2340. $type='ztc';
  2341. $eorder='newstime asc';
  2342. $selectf=',ztid,cid,isgood';
  2343. }
  2344. elseif($enews==6)//专题子类推荐
  2345. {
  2346. $type='ztc';
  2347. $eorder='newstime asc';
  2348. $selectf=',ztid,cid,isgood';
  2349. $where=' and isgood>0';
  2350. }
  2351. elseif($enews==7)//TAGS最新
  2352. {
  2353. $type='sp';
  2354. $eorder='newstime desc';
  2355. $selectf='';
  2356. }
  2357. elseif($enews==8)//TAGS最早
  2358. {
  2359. $type='sp';
  2360. $eorder='newstime asc';
  2361. $selectf='';
  2362. }
  2363. elseif($enews==9)//碎片最新
  2364. {
  2365. $type='tags';
  2366. $eorder='newstime desc';
  2367. $selectf='';
  2368. }
  2369. elseif($enews==10)//碎片最早
  2370. {
  2371. $type='tags';
  2372. $eorder='newstime asc';
  2373. $selectf='';
  2374. }
  2375. elseif($enews==11)//SQL调用
  2376. {
  2377. $type='sql';
  2378. $eorder='newstime asc';
  2379. $selectf='';
  2380. }
  2381. if($id=='selfinfo')//显示当前ID信息
  2382. {
  2383. $id=$navclassid;
  2384. }
  2385. return sys_ReturnTogQuery($type,$id,$line,$classid,$mid,$ewhere,$eorder,$selectf);
  2386. }
  2387.  
  2388. //返回组合查询
  2389. function sys_ReturnTogQuery($type,$id,$line,$classid='',$mid='',$ewhere='',$eorder='',$selectf=''){
  2390. global $empire,$public_r,$class_r,$class_zr,$navclassid,$dbtbpre,$class_tr,$emod_r;
  2391. if($type=='tags')//TAGS
  2392. {
  2393. $idf='tagid';
  2394. $orderf='newstime desc';
  2395. $table=$dbtbpre.'enewstagsdata';
  2396. }
  2397. elseif($type=='zt')//专题
  2398. {
  2399. $idf='ztid';
  2400. $orderf='newstime desc';
  2401. $table=$dbtbpre.'enewsztinfo';
  2402. }
  2403. elseif($type=='ztc')//专题子类
  2404. {
  2405. $idf='cid';
  2406. $orderf='newstime desc';
  2407. $table=$dbtbpre.'enewsztinfo';
  2408. }
  2409. elseif($type=='sql')//SQL查询
  2410. {
  2411. $query_first=substr($id,0,7);
  2412. if(!($query_first=='select '||$query_first=='SELECT '))
  2413. {
  2414. return '';
  2415. }
  2416. $id=RepSqlTbpre($id);
  2417. $sql=$empire->query1($id);
  2418. if(!$sql)
  2419. {
  2420. echo'SQL Error: '.ReRepSqlTbpre($id);
  2421. }
  2422. return $sql;
  2423. }
  2424. else//碎片
  2425. {
  2426. $idf='spid';
  2427. $orderf='newstime desc';
  2428. $table=$dbtbpre.'enewssp_2';
  2429. }
  2430. $where=strstr($id,',')?"$idf in ($id)":"$idf='$id'";
  2431. //栏目
  2432. if($classid)
  2433. {
  2434. if(strstr($classid,','))//多栏目
  2435. {
  2436. $son_r=sys_ReturnMoreClass($classid,1);
  2437. $classid=$son_r[0];
  2438. $add=$son_r[1];
  2439. }
  2440. else
  2441. {
  2442. if($classid=='selfinfo')//显示当前栏目信息
  2443. {
  2444. $classid=$navclassid;
  2445. }
  2446. if($class_r[$classid][islast])
  2447. {
  2448. $add="classid='$classid'";
  2449. }
  2450. else
  2451. {
  2452. $add=ReturnClass($class_r[$classid][sonclass]);
  2453. }
  2454. }
  2455. $where.=' and ('.$add.')';
  2456. }
  2457. //模型
  2458. if($mid)
  2459. {
  2460. $where.=strstr($mid,',')?" and mid in ($mid)":" and mid='$mid'";
  2461. }
  2462. //附加sql条件
  2463. if(!empty($ewhere))
  2464. {
  2465. $where.=' and ('.$ewhere.')';
  2466. }
  2467. //排序
  2468. if(!empty($eorder))
  2469. {
  2470. $orderf=$eorder;
  2471. }
  2472. $query='select classid,id'.$selectf.' from '.$table.' where '.$where.' order by '.$orderf.' limit '.$line;
  2473. $sql=$empire->query1($query);
  2474. if(!$sql)
  2475. {
  2476. echo'SQL Error: '.ReRepSqlTbpre($query);
  2477. }
  2478. return $sql;
  2479. }
  2480.  
  2481. //调用TAGS信息
  2482. function sys_eShowTagsInfo($tagid,$line,$strlen,$tempid,$classid='',$mid=''){
  2483. global $empire,$dbtbpre,$public_r,$class_r,$emod_r;
  2484. if(empty($tagid))
  2485. {
  2486. return '';
  2487. }
  2488. $sql=sys_ReturnTogQuery('tags',$tagid,$line,$classid,$mid);
  2489. if(!$sql)
  2490. {return "";}
  2491. //取得模板
  2492. $tr=sys_ReturnBqTemp($tempid);
  2493. if(empty($tr['tempid']))
  2494. {return "";}
  2495. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  2496. $subnews=$tr[subnews];
  2497. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  2498. $rownum=$tr[rownum];
  2499. $formatdate=$tr[showdate];
  2500. $docode=$tr[docode];
  2501. if(empty($rownum))
  2502. {$rownum=1;}
  2503. //字段
  2504. $ret_r=ReturnReplaceListF($tr[modid]);
  2505. //列表
  2506. $list_exp="[!--empirenews.listtemp--]";
  2507. $list_r=explode($list_exp,$listtemp);
  2508. $listtext=$list_r[1];
  2509. $no=1;
  2510. $changerow=1;
  2511. while($r=$empire->fetch($sql))
  2512. {
  2513. if(empty($class_r[$r[classid]][tbname]))
  2514. {
  2515. continue;
  2516. }
  2517. $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]' limit 1");
  2518. if(empty($infor['id']))
  2519. {
  2520. continue;
  2521. }
  2522. $infor[oldtitle]=$infor[title];
  2523. //替换列表变量
  2524. $repvar=ReplaceListVars($no,$listvar,$subnews,$strlen,$formatdate,$url,$have_class,$infor,$ret_r,$docode);
  2525. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  2526. $changerow+=1;
  2527. //超过行数
  2528. if($changerow>$rownum)
  2529. {
  2530. $changerow=1;
  2531. $string.=$listtext;
  2532. $listtext=$list_r[1];
  2533. }
  2534. $no++;
  2535. }
  2536. //多余数据
  2537. if($changerow<=$rownum&&$listtext<>$list_r[1])
  2538. {
  2539. $string.=$listtext;
  2540. }
  2541. $string=$list_r[0].$string.$list_r[2];
  2542. echo $string;
  2543. }
  2544.  
  2545. //-------------------------- 碎片 --------------------------
  2546. //显示碎片
  2547. function sys_eShowSpInfo($spvar,$line=10,$strlen=0){
  2548. global $empire,$dbtbpre,$public_r;
  2549. if(empty($spvar))
  2550. {
  2551. return '';
  2552. }
  2553. $spr=$empire->fetch1("select spid,spname,sppic,spsay,tempid,sptype from {$dbtbpre}enewssp where varname='$spvar' limit 1");
  2554. if($spr['sptype']==1)//静态信息碎片
  2555. {
  2556. sys_eShowSp1($spr['spid'],$spr,$line,$strlen);
  2557. }
  2558. elseif($spr['sptype']==2)
  2559. {
  2560. sys_eShowSp2($spr['spid'],$spr,$line,$strlen);
  2561. }
  2562. elseif($spr['sptype']==3)
  2563. {
  2564. sys_eShowSp3($spr['spid']);
  2565. }
  2566. }
  2567.  
  2568. //替换碎片名
  2569. function ReplaceSpClassname($temp,$spid,$spr){
  2570. $temp=str_replace("[!--the.spname--]",$spr[spname],$temp);
  2571. $temp=str_replace("[!--the.spid--]",$spid,$temp);
  2572. $temp=str_replace("[!--the.sppic--]",$spr[sppic],$temp);
  2573. $temp=str_replace("[!--the.spsay--]",$spr[spsay],$temp);
  2574. return $temp;
  2575. }
  2576.  
  2577. //静态信息碎片
  2578. function sys_eShowSp1($spid,$spr,$line,$strlen){
  2579. global $empire,$dbtbpre,$public_r;
  2580. //取得模板
  2581. $tr=sys_ReturnBqTemp($spr['tempid']);
  2582. if(empty($tr['tempid']))
  2583. {return "";}
  2584. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  2585. $subnews=$tr[subnews];
  2586. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  2587. $rownum=$tr[rownum];
  2588. $formatdate=$tr[showdate];
  2589. //替换模板变量
  2590. $listtemp=ReplaceSpClassname($listtemp,$spid,$spr);
  2591. if(empty($rownum))
  2592. {$rownum=1;}
  2593. //列表
  2594. $list_exp="[!--empirenews.listtemp--]";
  2595. $list_r=explode($list_exp,$listtemp);
  2596. $listtext=$list_r[1];
  2597. $no=1;
  2598. $changerow=1;
  2599. $sql=$empire->query("select sid,title,titlepic,bigpic,titleurl,smalltext,titlefont,newstime,titlepre,titlenext from {$dbtbpre}enewssp_1 where spid='$spid' order by newstime desc limit ".$line);
  2600. while($r=$empire->fetch($sql))
  2601. {
  2602. $r[oldtitle]=$r[title];
  2603. //替换列表变量
  2604. $repvar=ReplaceShowSponeVars($no,$listvar,$subnews,$strlen,$formatdate,$r);
  2605. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  2606. $changerow+=1;
  2607. //超过行数
  2608. if($changerow>$rownum)
  2609. {
  2610. $changerow=1;
  2611. $string.=$listtext;
  2612. $listtext=$list_r[1];
  2613. }
  2614. $no++;
  2615. }
  2616. //多余数据
  2617. if($changerow<=$rownum&&$listtext<>$list_r[1])
  2618. {
  2619. $string.=$listtext;
  2620. }
  2621. $string=$list_r[0].$string.$list_r[2];
  2622. echo $string;
  2623. }
  2624.  
  2625. //替换静态碎片标签
  2626. function ReplaceShowSponeVars($no,$listtemp,$subnews,$subtitle,$formatdate,$r){
  2627. global $public_r;
  2628. //标题
  2629. if(!empty($subtitle))//截取字符
  2630. {
  2631. $r[title]=sub($r[title],0,$subtitle,false);
  2632. }
  2633. $r[title]=DoTitleFont($r[titlefont],$r[title]);
  2634. $listtemp=str_replace('[!--title--]',$r['title'],$listtemp);
  2635. $listtemp=str_replace('[!--oldtitle--]',$r['oldtitle'],$listtemp);
  2636. //时间
  2637. $listtemp=str_replace('[!--newstime--]',date($formatdate,$r['newstime']),$listtemp);
  2638. //其它变量
  2639. $listtemp=str_replace('[!--id--]',$r['sid'],$listtemp);
  2640. $listtemp=str_replace('[!--titleurl--]',$r['titleurl'],$listtemp);
  2641. $listtemp=str_replace('[!--titlepic--]',$r['titlepic'],$listtemp);
  2642. $listtemp=str_replace('[!--bigpic--]',$r['bigpic'],$listtemp);
  2643. $listtemp=str_replace('[!--titlepre--]',$r['titlepre'],$listtemp);
  2644. $listtemp=str_replace('[!--titlenext--]',$r['titlenext'],$listtemp);
  2645. //简介
  2646. if(!empty($subnews))//截取字符
  2647. {
  2648. $r[smalltext]=sub($r[smalltext],0,$subnews,false);
  2649. }
  2650. $listtemp=str_replace('[!--smalltext--]',nl2br($r['smalltext']),$listtemp);
  2651. //序号
  2652. $listtemp=str_replace('[!--no.num--]',$no,$listtemp);
  2653. return $listtemp;
  2654. }
  2655.  
  2656. //动态信息碎片
  2657. function sys_eShowSp2($spid,$spr,$line,$strlen){
  2658. global $empire,$dbtbpre,$public_r,$class_r,$emod_r;
  2659. $sql=sys_ReturnTogQuery('sp',$spid,$line,'','');
  2660. if(!$sql)
  2661. {return "";}
  2662. //取得模板
  2663. $tr=sys_ReturnBqTemp($spr['tempid']);
  2664. if(empty($tr['tempid']))
  2665. {return "";}
  2666. $listtemp=str_replace('[!--news.url--]',$public_r[newsurl],$tr[temptext]);
  2667. $subnews=$tr[subnews];
  2668. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tr[listvar]);
  2669. $rownum=$tr[rownum];
  2670. $formatdate=$tr[showdate];
  2671. $docode=$tr[docode];
  2672. //替换模板变量
  2673. $listtemp=ReplaceSpClassname($listtemp,$spid,$spr);
  2674. if(empty($rownum))
  2675. {$rownum=1;}
  2676. //字段
  2677. $ret_r=ReturnReplaceListF($tr[modid]);
  2678. //列表
  2679. $list_exp="[!--empirenews.listtemp--]";
  2680. $list_r=explode($list_exp,$listtemp);
  2681. $listtext=$list_r[1];
  2682. $no=1;
  2683. $changerow=1;
  2684. while($r=$empire->fetch($sql))
  2685. {
  2686. if(empty($class_r[$r[classid]][tbname]))
  2687. {
  2688. continue;
  2689. }
  2690. $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]' limit 1");
  2691. if(empty($infor['id']))
  2692. {
  2693. continue;
  2694. }
  2695. $infor[oldtitle]=$infor[title];
  2696. //替换列表变量
  2697. $repvar=ReplaceListVars($no,$listvar,$subnews,$strlen,$formatdate,$url,$have_class,$infor,$ret_r,$docode);
  2698. $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
  2699. $changerow+=1;
  2700. //超过行数
  2701. if($changerow>$rownum)
  2702. {
  2703. $changerow=1;
  2704. $string.=$listtext;
  2705. $listtext=$list_r[1];
  2706. }
  2707. $no++;
  2708. }
  2709. //多余数据
  2710. if($changerow<=$rownum&&$listtext<>$list_r[1])
  2711. {
  2712. $string.=$listtext;
  2713. }
  2714. $string=$list_r[0].$string.$list_r[2];
  2715. echo $string;
  2716. }
  2717.  
  2718. //代码碎片
  2719. function sys_eShowSp3($spid){
  2720. global $empire,$dbtbpre;
  2721. $r=$empire->fetch1("select sptext from {$dbtbpre}enewssp_3 where spid='$spid' limit 1");
  2722. echo $r['sptext'];
  2723. }
  2724.  
  2725. //调用生成缩图
  2726. function sys_ResizeImg($file,$width,$height,$docut=0,$target_filename='',$target_path='e/data/tmp/titlepic/'){
  2727. global $public_r,$ecms_config;
  2728. if(!$file||!$width||!$height)
  2729. {
  2730. return $file;
  2731. }
  2732. //扩展名
  2733. $filetype=GetFiletype($file);
  2734. if(!strstr($ecms_config['sets']['tranpicturetype'],','.$filetype.','))
  2735. {
  2736. return $file;
  2737. }
  2738. $efileurl=eReturnFileUrl();
  2739. if(strstr($file,$efileurl))
  2740. {
  2741. $file=str_replace($efileurl,'/d/file/',$file);
  2742. }
  2743. if(strstr($file,'://'))
  2744. {
  2745. return $file;
  2746. }
  2747. $filename=ECMS_PATH.substr($file,1);
  2748. if(!file_exists($filename))
  2749. {
  2750. return $file;
  2751. }
  2752. if($target_filename)
  2753. {
  2754. $newfilename=$target_filename;
  2755. }
  2756. else
  2757. {
  2758. $newfilename=md5($file.'-'.$width.'-'.$height.'-'.$docut);
  2759. }
  2760. $newpath=ECMS_PATH.$target_path;
  2761. $newurl=$public_r['newsurl'].$target_path;
  2762. $newname=$newpath.$newfilename;
  2763. if(empty($target_filename)&&file_exists($newname.$filetype))
  2764. {
  2765. return $newurl.$newfilename.$filetype;
  2766. }
  2767. if(!defined('InEmpireCMSGd'))
  2768. {
  2769. include_once ECMS_PATH.'e/class/gd.php';
  2770. }
  2771. $filer=ResizeImage($filename,$newname,$width,$height,$docut);
  2772. $fileurl=$newurl.$newfilename.$filer['filetype'];
  2773. return $fileurl;
  2774. }
  2775. ?>

帝国cms建站总结-(分页)的更多相关文章

  1. 帝国cms建站-动态获取栏目id

    <?php $fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]); $topbclassid=$fcr[1]?$fcr[1 ...

  2. 嗨分享-前端技术-帝国CMS手机站修改列表分页(sysShowListMorePage)

    http://bbs.phome.net/showthread-31-318753-0.html 如果你的网站使用的是帝国CMS.PC站和手机站各使用一个模板组,但共同使用一个数据库.那么你的PC站和 ...

  3. 如何选择适合自己的CMS建站系统

             在互联网发展突飞猛进的今天,可谓”得市场者得天下”,而电商已成为占据市场速度最快.范围最广的手段,进而网站建设也逐渐引起商家重视,并深入到了企业和个体的发展战略之中. 如今企业建站已 ...

  4. 帝国cms建站方法和知识点

    帝国cms建站方法和知识点 1.  首先在帝国cms网站上下载模板系统.根据模板系统上的提示,将指定的目录文件放在指定的位置.然后进行安装.后台管理系统的命名设置.数据库的设置等等. 2.  安装完成 ...

  5. 基于ZKEACMS的.Net Core多租户CMS建站系统

    多租户架构 多租户技术或称多重租赁技术,简称SaaS,是一种软件架构技术,是实现如何在多用户环境下共用相同的系统或程序组件,并且可确保各用户间数据的隔离性.简单讲:在一台服务器上运行单个应用实例,它为 ...

  6. 来选择一款适合你网站的CMS建站程序吧

    1:首页我们要搞清楚什么叫cms? ContentManagementSystem就是cms的全名,意思就是内容管理系统.cms整站系统是以文章系统为核心,增加用户需要的模块,如文章.图片.下载等,提 ...

  7. 推荐的五款市面上常用的免费CMS建站系统

    我做设计也有不少年头了,很多客户或者朋友找我做网站的时候,一般问我的是用什么软件系统给他们做.大部分客户希望用的软件是免费的.所以今天给大家介绍五款我自己用过还不错的,重点是还免费的建站系统. Met ...

  8. 开源CMS建站项目DNN研究与心得

    DNN (Dotnetnuke) 首先是开源的,并且采用BSD开源协议,也就是说你可以任意修改源代码.传播.作为商品出售,仅有的要求就是保留源代码中的版权文字,这就解决了我多年来的心病:我知道动网新闻 ...

  9. 织梦CMS建站入门学习(二)

    织梦建站的数据库设计: 1.模型表:根据网站的需求,建立不同的数据模型,如:文章浏览,软件下载,视频观看等等. 2.栏目表:根据网站的需求,建立不同的栏目,每一个栏目选择一个数据模型. 3.内容主表: ...

随机推荐

  1. 【代码审计】YUNUCMS_v1.0.6 后台代码执行漏洞分析

      0x00 环境准备 QYKCMS官网:http://www.yunucms.com 网站源码版本:YUNUCMSv1.0.6 程序源码下载:http://www.yunucms.com/Downl ...

  2. apache2.2服务无法启动 发生服务特定错误:1 的解决办法 (windows服务错误 日志查看方法)

    转 https://blog.csdn.net/liuensong/article/details/6738041 查错过程: 1.查看apache错误日志:目录下的apache/logs/error ...

  3. JS正则校验

    /** 用途:检查输入字符串是否为空或者全部都是空格 输入:str:字符串 返回: 如果全是空返回true,否则返回false */ function isNull(str) { if (str == ...

  4. windows 2008 r2 不能启用网络发现

    在win2008 R2里面,不能启用网络发现,查询资料,得知需开启一下三个服务: Function Discovery Resource Publication SSDP Discovery UPnP ...

  5. Python处理数据

    由于找实习,要学习python处理数据,python连接mysql,python读写文件,python读写xlsx文件,这些只要引入了相关的包,就非常容易,处理过程非常清晰.模块如果封装的好,没怎么学 ...

  6. day_5.19 py总结②

  7. 将数据 导出excel表格式

    我的考试完提交生成的数据 这是我的考试题类型 //导出调查评议的数据 public function diaocha(){ $xlsName = '表格形式 调查评议 信息'; $xlsTitle = ...

  8. 洛谷P1605 迷宫【dfs】

    题目背景 迷宫 [问题描述] 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过.给定起点坐标和 终点坐标,问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案.在迷宫 中移动有上下 ...

  9. .NET Core开发日志——Entity Framework与PostgreSQL

    Entity Framework在.NET Core中被命名为Entity Framework Core.虽然一般会用于对SQL Server数据库进行数据操作,但其实它还支持其它数据库,这里就以Po ...

  10. windows10安装

    https://www.microsoft.com/zh-cn/software-download/windows10