PageRenderTime 61ms CodeModel.GetById 21ms 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

Large files files are truncated, but you can click here to view the full 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,$fs

Large files files are truncated, but you can click here to view the full file