PageRenderTime 73ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/e/class/t_functions.php

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