com_functions.php 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. <?php
  2. //增加留言分类
  3. function AddGbookClass($add,$do=0,$userid,$username){
  4. global $empire,$dbtbpre;
  5. if(empty($add[bname]))
  6. {
  7. printerror("EmptyGbookClass","history.go(-1)");
  8. }
  9. if(empty($do))
  10. {
  11. $add['checked']=(int)$add['checked'];
  12. $add['groupid']=(int)$add['groupid'];
  13. $level="gbook";
  14. $table="{$dbtbpre}enewsgbookclass";
  15. $location="GbookClass.php".hReturnEcmsHashStrHref2(1);
  16. $mychecked=",checked,groupid";
  17. $mycheckedvalue=",".$add['checked'].",".$add['groupid'];
  18. }
  19. else
  20. {
  21. $level="feedback";
  22. $table="{$dbtbpre}enewsfeedbackclass";
  23. $location="FeedbackClass.php".hReturnEcmsHashStrHref2(1);
  24. $mychecked="";
  25. $mycheckedvalue="";
  26. }
  27. //验证权限
  28. CheckLevel($userid,$username,$classid,$level);
  29. $add['bname']=hRepPostStr($add['bname'],1);
  30. $sql=$empire->query("insert into ".$table."(bname".$mychecked.") values('$add[bname]'".$mycheckedvalue.");");
  31. if($sql)
  32. {
  33. $bid=$empire->lastid();
  34. //操作日志
  35. insert_dolog("bid=".$bid."<br>bname=".$add[bname]);
  36. printerror("AddGbookClassSuccess",$location);
  37. }
  38. else
  39. {printerror("DbError","history.go(-1)");}
  40. }
  41. //修改留言分类
  42. function EditGbookClass($add,$do=0,$userid,$username){
  43. global $empire,$dbtbpre;
  44. $add[bid]=(int)$add[bid];
  45. if(empty($add[bname])||!$add[bid])
  46. {
  47. printerror("EmptyGbookClass","history.go(-1)");
  48. }
  49. if(empty($do))
  50. {
  51. $add['checked']=(int)$add['checked'];
  52. $add['groupid']=(int)$add['groupid'];
  53. $level="gbook";
  54. $table="{$dbtbpre}enewsgbookclass";
  55. $location="GbookClass.php".hReturnEcmsHashStrHref2(1);
  56. $mychecked=",checked=".$add['checked'].",groupid=".$add['groupid'];
  57. }
  58. else
  59. {
  60. $level="feedback";
  61. $table="{$dbtbpre}enewsfeedbackclass";
  62. $location="FeedbackClass.php".hReturnEcmsHashStrHref2(1);
  63. $mychecked="";
  64. }
  65. //验证权限
  66. CheckLevel($userid,$username,$classid,$level);
  67. $add['bname']=hRepPostStr($add['bname'],1);
  68. $sql=$empire->query("update ".$table." set bname='$add[bname]'".$mychecked." where bid='$add[bid]';");
  69. if($sql)
  70. {
  71. //操作日志
  72. insert_dolog("bid=".$add[bid]."<br>bname=".$add[bname]);
  73. printerror("EditGbookClassSuccess",$location);
  74. }
  75. else
  76. {printerror("DbError","history.go(-1)");}
  77. }
  78. //删除留言分类
  79. function DelGbookClass($bid,$do=0,$userid,$username){
  80. global $empire,$dbtbpre;
  81. $bid=(int)$bid;
  82. if(!$bid)
  83. {
  84. printerror("NotChangeGbookClassid","history.go(-1)");
  85. }
  86. if(empty($do))
  87. {
  88. $level="gbook";
  89. $table="{$dbtbpre}enewsgbookclass";
  90. $tabledata="{$dbtbpre}enewsgbook";
  91. $location="GbookClass.php".hReturnEcmsHashStrHref2(1);
  92. }
  93. else
  94. {
  95. $level="feedback";
  96. $table="{$dbtbpre}enewsfeedbackclass";
  97. $tabledata="{$dbtbpre}enewsfeedback";
  98. $location="FeedbackClass.php".hReturnEcmsHashStrHref2(1);
  99. }
  100. //验证权限
  101. CheckLevel($userid,$username,$classid,$level);
  102. $r=$empire->fetch1("select bname from ".$table." where bid='$bid';");
  103. $sql=$empire->query("delete from ".$table." where bid='$bid';");
  104. $sql1=$empire->query("delete from ".$tabledata." where bid='$bid';");
  105. if($sql)
  106. {
  107. //操作日志
  108. insert_dolog("bid=".$bid."<br>bname=".$r[bname]);
  109. printerror("DelGbookClassSuccess",$location);
  110. }
  111. else
  112. {printerror("DbError","history.go(-1)");}
  113. }
  114. //---------返回留言/反馈分类
  115. function ReturnGbookClass($bid,$do=0){
  116. global $empire,$dbtbpre;
  117. $bid=(int)$bid;
  118. if(empty($do))
  119. {
  120. $table="{$dbtbpre}enewsgbookclass";
  121. }
  122. else
  123. {
  124. $table="{$dbtbpre}enewsfeedbackclass";
  125. }
  126. $sql=$empire->query("select bid,bname from ".$table." order by bid");
  127. while($r=$empire->fetch($sql))
  128. {
  129. if($bid==$r[bid])
  130. {$selected=" selected";}
  131. else
  132. {$selected="";}
  133. $select.="<option value=".$r[bid].$selected.">".$r[bname]."</option>";
  134. }
  135. return $select;
  136. }
  137. //回复留言板
  138. function ReGbook($lyid,$retext,$bid,$userid,$username){
  139. global $empire,$dbtbpre;
  140. $lyid=(int)$lyid;
  141. $bid=(int)$bid;
  142. if(!$lyid||!$retext)
  143. {
  144. printerror("EmptyReGbooktext","history.go(-1)");
  145. }
  146. //验证权限
  147. CheckLevel($userid,$username,$classid,"gbook");
  148. $retext=hRepPostStr2($retext);
  149. $sql=$empire->query("update {$dbtbpre}enewsgbook set retext='$retext' where lyid='$lyid';");
  150. if($sql)
  151. {
  152. //操作日志
  153. insert_dolog("lyid=".$lyid);
  154. echo"<script>opener.parent.main.location.href='gbook.php?bid=$bid".hReturnEcmsHashStrHref2(0)."';window.close();</script>";
  155. exit();
  156. }
  157. else
  158. {printerror("DbError","history.go(-1)");}
  159. }
  160. //删除留言
  161. function DelGbook($lyid,$bid,$userid,$username){
  162. global $empire,$dbtbpre;
  163. $lyid=(int)$lyid;
  164. $bid=(int)$bid;
  165. if(!$lyid)
  166. {
  167. printerror("NotChangeLyid","history.go(-1)");
  168. }
  169. //验证权限
  170. CheckLevel($userid,$username,$classid,"gbook");
  171. $sql=$empire->query("delete from {$dbtbpre}enewsgbook where lyid='$lyid';");
  172. if($sql)
  173. {
  174. //操作日志
  175. insert_dolog("lyid=".$lyid);
  176. printerror("DelGbookSuccess",EcmsGetReturnUrl());
  177. }
  178. else
  179. {printerror("DbError","history.go(-1)");}
  180. }
  181. //--------------------------批量删除留言(3.6)
  182. function DelGbook_all($lyid,$bid,$userid,$username){
  183. global $empire,$dbtbpre;
  184. //验证权限
  185. CheckLevel($userid,$username,$classid,"gbook");
  186. $bid=(int)$bid;
  187. $count=count($lyid);
  188. if(empty($count))
  189. {printerror("NotChangeLyid","history.go(-1)");}
  190. for($i=0;$i<$count;$i++)
  191. {
  192. $lyid[$i]=(int)$lyid[$i];
  193. $add.="lyid='$lyid[$i]' or ";
  194. }
  195. $add=substr($add,0,strlen($add)-4);
  196. $sql=$empire->query("delete from {$dbtbpre}enewsgbook where ".$add);
  197. if($sql)
  198. {
  199. //操作日志
  200. insert_dolog("");
  201. printerror("DelGbookSuccess",EcmsGetReturnUrl());
  202. }
  203. else
  204. {printerror("DbError","history.go(-1)");}
  205. }
  206. //--------------------------批量审核留言(3.6)
  207. function CheckGbook_all($lyid,$bid,$userid,$username){
  208. global $empire,$dbtbpre;
  209. //验证权限
  210. CheckLevel($userid,$username,$classid,"gbook");
  211. $bid=(int)$bid;
  212. $count=count($lyid);
  213. if(empty($count))
  214. {printerror("NotChangeCheckLyid","history.go(-1)");}
  215. for($i=0;$i<$count;$i++)
  216. {
  217. $lyid[$i]=(int)$lyid[$i];
  218. $add.="lyid='$lyid[$i]' or ";
  219. }
  220. $add=substr($add,0,strlen($add)-4);
  221. $sql=$empire->query("update {$dbtbpre}enewsgbook set checked=0 where ".$add);
  222. if($sql)
  223. {
  224. //操作日志
  225. insert_dolog("");
  226. printerror("CheckLysuccess",EcmsGetReturnUrl());
  227. }
  228. else
  229. {printerror("DbError","history.go(-1)");}
  230. }
  231. //删除反馈附件
  232. function DelFeedbackFile($filename,$filepath){
  233. global $empire,$dbtbpre,$public_r,$efileftp_dr;
  234. if($filename)
  235. {
  236. $fpath=0;
  237. $getfpath=0;
  238. $addfilepath=$filepath?$filepath.'/':'';
  239. $filer=explode(",",$filename);
  240. $fcount=count($filer);
  241. for($j=0;$j<$fcount;$j++)
  242. {
  243. if(!$getfpath)
  244. {
  245. $ftr=$empire->fetch1("select fpath from {$dbtbpre}enewsfile_other where modtype=4 and path='$filepath' and filename='".$filer[$j]."' limit 1");
  246. $fpath=$ftr[fpath];
  247. $getfpath=1;
  248. }
  249. $fspath=ReturnFileSavePath(0,$fpath);
  250. $delfile=eReturnEcmsMainPortPath().$fspath['filepath'].$addfilepath.$filer[$j];//moreport
  251. DelFiletext($delfile);
  252. $where.=$or."filename='".$filer[$j]."'";
  253. $or=" or ";
  254. //FileServer
  255. if($public_r['openfileserver'])
  256. {
  257. $efileftp_dr[]=$delfile;
  258. }
  259. }
  260. $delsql=$empire->query("delete from {$dbtbpre}enewsfile_other where modtype=4 and path='$filepath' and (".$where.")");
  261. }
  262. }
  263. //删除反馈信息
  264. function DelFeedback($id,$bid,$userid,$username){
  265. global $empire,$dbtbpre;
  266. $id=(int)$id;
  267. $bid=(int)$bid;
  268. if(!$id)
  269. {
  270. printerror("NotChangeFeedbackid","history.go(-1)");
  271. }
  272. //验证权限
  273. //CheckLevel($userid,$username,$classid,"feedback");
  274. $r=$empire->fetch1("select id,title,filepath,filename,bid from {$dbtbpre}enewsfeedback where id='$id';");
  275. if(!$r['id'])
  276. {
  277. printerror("NotChangeFeedbackid","history.go(-1)");
  278. }
  279. //反馈权限
  280. $bidr=ReturnAdminFeedbackClass($r['bid'],$userid,$username);
  281. $sql=$empire->query("delete from {$dbtbpre}enewsfeedback where id='$id';");
  282. //删除附件
  283. DelFeedbackFile($r['filename'],$r['filepath']);
  284. if($sql)
  285. {
  286. //操作日志
  287. insert_dolog("id=".$id."<br>title=$r[title]");
  288. printerror("DelFeedbackSuccess",EcmsGetReturnUrl());
  289. }
  290. else
  291. {printerror("DbError","history.go(-1)");}
  292. }
  293. //批量删除反馈信息
  294. function DelFeedback_all($id,$bid,$userid,$username){
  295. global $empire,$dbtbpre;
  296. $bid=(int)$bid;
  297. $count=count($id);
  298. if(!$count)
  299. {
  300. printerror("NotChangeFeedbackid","history.go(-1)");
  301. }
  302. //反馈权限
  303. $bidr=ReturnAdminFeedbackClass(0,$userid,$username);
  304. $dh='';
  305. $inid='';
  306. for($i=0;$i<$count;$i++)
  307. {
  308. $id[$i]=(int)$id[$i];
  309. //删除附件
  310. $r=$empire->fetch1("select id,filepath,filename,bid from {$dbtbpre}enewsfeedback where id='".$id[$i]."';");
  311. if(!strstr(','.$bidr['bids'].',',','.$r['bid'].','))
  312. {
  313. continue;
  314. }
  315. DelFeedbackFile($r['filename'],$r['filepath']);
  316. $inid.=$dh.$id[$i];
  317. $dh=",";
  318. }
  319. if($inid)
  320. {
  321. $sql=$empire->query("delete from {$dbtbpre}enewsfeedback where id in (".$inid.");");
  322. }
  323. if($sql)
  324. {
  325. //操作日志
  326. insert_dolog("");
  327. printerror("DelFeedbackSuccess",EcmsGetReturnUrl());
  328. }
  329. else
  330. {printerror("DbError","history.go(-1)");}
  331. }
  332. //返回字段值
  333. function ReturnFBFvalue($value){
  334. $value=str_replace("\r\n","|",$value);
  335. return $value;
  336. }
  337. //增加反馈字段
  338. function AddFeedbackF($add,$userid,$username){
  339. global $empire,$dbtbpre;
  340. $add[f]=RepPostVar($add[f]);
  341. if(empty($add[f])||empty($add[fname]))
  342. {printerror("EmptyF","history.go(-1)");}
  343. //验证权限
  344. //CheckLevel($userid,$username,$classid,"feedbackf");
  345. //字段是否重复
  346. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsfeedback");
  347. $b=0;
  348. while($r=$empire->fetch($s))
  349. {
  350. if($r[Field]==$add[f])
  351. {
  352. $b=1;
  353. break;
  354. }
  355. }
  356. if($b)
  357. {printerror("ReF","history.go(-1)");}
  358. $add[fvalue]=ReturnFBFvalue($add[fvalue]);//初始化值
  359. //字段类型
  360. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  361. {
  362. $def=" default '0'";
  363. }
  364. elseif($add[ftype]=="VARCHAR")
  365. {
  366. $def=" default ''";
  367. }
  368. else
  369. {
  370. $def="";
  371. }
  372. $type=$add[ftype];
  373. //VARCHAR
  374. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  375. {
  376. $add[flen]='255';
  377. }
  378. //字段长度
  379. if($add[flen])
  380. {
  381. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT")
  382. {
  383. $type.="(".$add[flen].")";
  384. }
  385. }
  386. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  387. //新增字段
  388. $asql=$empire->query("alter table {$dbtbpre}enewsfeedback add ".$field);
  389. //处理变量
  390. $add[myorder]=(int)$add[myorder];
  391. $sql=$empire->query("insert into {$dbtbpre}enewsfeedbackf(f,fname,fform,fzs,myorder,ftype,flen,fformsize,fvalue) values('$add[f]','$add[fname]','$add[fform]','".eaddslashes($add[fzs])."',$add[myorder],'$add[ftype]','$add[flen]','$add[fformsize]','".eaddslashes2($add[fvalue])."');");
  392. $lastid=$empire->lastid();
  393. if($asql&&$sql)
  394. {
  395. //操作日志
  396. insert_dolog("fid=".$lastid."<br>f=".$add[f]);
  397. printerror("AddFSuccess","AddFeedbackF.php?enews=AddFeedbackF".hReturnEcmsHashStrHref2(0));
  398. }
  399. else
  400. {
  401. printerror("DbError","history.go(-1)");
  402. }
  403. }
  404. //修改反馈字段
  405. function EditFeedbackF($add,$userid,$username){
  406. global $empire,$dbtbpre;
  407. $fid=(int)$add['fid'];
  408. $add[f]=RepPostVar($add[f]);
  409. $add[oldf]=RepPostVar($add[oldf]);
  410. if(empty($add[f])||empty($add[fname])||!$fid)
  411. {printerror("EmptyF","history.go(-1)");}
  412. //验证权限
  413. //CheckLevel($userid,$username,$classid,"feedbackf");
  414. if($add[f]<>$add[oldf])
  415. {
  416. //字段是否重复
  417. $s=$empire->query("SHOW FIELDS FROM {$dbtbpre}enewsfeedback");
  418. $b=0;
  419. while($r=$empire->fetch($s))
  420. {
  421. if($r[Field]==$add[f])
  422. {
  423. $b=1;
  424. break;
  425. }
  426. }
  427. if($b)
  428. {printerror("ReF","history.go(-1)");}
  429. }
  430. $add[fvalue]=ReturnFBFvalue($add[fvalue]);//初始化值
  431. //字段类型
  432. if($add[ftype]=="TINYINT"||$add[ftype]=="SMALLINT"||$add[ftype]=="INT"||$add[ftype]=="BIGINT"||$add[ftype]=="FLOAT"||$add[ftype]=="DOUBLE")
  433. {
  434. $def=" default '0'";
  435. }
  436. elseif($add[ftype]=="VARCHAR")
  437. {
  438. $def=" default ''";
  439. }
  440. else
  441. {
  442. $def="";
  443. }
  444. $type=$add[ftype];
  445. //VARCHAR
  446. if($add[ftype]=='VARCHAR'&&empty($add[flen]))
  447. {
  448. $add[flen]='255';
  449. }
  450. //字段长度
  451. if($add[flen])
  452. {
  453. if($add[ftype]!="TEXT"&&$add[ftype]!="MEDIUMTEXT"&&$add[ftype]!="LONGTEXT")
  454. {
  455. $type.="(".$add[flen].")";
  456. }
  457. }
  458. $field="`".$add[f]."` ".$type." NOT NULL".$def;
  459. $usql=$empire->query("alter table {$dbtbpre}enewsfeedback change `".$add[oldf]."` ".$field);
  460. //处理变量
  461. $add[myorder]=(int)$add[myorder];
  462. $sql=$empire->query("update {$dbtbpre}enewsfeedbackf set f='$add[f]',fname='$add[fname]',fform='$add[fform]',fzs='".eaddslashes($add[fzs])."',myorder=$add[myorder],ftype='$add[ftype]',flen='$add[flen]',fformsize='$add[fformsize]',fvalue='".eaddslashes2($add[fvalue])."' where fid=$fid");
  463. //字段名更换
  464. if($add[f]<>$add[oldf])
  465. {
  466. $record="<!--record-->";
  467. $field="<!--field--->";
  468. $like=$field.$add[oldf].$record;
  469. $newlike=$field.$add[f].$record;
  470. $slike=",".$add[oldf].",";
  471. $newslike=",".$add[f].",";
  472. $csql=$empire->query("select bid,enter,mustenter,filef,checkboxf from {$dbtbpre}enewsfeedbackclass where enter like '%$like%'");
  473. while($cr=$empire->fetch($csql))
  474. {
  475. $setf="";
  476. if(strstr($cr['mustenter'],$slike))
  477. {
  478. $setf.=",mustenter=REPLACE(mustenter,'$slike','$newslike')";
  479. }
  480. if(strstr($cr['filef'],$slike))
  481. {
  482. $setf.=",filef=REPLACE(filef,'$slike','$newslike')";
  483. }
  484. if(strstr($cr['checkboxf'],$slike))
  485. {
  486. $setf.=",checkboxf=REPLACE(checkboxf,'$slike','$newslike')";
  487. }
  488. $cusql=$empire->query("update {$dbtbpre}enewsfeedbackclass set enter=REPLACE(enter,'$like','$newlike')".$setf." where bid='$cr[bid]'");
  489. }
  490. }
  491. if($usql&&$sql)
  492. {
  493. //操作日志
  494. insert_dolog("fid=".$fid."<br>f=".$add[f]);
  495. printerror("EditFSuccess","ListFeedbackF.php".hReturnEcmsHashStrHref2(1));
  496. }
  497. else
  498. {printerror("DbError","history.go(-1)");}
  499. }
  500. //删除反馈字段
  501. function DelFeedbackF($add,$userid,$username){
  502. global $empire,$dbtbpre;
  503. $fid=(int)$add['fid'];
  504. if(empty($fid))
  505. {printerror("EmptyFid","history.go(-1)");}
  506. //验证权限
  507. //CheckLevel($userid,$username,$classid,"feedbackf");
  508. $r=$empire->fetch1("select f from {$dbtbpre}enewsfeedbackf where fid=$fid");
  509. if(!$r[f])
  510. {
  511. printerror("EmptyFid","history.go(-1)");
  512. }
  513. if($r[f]=="title")
  514. {
  515. printerror("NotIsAdd","history.go(-1)");
  516. }
  517. $usql=$empire->query("alter table {$dbtbpre}enewsfeedback drop COLUMN `".$r[f]."`");
  518. $sql=$empire->query("delete from {$dbtbpre}enewsfeedbackf where fid=$fid");
  519. //更新分类表
  520. $record="<!--record-->";
  521. $field="<!--field--->";
  522. $like=$field.$r[f].$record;
  523. $slike=",".$r[f].",";
  524. $csql=$empire->query("select bid,enter,mustenter,filef,checkboxf from {$dbtbpre}enewsfeedbackclass where enter like '%$like%'");
  525. while($cr=$empire->fetch($csql))
  526. {
  527. $setf="";
  528. if(strstr($cr['mustenter'],$slike))
  529. {
  530. $setf.=",mustenter=REPLACE(mustenter,'$slike',',')";
  531. }
  532. if(strstr($cr['filef'],$slike))
  533. {
  534. $setf.=",filef=REPLACE(filef,'$slike',',')";
  535. }
  536. if(strstr($cr['checkboxf'],$slike))
  537. {
  538. $setf.=",checkboxf=REPLACE(checkboxf,'$slike',',')";
  539. }
  540. //录入项
  541. $enter="";
  542. $re1=explode($record,$cr[enter]);
  543. for($i=0;$i<count($re1)-1;$i++)
  544. {
  545. if(strstr($re1[$i].$record,$like))
  546. {continue;}
  547. $enter.=$re1[$i].$record;
  548. }
  549. $cusql=$empire->query("update {$dbtbpre}enewsfeedbackclass set enter='$enter'".$setf." where bid='$cr[bid]'");
  550. }
  551. if($usql&&$sql)
  552. {
  553. //操作日志
  554. insert_dolog("fid=".$fid."<br>f=".$r[f]);
  555. printerror("DelFSuccess","ListFeedbackF.php".hReturnEcmsHashStrHref2(1));
  556. }
  557. else
  558. {printerror("DbError","history.go(-1)");}
  559. }
  560. //修改反馈字段顺序
  561. function EditFeedbackFOrder($fid,$myorder,$userid,$username){
  562. global $empire,$dbtbpre;
  563. //验证权限
  564. //CheckLevel($userid,$username,$classid,"feedbackf");
  565. for($i=0;$i<count($myorder);$i++)
  566. {
  567. $newmyorder=(int)$myorder[$i];
  568. $fid[$i]=(int)$fid[$i];
  569. $usql=$empire->query("update {$dbtbpre}enewsfeedbackf set myorder=$newmyorder where fid='$fid[$i]'");
  570. }
  571. printerror("EditFOrderSuccess","ListFeedbackF.php".hReturnEcmsHashStrHref2(1));
  572. }
  573. //返回有权限的反馈分类
  574. function ReturnAdminFeedbackClass($bid,$userid,$username){
  575. global $empire,$dbtbpre;
  576. $bids='';
  577. $dh='';
  578. $select='';
  579. $no=0;
  580. $sql=$empire->query("select bid,bname from {$dbtbpre}enewsfeedbackclass where usernames='' or usernames like '%,".$username.",%'");
  581. while($r=$empire->fetch($sql))
  582. {
  583. $no++;
  584. $bids.=$dh.$r['bid'];
  585. $dh=',';
  586. if($bid==$r['bid'])
  587. {$selected=' selected';}
  588. else
  589. {$selected='';}
  590. $select.='<option value='.$r['bid'].$selected.'>'.$r['bname'].'</option>';
  591. }
  592. if(!$bids)
  593. {
  594. printerror('NotLevel','history.go(-1)');
  595. }
  596. if($bid&&!strstr(','.$bids.',',','.$bid.','))
  597. {
  598. printerror('NotLevel','history.go(-1)');
  599. }
  600. $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsfeedbackclass");
  601. $ret_r['allbid']=0;
  602. if($num==$no)
  603. {
  604. $ret_r['allbid']=1;
  605. }
  606. $ret_r['bids']=$bids;
  607. $ret_r['selects']=$select;
  608. return $ret_r;
  609. }
  610. //取得select/radio元素代码
  611. function GetBFFformSelect($type,$f,$fvalue,$fformsize=''){
  612. $vr=explode("|",$fvalue);
  613. $count=count($vr);
  614. $change="";
  615. $def=':default';
  616. for($i=0;$i<$count;$i++)
  617. {
  618. $val=$vr[$i];
  619. $isdef="";
  620. if(strstr($val,$def))
  621. {
  622. $dr=explode($def,$val);
  623. $val=$dr[0];
  624. $isdef=1;
  625. }
  626. if($type=='select')
  627. {
  628. $change.="<option value=\"".$val."\"".($isdef==1?' selected':'').">".$val."</option>";
  629. }
  630. elseif($type=='checkbox')
  631. {
  632. $change.="<input name=\"".$f."[]\" type=\"checkbox\" value=\"".$val."\"".($isdef==1?' checked':'').">".$val;
  633. }
  634. else
  635. {
  636. $change.="<input name=\"".$f."\" type=\"radio\" value=\"".$val."\"".($isdef==1?' checked':'').">".$val;
  637. }
  638. }
  639. if($type=="select")
  640. {
  641. if($fformsize)
  642. {
  643. $addsize=' style="width:'.$fformsize.'"';
  644. }
  645. $change="<select name=\"".$f."\" id=\"".$f."\"".$addsize.">".$change."</select>";
  646. }
  647. return $change;
  648. }
  649. //自动生成反馈表单
  650. function ReturnFeedbackBtemp($cname,$center,$mustenter){
  651. global $empire,$dbtbpre,$fun_r;
  652. //表单元素
  653. $temp="<tr><td width='16%' height=25 bgcolor='ffffff'>enews.name</td><td bgcolor='ffffff'>enews.var</td></tr>";
  654. for($i=0;$i<count($center);$i++)
  655. {
  656. $v=$center[$i];
  657. $fr=$empire->fetch1("select fform,fformsize,fvalue from {$dbtbpre}enewsfeedbackf where f='".RepPostVar($v)."' limit 1");
  658. if($fr['fform']=="file")
  659. {
  660. $fsize=$fr[fformsize]?" size='".$fr[fformsize]."'":"";
  661. $repform="<input type='file' name='".$v."'".$fsize.">";
  662. }
  663. elseif($fr['fform']=="textarea")
  664. {
  665. $fsr=explode(',',$fr[fformsize]);
  666. $cols=$fsr[0]?$fsr[0]:60;
  667. $rows=$fsr[1]?$fsr[1]:12;
  668. $repform="<textarea name='".$v."' cols='".$cols."' rows='".$rows."'>".$fr[fvalue]."</textarea>";
  669. }
  670. elseif($fr['fform']=="select"||$fr['fform']=="radio"||$fr['fform']=="checkbox")
  671. {
  672. $repform=GetBFFformSelect($fr['fform'],$v,$fr[fvalue],$fr[fformsize]);
  673. }
  674. else
  675. {
  676. $fsize=$fr[fformsize]?" size='".$fr[fformsize]."'":"";
  677. $repform="<input name='".$v."' type='text' value='".$fr[fvalue]."'".$fsize.">";
  678. }
  679. //必填
  680. $star="";
  681. if(strstr($mustenter,",".$v.","))
  682. {
  683. $star="(*)";
  684. }
  685. $data.=str_replace("enews.var",$repform.$star,str_replace("enews.name",$cname[$v],$temp));
  686. }
  687. return "[!--cp.header--]<table width=100% align=center cellpadding=3 cellspacing=1 bgcolor='#DBEAF5'><form name='feedback' method='post' enctype='multipart/form-data' action='../../enews/index.php'><input name='enews' type='hidden' value='AddFeedback'>".$data."<tr><td bgcolor='ffffff'></td><td bgcolor='ffffff'><input type='submit' name='submit' value='".$fun_r['onsubmit']."'></td></tr></form></table>[!--cp.footer--]";
  688. }
  689. //生成反馈表单文件
  690. function ReFeedbackClassFile($bid){
  691. global $empire,$dbtbpre;
  692. $bid=(int)$bid;
  693. $r=$empire->fetch1("select btemp from {$dbtbpre}enewsfeedbackclass where bid='$bid'");
  694. //替换公共变量
  695. $url="<?=\$url?>";
  696. $pagetitle="<?=\$bname?>";
  697. $btemp=ReplaceSvars($r['btemp'],$url,0,$pagetitle,$pagetitle,$pagetitle,$add,1);
  698. $btemp=str_replace("[!--cp.header--]","<? include(\"../../data/template/cp_1.php\");?>",$btemp);
  699. $btemp=str_replace("[!--cp.footer--]","<? include(\"../../data/template/cp_2.php\");?>",$btemp);
  700. $btemp=str_replace("[!--member.header--]","<? include(\"../../template/incfile/header.php\");?>",$btemp);
  701. $btemp=str_replace("[!--member.footer--]","<? include(\"../../template/incfile/footer.php\");?>",$btemp);
  702. $file=eReturnTrueEcmsPath()."e/tool/feedback/temp/feedback".$bid.".php";
  703. $btemp="<?
  704. if(!defined('InEmpireCMS'))
  705. {exit();}
  706. ?>".$btemp;
  707. WriteFiletext($file,$btemp);
  708. }
  709. //批量生成反馈表单文件
  710. function ReMoreFeedbackClassFile($start=0,$userid,$username){
  711. global $empire,$dbtbpre;
  712. //验证权限
  713. CheckLevel($userid,$username,$classid,"changedata");
  714. $sql=$empire->query("select bid from {$dbtbpre}enewsfeedbackclass order by bid");
  715. while($r=$empire->fetch($sql))
  716. {
  717. ReFeedbackClassFile($r['bid']);
  718. }
  719. printerror("ReMFeedbackFileSuccess","");
  720. }
  721. //组合投稿项
  722. function TogFBqenter($cname,$cqenter){
  723. $record="<!--record-->";
  724. $field="<!--field--->";
  725. $c="";
  726. for($i=0;$i<count($cqenter);$i++)
  727. {
  728. $v=$cqenter[$i];
  729. $name=str_replace($field,"",$cname[$v]);
  730. $name=str_replace($record,"",$name);
  731. $c.=$name.$field.$v.$record;
  732. }
  733. return $c;
  734. }
  735. //组合必填项
  736. function TogFBMustf($cname,$menter){
  737. $c="";
  738. for($i=0;$i<count($menter);$i++)
  739. {
  740. $v=$menter[$i];
  741. $c.=$v.",";
  742. }
  743. if($c)
  744. {
  745. $c=",".$c;
  746. }
  747. return $c;
  748. }
  749. //增加反馈分类
  750. function AddFeedbackClass($add,$userid,$username){
  751. global $empire,$dbtbpre;
  752. if(empty($add[bname]))
  753. {printerror("EmptyGbookClass","history.go(-1)");}
  754. //验证权限
  755. //CheckLevel($userid,$username,$classid,"feedbackf");
  756. $enter=TogFBqenter($add['cname'],$add['center']);
  757. $mustenter=TogFBMustf($add['cname'],$add['menter']);
  758. $filef=ReturnMFileF($enter,$dbtbpre."enewsfeedbackf",0,"file");
  759. $checkboxf=ReturnMFileF($enter,$dbtbpre."enewsfeedbackf",0,"checkbox");
  760. //自动生成表单
  761. if($add[btype])
  762. {
  763. $add[btemp]=ReturnFeedbackBtemp($add['cname'],$add['center'],$mustenter);
  764. }
  765. $groupid=(int)$add['groupid'];
  766. if($add['usernames'])
  767. {
  768. $add['usernames']=','.$add['usernames'].',';
  769. }
  770. $add['bname']=hRepPostStr($add['bname'],1);
  771. $enter=eaddslashes($enter);
  772. $mustenter=eaddslashes($mustenter);
  773. $filef=eaddslashes($filef);
  774. $checkboxf=eaddslashes($checkboxf);
  775. $add['usernames']=eaddslashes($add['usernames']);
  776. $sql=$empire->query("insert into {$dbtbpre}enewsfeedbackclass(bname,btemp,bzs,enter,mustenter,filef,groupid,checkboxf,usernames) values('$add[bname]','".eaddslashes2($add[btemp])."','".eaddslashes($add[bzs])."','$enter','$mustenter','$filef',$groupid,'$checkboxf','$add[usernames]');");
  777. $bid=$empire->lastid();
  778. //生成表单页面
  779. ReFeedbackClassFile($bid);
  780. if($sql)
  781. {
  782. //操作日志
  783. insert_dolog("bid=".$bid."<br>bname=".$add[bname]);
  784. printerror("AddGbookClassSuccess","AddFeedbackClass.php?enews=AddFeedbackClass".hReturnEcmsHashStrHref2(0));
  785. }
  786. else
  787. {printerror("DbError","history.go(-1)");}
  788. }
  789. //修改反馈分类
  790. function EditFeedbackClass($add,$userid,$username){
  791. global $empire,$dbtbpre;
  792. $bid=(int)$add['bid'];
  793. if(empty($add[bname])||!$bid)
  794. {printerror("EmptyGbookClass","history.go(-1)");}
  795. //验证权限
  796. //CheckLevel($userid,$username,$classid,"feedbackf");
  797. $enter=TogFBqenter($add['cname'],$add['center']);
  798. $mustenter=TogFBMustf($add['cname'],$add['menter']);
  799. $filef=ReturnMFileF($enter,$dbtbpre."enewsfeedbackf",0,"file");
  800. $checkboxf=ReturnMFileF($enter,$dbtbpre."enewsfeedbackf",0,"checkbox");
  801. //自动生成表单
  802. if($add[btype])
  803. {
  804. $add[btemp]=ReturnFeedbackBtemp($add['cname'],$add['center'],$mustenter);
  805. }
  806. $groupid=(int)$add['groupid'];
  807. if($add['usernames'])
  808. {
  809. $add['usernames']=','.$add['usernames'].',';
  810. }
  811. $add['bname']=hRepPostStr($add['bname'],1);
  812. $enter=eaddslashes($enter);
  813. $mustenter=eaddslashes($mustenter);
  814. $filef=eaddslashes($filef);
  815. $checkboxf=eaddslashes($checkboxf);
  816. $add['usernames']=eaddslashes($add['usernames']);
  817. $sql=$empire->query("update {$dbtbpre}enewsfeedbackclass set bname='$add[bname]',btemp='".eaddslashes2($add[btemp])."',bzs='".eaddslashes($add[bzs])."',enter='$enter',mustenter='$mustenter',filef='$filef',groupid=$groupid,checkboxf='$checkboxf',usernames='$add[usernames]' where bid=$bid");
  818. //生成表单页面
  819. ReFeedbackClassFile($bid);
  820. if($sql)
  821. {
  822. //操作日志
  823. insert_dolog("bid=".$bid."<br>bname=".$add[bname]);
  824. printerror("EditGbookClassSuccess","FeedbackClass.php".hReturnEcmsHashStrHref2(1));
  825. }
  826. else
  827. {printerror("DbError","history.go(-1)");}
  828. }
  829. //删除反馈分类
  830. function DelFeedbackClass($add,$userid,$username){
  831. global $empire,$dbtbpre;
  832. $bid=(int)$add['bid'];
  833. if(!$bid)
  834. {printerror("NotChangeGbookClassid","history.go(-1)");}
  835. //验证权限
  836. //CheckLevel($userid,$username,$classid,"feedbackf");
  837. $r=$empire->fetch1("select bid,bname from {$dbtbpre}enewsfeedbackclass where bid=$bid;");
  838. if(!$r['bid'])
  839. {printerror("NotChangeGbookClassid","history.go(-1)");}
  840. $sql=$empire->query("delete from {$dbtbpre}enewsfeedbackclass where bid=$bid;");
  841. //删除附件
  842. $fsql=$empire->query("select id,filepath,filename from {$dbtbpre}enewsfeedback where bid=$bid");
  843. while($fr=$empire->fetch($fsql))
  844. {
  845. DelFeedbackFile($fr['filename'],$fr['filepath']);
  846. }
  847. $sql1=$empire->query("delete from {$dbtbpre}enewsfeedback where bid=$bid;");
  848. //删除表单文件
  849. $file="../../tool/feedback/temp/feedback".$bid.".php";
  850. DelFiletext($file);
  851. if($sql)
  852. {
  853. //操作日志
  854. insert_dolog("bid=".$bid."<br>bname=".$r[bname]);
  855. printerror("DelGbookClassSuccess","FeedbackClass.php".hReturnEcmsHashStrHref2(1));
  856. }
  857. else
  858. {printerror("DbError","history.go(-1)");}
  859. }
  860. //删除短消息
  861. function DelMoreMsg($add,$userid,$username){
  862. global $empire,$dbtbpre;
  863. $starttime=RepPostVar($add['starttime']);
  864. $endtime=RepPostVar($add['endtime']);
  865. if(!$starttime||!$endtime)
  866. {
  867. printerror("EmptyDelMoreMsg","history.go(-1)");
  868. }
  869. //信箱类型
  870. $msgtype=(int)$add['msgtype'];
  871. if($msgtype==1)//后台
  872. {
  873. $a='';
  874. $tbname="{$dbtbpre}enewshmsg";
  875. }
  876. elseif($msgtype==2)//前台系统消息
  877. {
  878. $a=' and issys=1';
  879. $tbname="{$dbtbpre}enewsqmsg";
  880. }
  881. elseif($msgtype==3)//后台系统消息
  882. {
  883. $a=' and issys=1';
  884. $tbname="{$dbtbpre}enewshmsg";
  885. }
  886. else//前台
  887. {
  888. $a='';
  889. $tbname="{$dbtbpre}enewsqmsg";
  890. }
  891. //发件人
  892. $from_username=RepPostVar($add['from_username']);
  893. if($from_username)
  894. {
  895. if($add['fromlike']==1)
  896. {
  897. $a.=" and from_username like '%$from_username%'";
  898. }
  899. else
  900. {
  901. $a.=" and from_username='$from_username'";
  902. }
  903. }
  904. $to_username=RepPostVar($add['to_username']);
  905. if($to_username)
  906. {
  907. if($add['tolike']==1)
  908. {
  909. $a.=" and to_username like '%$to_username%'";
  910. }
  911. else
  912. {
  913. $a.=" and to_username='$to_username'";
  914. }
  915. }
  916. //关键字
  917. $keyboard=RepPostVar2($add['keyboard']);
  918. if(trim($keyboard))
  919. {
  920. //检索字段
  921. $keyfield=(int)$add['keyfield'];
  922. if($keyfield==1)
  923. {
  924. $likef="title like '%[!--key--]%'";
  925. }
  926. elseif($keyfield==2)
  927. {
  928. $likef="msgtext like '%[!--key--]%'";
  929. }
  930. else
  931. {
  932. $likef="title like '%[!--key--]%' or msgtext like '%[!--key--]%'";
  933. }
  934. $r=explode(",",$keyboard);
  935. $likekey="";
  936. $count=count($r);
  937. for($i=0;$i<$count;$i++)
  938. {
  939. if($i==0)
  940. {
  941. $or="";
  942. }
  943. else
  944. {
  945. $or=" or ";
  946. }
  947. $likekey.=$or.str_replace("[!--key--]",$r[$i],$likef);
  948. }
  949. $a.=" and (".$likekey.")";
  950. }
  951. $sql=$empire->query("delete from ".$tbname." where msgtime>'$starttime' and msgtime<'$endtime'".$a);
  952. if($sql)
  953. {
  954. //操作日志
  955. insert_dolog("starttime=$starttime&endtime=$endtime<br>msgtype=$msgtype");
  956. printerror("DelMoreMsgSuccess","DelMoreMsg.php".hReturnEcmsHashStrHref2(1));
  957. }
  958. else
  959. {printerror("DbError","history.go(-1)");}
  960. }
  961. //返回会员组
  962. function ReturnSendMemberGroup($r){
  963. global $public_r,$ecms_config;
  964. $user_groupid=eReturnMemberDefGroupid();
  965. $count=count($r);
  966. if($count==0)
  967. {
  968. printerror("EmptySendMemberGroup","");
  969. }
  970. for($i=0;$i<$count;$i++)
  971. {
  972. $r[$i]=(int)$r[$i];
  973. if($i==0)
  974. {
  975. $or="";
  976. }
  977. else
  978. {
  979. $or=" or ";
  980. }
  981. $a.=$or.egetmf('groupid')."='".$r[$i]."'";
  982. if($user_groupid==$r[$i])
  983. {
  984. $a.=" or ".egetmf('groupid')."=0";
  985. }
  986. $checkbox.="<input type=hidden name='groupid[]' value='".$r[$i]."'>";
  987. }
  988. $re[0]="(".$a.")";
  989. $re[1]=$checkbox;
  990. return $re;
  991. }
  992. //返回会员用户名
  993. function ReturnSendMemberUsername($username){
  994. $r=explode('|',$username);
  995. $count=count($r);
  996. for($i=0;$i<$count;$i++)
  997. {
  998. $r[$i]=RepPostVar($r[$i]);
  999. if($i==0)
  1000. {
  1001. $or="";
  1002. }
  1003. else
  1004. {
  1005. $or=" or ";
  1006. }
  1007. $a.=$or.egetmf('username')."='".$r[$i]."'";
  1008. }
  1009. $re[0]="(".$a.")";
  1010. $re[1]='<input type=hidden name="username" value="'.ClearAddsData($username).'">';
  1011. return $re;
  1012. }
  1013. //批量发送站内信息
  1014. function DoSendMsg($add,$ecms=0,$userid,$username){
  1015. global $empire,$dbtbpre;
  1016. $start=(int)$add['start'];
  1017. $line=(int)$add['line'];
  1018. $title=ClearAddsData($add['title']);
  1019. $msgtext=ClearAddsData($add['msgtext']);
  1020. if(empty($title)||empty($msgtext))
  1021. {printerror("EmptySendMsg","history.go(-1)");}
  1022. if($ecms==1)//发送邮件
  1023. {
  1024. $enews="SendEmail";
  1025. $mess="SendEmailSuccess";
  1026. $returnurl="SendEmail.php";
  1027. $pr=$empire->fetch1("select sendmailtype,smtphost,fromemail,loginemail,emailusername,emailpassword,smtpport,emailname from {$dbtbpre}enewspublic limit 1");
  1028. //发送初使化
  1029. $mailer=FirstSendMail($pr,$title,$msgtext);
  1030. }
  1031. else//发送短消息
  1032. {
  1033. $enews="SendMsg";
  1034. $mess="SendMsgSuccess";
  1035. $returnurl="SendMsg.php";
  1036. }
  1037. if($add['username'])//用户名
  1038. {
  1039. $gr=ReturnSendMemberUsername($add['username']);
  1040. }
  1041. else//会员组
  1042. {
  1043. $gr=ReturnSendMemberGroup($add['groupid']);
  1044. }
  1045. $a=" and ".$gr[0];
  1046. $b=0;
  1047. $msgtime=date("Y-m-d H:i:s");
  1048. $sql=$empire->query("select ".eReturnSelectMemberF('userid,username,havemsg,groupid,email')." from ".eReturnMemberTable()." where ".egetmf('userid').">$start".$a." order by ".egetmf('userid')." limit ".$line);
  1049. while($r=$empire->fetch($sql))
  1050. {
  1051. $b=1;
  1052. $newstart=$r['userid'];
  1053. $r['email']=RepPostVar($r['email']);
  1054. if($ecms==1)
  1055. {
  1056. $mailer->AddAddress($r['email']);
  1057. }
  1058. else
  1059. {
  1060. $ititle=str_replace("[!--username--]",$r['username'],$title);
  1061. $imsgtext=str_replace("[!--username--]",$r['username'],$msgtext);
  1062. SendSiteMsg($ititle,$imsgtext,$msgtime,$r['userid'],$r['username'],$r['havemsg']);
  1063. }
  1064. }
  1065. if(empty($b))
  1066. {
  1067. //操作日志
  1068. insert_dolog("title=$title");
  1069. printerror($mess,$returnurl.hReturnEcmsHashStrHref2(1));
  1070. }
  1071. if($ecms==1)
  1072. {
  1073. if(!$mailer->Send())
  1074. {
  1075. echo $mailer->ErrorInfo;
  1076. }
  1077. }
  1078. //输出下一组提交表单
  1079. EchoSendMsgForm($enews,$returnurl,$newstart,$line,$gr[1],$add);
  1080. }
  1081. //输出一组提交表单
  1082. function EchoSendMsgForm($enews,$returnurl,$start,$line,$checkbox,$add){
  1083. global $fun_r;
  1084. ?>
  1085. <?=$fun_r['OneSendMsg']?>(<b><font color=red><?=$start?></font></b>)
  1086. <form name="sendform" method="post" action="<?=$returnurl?>">
  1087. <?=hReturnEcmsHashStrForm(0)?>
  1088. <input type=hidden name="enews" value="<?=$enews?>">
  1089. <input type=hidden name="start" value="<?=$start?>">
  1090. <input type=hidden name="line" value="<?=$line?>">
  1091. <?=$checkbox?>
  1092. <input type=hidden name="title" value="<?=ehtmlspecialchars($add[title])?>">
  1093. <input type=hidden name="msgtext" value="<?=ehtmlspecialchars($add[msgtext])?>">
  1094. </form>
  1095. <script>
  1096. document.sendform.submit();
  1097. </script>
  1098. <?
  1099. exit();
  1100. }
  1101. //发送站内短消息
  1102. function SendSiteMsg($title,$msgtext,$msgtime,$userid,$username,$havemsg){
  1103. global $empire,$dbtbpre;
  1104. $userid=(int)$userid;
  1105. $isql=$empire->query("insert into {$dbtbpre}enewsqmsg(title,msgtext,haveread,msgtime,to_username,from_userid,from_username,isadmin,issys) values('".addslashes($title)."','".addslashes($msgtext)."',0,'".addslashes($msgtime)."','".addslashes($username)."',0,'',1,1);");
  1106. if(!$havemsg)
  1107. {
  1108. $newhavemsg=eReturnSetHavemsg($havemsg,0);
  1109. $newhavemsg=(int)$newhavemsg;
  1110. $usql=$empire->query("update ".eReturnMemberTable()." set ".egetmf('havemsg')."='$newhavemsg' where ".egetmf('userid')."='".$userid."' limit 1");
  1111. }
  1112. }
  1113. ?>