t_functions.php 78 KB

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