PageRenderTime 62ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/php/xuzhou58/xuzhou58.com/dede/archives_do.php

http://jqbird.googlecode.com/
PHP | 1032 lines | 914 code | 24 blank | 94 comment | 142 complexity | 42e977775790fe9cb97b3cf2b17bffad MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0, LGPL-2.1, GPL-2.0
  1. <?php
  2. require_once(dirname(__FILE__).'/config.php');
  3. require_once(DEDEADMIN.'/inc/inc_batchup.php');
  4. require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
  5. require_once(DEDEINC.'/typelink.class.php');
  6. require_once(DEDEINC.'/arc.archives.class.php');
  7. $ENV_GOBACK_URL = (empty($_COOKIE['ENV_GOBACK_URL']) ? 'content_list.php' : $_COOKIE['ENV_GOBACK_URL']);
  8. if(empty($dopost))
  9. {
  10. ShowMsg('?????????????','-1');
  11. exit();
  12. }
  13. $aid = isset($aid) ? ereg_replace('[^0-9]','',$aid) : '';
  14. /*--------------------------
  15. //????
  16. function editArchives(){ }
  17. ---------------------------*/
  18. if($dopost=='editArchives')
  19. {
  20. $query = "Select arc.id,arc.typeid,ch.maintable,ch.editcon
  21. From `#@__arctiny` arc
  22. left join `#@__arctype` tp on tp.id=arc.typeid
  23. left join `#@__channeltype` ch on ch.id=arc.channel
  24. where arc.id='$aid' ";
  25. $row = $dsql->GetOne($query);
  26. $gurl = $row['editcon'];
  27. if($gurl=='')
  28. {
  29. $gurl='article_edit.php';
  30. }
  31. header("location:{$gurl}?aid=$aid");
  32. exit();
  33. }
  34. /*--------------------------
  35. //????
  36. function viewArchives(){ }
  37. ---------------------------*/
  38. else if($dopost=="viewArchives")
  39. {
  40. $aid = ereg_replace('[^0-9]','',$aid);
  41. //??????
  42. $query = "Select arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,
  43. tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
  44. From `#@__arctiny` arc
  45. left join `#@__arctype` tp on tp.id=arc.typeid
  46. left join `#@__channeltype` ch on ch.id=tp.channeltype
  47. where arc.id='$aid' ";
  48. $trow = $dsql->GetOne($query);
  49. $trow['maintable'] = ( trim($trow['maintable'])=='' ? '#@__archives' : trim($trow['maintable']) );
  50. if($trow['issystem'] != -1)
  51. {
  52. $arcQuery = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl
  53. from `{$trow['maintable']}` arc left join `#@__arctype` tp on arc.typeid=tp.id
  54. left join `#@__channeltype` ch on ch.id=arc.channel where arc.id='$aid' ";
  55. $arcRow = $dsql->GetOne($arcQuery);
  56. if($arcRow['ismake']==-1 || $arcRow['corank']!=0 || $arcRow['arcrank']!=0 || ($arcRow['typeid']==0 && $arcRow['channel']!=-1) || $arcRow['money']>0)
  57. {
  58. echo "<script language='javascript'>location.href='{$cfg_phpurl}/view.php?aid={$aid}';</script>";
  59. exit();
  60. }
  61. }
  62. else
  63. {
  64. $arcRow['id'] = $aid;
  65. $arcRow['typeid'] = $trow['typeid'];
  66. $arcRow['senddate'] = $trow['senddate'];
  67. $arcRow['title'] = '';
  68. $arcRow['ismake'] = 1;
  69. $arcRow['arcrank'] = $trow['corank'];
  70. $arcRow['namerule'] = $trow['namerule'];
  71. $arcRow['typedir'] = $trow['typedir'];
  72. $arcRow['money'] = 0;
  73. $arcRow['filename'] = '';
  74. $arcRow['moresite'] = $trow['moresite'];
  75. $arcRow['siteurl'] = $trow['siteurl'];
  76. $arcRow['sitepath'] = $trow['sitepath'];
  77. }
  78. $arcurl = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],$arcRow['arcrank'],
  79. $arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);
  80. $arcfile = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],
  81. $arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']);
  82. if(eregi('^http:',$arcfile))
  83. {
  84. $arcfile = eregi_replace("^http://([^/]*)/",'/',$arcfile);
  85. }
  86. $truefile = GetTruePath().$arcfile;
  87. if(!file_exists($truefile))
  88. {
  89. MakeArt($aid,true);
  90. }
  91. echo "<script language='javascript'>location.href='$arcurl"."?".time()."';</script>";
  92. exit();
  93. }
  94. /*--------------------------
  95. //???????
  96. function uploadLitpic(){ }
  97. ---------------------------*/
  98. else if($dopost=="uploadLitpic")
  99. {
  100. $upfile = AdminUpload('litpic', 'imagelit', 0, false );
  101. if($upfile=='-1')
  102. {
  103. $msg = "<script language='javascript'>
  104. parent.document.getElementById('uploadwait').style.display = 'none';
  105. alert('????????????????????');
  106. </script>";
  107. }
  108. else if($upfile=='-2')
  109. {
  110. $msg = "<script language='javascript'>
  111. parent.document.getElementById('uploadwait').style.display = 'none';
  112. alert('?????????????');
  113. </script>";
  114. }
  115. else if($upfile=='0')
  116. {
  117. $msg = "<script language='javascript'>
  118. parent.document.getElementById('uploadwait').style.display = 'none';
  119. alert('????????');
  120. </script>";
  121. }
  122. else
  123. {
  124. if(!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut=='N')
  125. {
  126. $msg = "<script language='javascript'>
  127. parent.document.getElementById('uploadwait').style.display = 'none';
  128. parent.document.getElementById('picname').value = '{$upfile}';
  129. if(parent.document.getElementById('divpicview'))
  130. {
  131. parent.document.getElementById('divpicview').style.width = '150px';
  132. parent.document.getElementById('divpicview').innerHTML = \"<img src='{$upfile}?n' width='150' />\";
  133. }
  134. </script>";
  135. }
  136. else
  137. {
  138. $msg = "<script language='javascript'>
  139. parent.document.getElementById('uploadwait').style.display = 'none';
  140. window.open('imagecut.php?f=picname&isupload=yes&file={$upfile}', 'popUpImagesWin', 'scrollbars=yes,resizable=yes,statebar=no,width=800,height=600,left=150, top=50');
  141. </script>";
  142. }
  143. }
  144. echo $msg;
  145. exit();
  146. }
  147. /*--------------------------
  148. //????
  149. function commendArchives(){ }
  150. ---------------------------*/
  151. else if($dopost=="commendArchives")
  152. {
  153. CheckPurview('a_Commend,sys_ArcBatch');
  154. if( !empty($aid) && empty($qstr) )
  155. {
  156. $qstr = $aid;
  157. }
  158. if($qstr=='')
  159. {
  160. ShowMsg("?????",$ENV_GOBACK_URL);
  161. exit();
  162. }
  163. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));
  164. $query = "Select arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable From `#@__arctiny` arc
  165. left join `#@__arctype` tp on tp.id=arc.typeid
  166. left join `#@__channeltype` ch on ch.id=tp.channeltype
  167. where arc.id in($arcids) ";
  168. $dsql->SetQuery($query);
  169. $dsql->Execute();
  170. while($row = $dsql->GetArray())
  171. {
  172. $aid = $row['id'];
  173. if($row['issystem']!=-1)
  174. {
  175. $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
  176. $arr = $dsql->GetOne("Select flag From `{$maintable}` where id='$aid' ");
  177. $flag = ($arr['flag']=='' ? 'c' : $arr['flag'].',c');
  178. $dsql->ExecuteNoneQuery(" Update `{$maintable}` set `flag`='$flag' where id='{$aid}' ");
  179. }
  180. else
  181. {
  182. $maintable = trim($row['addtable']);
  183. $arr = $dsql->GetOne("Select flag From `{$maintable}` where aid='$aid' ");
  184. $flag = ($arr['flag']=='' ? 'c' : $arr['flag'].',c');
  185. $dsql->ExecuteNoneQuery(" Update `{$maintable}` set `flag`='$flag' where aid='{$aid}' ");
  186. }
  187. }
  188. ShowMsg("?????????????",$ENV_GOBACK_URL);
  189. exit();
  190. }
  191. /*--------------------------
  192. //??HTML
  193. function makeArchives();
  194. ---------------------------*/
  195. else if($dopost=="makeArchives")
  196. {
  197. CheckPurview('sys_MakeHtml,sys_ArcBatch');
  198. if( !empty($aid) && empty($qstr) )
  199. {
  200. $qstr = $aid;
  201. }
  202. if($qstr=='')
  203. {
  204. ShowMsg('?????',$ENV_GOBACK_URL);
  205. exit();
  206. }
  207. require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
  208. $qstrs = explode('`',$qstr);
  209. $i = 0;
  210. foreach($qstrs as $aid)
  211. {
  212. $i++;
  213. $pageurl = MakeArt($aid,false);
  214. }
  215. ShowMsg("?????? $i ???...",$ENV_GOBACK_URL);
  216. exit();
  217. }
  218. /*--------------------------
  219. //????
  220. function checkArchives() { }
  221. ---------------------------*/
  222. else if($dopost=="checkArchives")
  223. {
  224. CheckPurview('a_Check,a_AccCheck,sys_ArcBatch');
  225. require_once(DEDEADMIN."/inc/inc_archives_functions.php");
  226. if( !empty($aid) && empty($qstr) )
  227. {
  228. $qstr = $aid;
  229. }
  230. if($qstr=='')
  231. {
  232. ShowMsg("?????",$ENV_GOBACK_URL);
  233. exit();
  234. }
  235. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));
  236. $query = "Select arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable From `#@__arctiny` arc
  237. left join `#@__arctype` tp on tp.id=arc.typeid
  238. left join `#@__channeltype` ch on ch.id=tp.channeltype
  239. where arc.id in($arcids) ";
  240. $dsql->SetQuery($query);
  241. $dsql->Execute('ckall');
  242. while($row = $dsql->GetArray('ckall'))
  243. {
  244. $aid = $row['id'];
  245. //print_r($row);
  246. $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
  247. $dsql->ExecuteNoneQuery("Update `#@__arctiny` set arcrank='0' where id='$aid' ");
  248. if($row['issystem']==-1)
  249. {
  250. $dsql->ExecuteNoneQuery("Update `".trim($row['addtable'])."` set arcrank='0' where aid='$aid' ");
  251. }
  252. else
  253. {
  254. $dsql->ExecuteNoneQuery("Update `$maintable` set arcrank='0', dutyadmin='".$cuserLogin->getUserID()."' where id='$aid' ");
  255. }
  256. $pageurl = MakeArt($aid,false);
  257. }
  258. ShowMsg("??????????",$ENV_GOBACK_URL);
  259. exit();
  260. }
  261. /*--------------------------
  262. //????
  263. function delArchives(){ }
  264. ---------------------------*/
  265. else if($dopost=="delArchives")
  266. {
  267. CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
  268. require_once(DEDEINC."/oxwindow.class.php");
  269. if(empty($fmdo))
  270. {
  271. $fmdo = '';
  272. }
  273. //????????
  274. if($fmdo=='yes')
  275. {
  276. if( !empty($aid) && empty($qstr) )
  277. {
  278. $qstr = $aid;
  279. }
  280. if($qstr=='')
  281. {
  282. ShowMsg("?????",$ENV_GOBACK_URL);
  283. exit();
  284. }
  285. $qstrs = explode("`",$qstr);
  286. $okaids = Array();
  287. foreach($qstrs as $aid)
  288. {
  289. if(!isset($okaids[$aid]))
  290. {
  291. DelArc($aid);
  292. }
  293. else
  294. {
  295. $okaids[$aid] = 1;
  296. }
  297. }
  298. ShowMsg("??????????",$ENV_GOBACK_URL);
  299. exit();
  300. }
  301. //??????
  302. else
  303. {
  304. $wintitle = "????-????";
  305. $wecome_info = "<a href='".$ENV_GOBACK_URL."'>????</a>::????";
  306. $win = new OxWindow();
  307. $win->Init("archives_do.php","js/blank.js","POST");
  308. $win->AddHidden("fmdo","yes");
  309. $win->AddHidden("dopost",$dopost);
  310. $win->AddHidden("qstr",$qstr);
  311. $win->AddHidden("aid",$aid);
  312. $win->AddTitle("??????“ $qstr ? $aid ”?????");
  313. $winform = $win->GetWindow("ok");
  314. $win->Display();
  315. }
  316. }
  317. /*-----------------------------
  318. function moveArchives(){ }
  319. ------------------------------*/
  320. else if($dopost=='moveArchives')
  321. {
  322. CheckPurview('sys_ArcBatch');
  323. if(empty($totype))
  324. {
  325. require_once(DEDEINC.'/typelink.class.php');
  326. if( !empty($aid) && empty($qstr) )
  327. {
  328. $qstr = $aid;
  329. }
  330. AjaxHead();
  331. $channelid = empty($channelid) ? 0 : $channelid;
  332. $tl = new TypeLink($aid);
  333. $typeOptions = $tl->GetOptionArray(0, $admin_catalogs, $channelid);
  334. $typeOptions = "<select name='totype' style='width:90%'>
  335. <option value='0'>?????????...</option>\r\n
  336. $typeOptions
  337. </select>";
  338. //??AJAX?????
  339. $divname = 'moveArchives';
  340. echo "<div class='title' onmousemove=\"DropMoveHand('{$divname}', 225);\" onmousedown=\"DropStartHand();\" onmouseup=\"DropStopHand();\">\r\n";
  341. echo " <div class='titLeft'>????</div>\r\n";
  342. echo " <div class='titRight'><img src='img/ico-close.gif' style='cursor:pointer;' onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='??' title='??' /></div>\r\n";
  343. echo "</div>\r\n";
  344. echo "<form name='quickeditform' action='archives_do.php' method='post'>\r\n";
  345. echo "<input type='hidden' name='dopost' value='{$dopost}' />\r\n";
  346. echo "<input type='hidden' name='qstr' value='{$qstr}' />\r\n";
  347. echo "<table width='100%' style='margin-top:6px;z-index:9000;'>\r\n";
  348. ?>
  349. <tr height='28'>
  350. <td width="80" class='bline'>&nbsp;?????</td>
  351. <td class='bline'>
  352. <?php echo $typeOptions; ?>
  353. </td>
  354. </tr>
  355. <tr height='32'>
  356. <td width="80" class='bline'>&nbsp;??ID?</td>
  357. <td class='bline'>
  358. <input type='text' name='tmpids' value="<?php echo $qstr; ?>" style='width:310px;overflow:hidden;' />
  359. <br />
  360. ???????????????????????????????????????
  361. </td>
  362. </tr>
  363. <tr height='32'>
  364. <td colspan='2' align='center' style='padding-top:12px'>
  365. <input name="imageField" type="image" src="img/button_ok.gif" width="60" height="22" class="np" border="0" style="cursor:pointer" />
  366. &nbsp;&nbsp;
  367. <img src="img/button_back.gif" width="60" height="22" border="0" onclick='HideObj("<?php echo $divname; ?>");ChangeFullDiv("hide");' style="cursor:pointer" />
  368. </td>
  369. </td>
  370. </tr>
  371. </table>
  372. </form>
  373. <?php
  374. //AJAX????
  375. }
  376. else
  377. {
  378. $totype = ereg_replace('[^0-9]','',$totype);
  379. $typeInfos = $dsql->GetOne("Select tp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystem From `#@__arctype` tp left join `#@__channeltype` ch on ch.id=tp.channeltype where tp.id='$totype' ");
  380. $idtype = "id";
  381. if(!is_array($typeInfos))
  382. {
  383. ShowMsg('?????','-1');
  384. exit();
  385. }
  386. if($typeInfos['ispart']!=0)
  387. {
  388. ShowMsg('?????????????????','-1');
  389. exit();
  390. }
  391. if(empty($typeInfos['addtable']))
  392. {
  393. $typeInfos['maintable'] = '#@__archives';
  394. }
  395. //????????
  396. if($typeInfos['issystem'] == -1)
  397. {
  398. $typeInfos['maintable'] = $typeInfos['addtable'];
  399. $idtype = "aid";
  400. }
  401. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));
  402. $arc = '';
  403. $j = 0;
  404. $okids = array();
  405. $dsql->SetQuery("Select {$idtype},typeid From `{$typeInfos['maintable']}` where {$idtype} in($arcids) And channel='{$typeInfos['channeltype']}' ");
  406. $dsql->Execute();
  407. while($row = $dsql->GetArray())
  408. {
  409. if($row['typeid']!=$totype)
  410. {
  411. $dsql->ExecuteNoneQuery("Update `#@__arctiny` Set typeid='$totype' where id='{$row[$idtype]}' ");
  412. $dsql->ExecuteNoneQuery("Update `{$typeInfos['maintable']}` Set typeid='$totype' where id='{$row[$idtype]}' ");
  413. $dsql->ExecuteNoneQuery("Update `{$typeInfos['addtable']}` Set typeid='$totype' where aid='{$row[$idtype]}' ");
  414. $okids[] = $row[$idtype];
  415. $j++;
  416. }
  417. }
  418. //??HTML
  419. foreach($okids as $aid)
  420. {
  421. $arc = new Archives($aid);
  422. $arc->MakeHtml();
  423. }
  424. ShowMsg("???? $j ????", $ENV_GOBACK_URL);
  425. exit();
  426. }
  427. }
  428. /*-----------------------------
  429. //????
  430. function RbReturnArchives(){ }
  431. ------------------------------*/
  432. else if($dopost=='return')
  433. {
  434. CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
  435. require_once(DEDEINC."/oxwindow.class.php");
  436. if( !empty($aid) && empty($qstr) )
  437. {
  438. $qstr = $aid;
  439. }
  440. if($qstr=='')
  441. {
  442. ShowMsg("?????","recycling.php");
  443. exit();
  444. }
  445. $qstrs = explode("`",$qstr);
  446. foreach($qstrs as $aid)
  447. {
  448. $dsql->ExecuteNoneQuery("Update `#@__archives` set arcrank='-1',ismake='0' where id='$aid'");
  449. $dsql->ExecuteNoneQuery("Update `#@__arctiny` set `arcrank` = '-1' where id = '$aid'; ");
  450. }
  451. ShowMsg("??????????","recycling.php");
  452. exit();
  453. }
  454. /*-----------------------------
  455. //????
  456. function RbClearArchives(){ }
  457. ------------------------------*/
  458. else if($dopost=='clear')
  459. {
  460. CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
  461. require_once(DEDEINC."/oxwindow.class.php");
  462. if(empty($fmdo))
  463. {
  464. $fmdo = '';
  465. }
  466. //????????
  467. if($fmdo=='yes')
  468. {
  469. if( !empty($aid) && empty($qstr) )
  470. {
  471. $qstr = $aid;
  472. }
  473. if($qstr=='')
  474. {
  475. ShowMsg("?????","recycling.php");
  476. exit();
  477. }
  478. $qstrs = explode(",",$qstr);
  479. $okaids = Array();
  480. foreach($qstrs as $aid)
  481. {
  482. if(!isset($okaids[$aid]))
  483. {
  484. DelArc($aid,"OK");
  485. }
  486. else
  487. {
  488. $okaids[$aid] = 1;
  489. }
  490. }
  491. ShowMsg("??????????","recycling.php");
  492. exit();
  493. }
  494. else
  495. {
  496. $dsql->SetQuery("SELECT id FROM `#@__archives` WHERE `arcrank` = '-2'");
  497. $dsql->Execute();
  498. $qstr = '';
  499. while($row = $dsql->GetArray())
  500. {
  501. $qstr .= $row['id'].",";
  502. $aid = $row['id'];
  503. }
  504. $num = $dsql->GetTotalRow();
  505. if(empty($num))
  506. {
  507. ShowMsg("????????????","recycling.php");
  508. exit();
  509. }
  510. $wintitle = "????-??????";
  511. $wecome_info = "<a href='recycling.php'>?????</a>::??????";
  512. $win = new OxWindow();
  513. $win->Init("archives_do.php","js/blank.js","POST");
  514. $win->AddHidden("fmdo","yes");
  515. $win->AddHidden("dopost",$dopost);
  516. $win->AddHidden("qstr",$qstr);
  517. $win->AddHidden("aid",$aid);
  518. $win->AddTitle("??????????<font color='#FF0000'>??? $num ???</font><br>????????“ $qstr ”?????");
  519. $winform = $win->GetWindow("ok");
  520. $win->Display();
  521. }
  522. }
  523. /*-----------------------------
  524. //????
  525. function RbDelArchives(){ }
  526. ------------------------------*/
  527. else if($dopost=='del')
  528. {
  529. CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch');
  530. require_once(DEDEINC."/oxwindow.class.php");
  531. if(empty($fmdo))
  532. {
  533. $fmdo = '';
  534. }
  535. //????????
  536. if($fmdo=='yes')
  537. {
  538. if( !empty($aid) && empty($qstr) )
  539. {
  540. $qstr = $aid;
  541. }
  542. if($qstr=='')
  543. {
  544. ShowMsg("?????","recycling.php");
  545. exit();
  546. }
  547. $qstrs = explode("`",$qstr);
  548. $okaids = Array();
  549. foreach($qstrs as $aid)
  550. {
  551. if(!isset($okaids[$aid]))
  552. {
  553. DelArc($aid,"OK");
  554. }
  555. else
  556. {
  557. $okaids[$aid] = 1;
  558. }
  559. }
  560. ShowMsg("??????????","recycling.php");
  561. exit();
  562. }
  563. //??????
  564. else
  565. {
  566. $wintitle = "????-????";
  567. $wecome_info = "<a href='recycling.php'>????</a>::????";
  568. $win = new OxWindow();
  569. $win->Init("archives_do.php","js/blank.js","POST");
  570. $win->AddHidden("fmdo","yes");
  571. $win->AddHidden("dopost",$dopost);
  572. $win->AddHidden("qstr",$qstr);
  573. $win->AddHidden("aid",$aid);
  574. $win->AddTitle("????????“ $qstr ? $aid ”?????");
  575. $winform = $win->GetWindow("ok");
  576. $win->Display();
  577. }
  578. }
  579. /*-----------------------------
  580. //????
  581. function quickEdit(){ }
  582. ------------------------------*/
  583. else if($dopost=='quickEdit')
  584. {
  585. require_once(DEDEADMIN."/inc/inc_catalog_options.php");
  586. AjaxHead();
  587. $query = "Select ch.typename as channelname,ch.addtable,ar.membername as rankname,arc.*
  588. From `#@__archives` arc
  589. left join `#@__channeltype` ch on ch.id=arc.channel
  590. left join `#@__arcrank` ar on ar.rank=arc.arcrank where arc.id='$aid' ";
  591. $arcRow = $dsql->GetOne($query);
  592. //??AJAX?????
  593. $divname = 'quickEdit';
  594. echo "<div class='title' onmousemove=\"DropMoveHand('{$divname}', 225);\" onmousedown=\"DropStartHand();\" onmouseup=\"DropStopHand();\">\r\n";
  595. echo " <div class='titLeft'>??????</div>\r\n";
  596. echo " <div class='titRight'><img src='img/ico-close.gif' style='cursor:pointer;' onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='??' title='??' /></div>\r\n";
  597. echo "</div>\r\n";
  598. echo "<form name='quickeditform' action='archives_do.php?dopost=quickEditSave&aid={$aid}' method='post'>\r\n";
  599. echo "<input type='hidden' name='addtable' value='{$arcRow['addtable']}' />\r\n";
  600. echo "<input type='hidden' name='oldtypeid' value='{$arcRow['typeid']}' />\r\n";
  601. echo "<table width='100%' style='margin-top:6px;z-index:9000;'>\r\n";
  602. ?>
  603. <tr height='32'>
  604. <td width="80" class='bline'>&nbsp;?????</td>
  605. <td class='bline'>
  606. <?php
  607. $typeOptions = GetOptionList($arcRow['typeid'],$cuserLogin->getUserChannel(), $arcRow['channel']);
  608. echo "<select name='typeid' style='width:70%'>\r\n";
  609. if($arcRow["typeid"]=="0") echo "<option value='0' selected>?????...</option>\r\n";
  610. echo $typeOptions;
  611. echo "</select>";
  612. ?>
  613. </td>
  614. </tr>
  615. <tr height='28'>
  616. <td width="80" class='bline'>&nbsp;? ??</td>
  617. <td class='bline'>
  618. <input type='hidden' name='oldflag' value='<?php echo $arcRow['flag']; ?>' />
  619. <?php
  620. $dsql->SetQuery("Select * From `#@__arcatt` order by sortid asc");
  621. $dsql->Execute();
  622. while($trow = $dsql->GetObject())
  623. {
  624. if($trow->att=='j' || $trow->att=='p') continue;
  625. if(ereg($trow->att,$arcRow['flag']))
  626. echo "<input class='np' type='checkbox' name='flags[]' id='flags{$trow->att}' value='{$trow->att}' checked='checked' />{$trow->attname}.{$trow->att}";
  627. else
  628. echo "<input class='np' type='checkbox' name='flags[]' id='flags{$trow->att}' value='{$trow->att}' />{$trow->attname}.{$trow->att}";
  629. }
  630. ?>
  631. </td>
  632. </tr>
  633. <tr height='32'>
  634. <td width="80" class='bline'>&nbsp;? ??</td>
  635. <td class='bline'>
  636. <input name="title" type="text" id="title" value="<?php echo $arcRow['title']; ?>" style="width:90%" />
  637. </td>
  638. </tr>
  639. <tr height='32'>
  640. <td width="80" class='bline'>&nbsp;?????</td>
  641. <td class='bline'>
  642. <input name="shorttitle" type="text" id="shorttitle" value="<?php echo $arcRow['shorttitle']; ?>" style="width:60%" />
  643. </td>
  644. </tr>
  645. <tr height='32'>
  646. <td width="80" class='bline'>&nbsp;?????</td>
  647. <td class='bline'>
  648. <select name="arcrank" id="arcrank" style="width:120px">
  649. <option value='<?php echo $arcRow["arcrank"]?>'>
  650. <?php echo $arcRow["rankname"]?> </option>
  651. <?php
  652. $urank = $cuserLogin->getUserRank();
  653. $dsql->SetQuery("Select * from `#@__arcrank` where adminrank<='$urank'");
  654. $dsql->Execute();
  655. while($row = $dsql->GetObject()){
  656. echo " <option value='".$row->rank."'>".$row->membername."</option>\r\n";
  657. }
  658. ?>
  659. </select>
  660. ?????<input name="money" type="text" id="money" value="<?php echo $arcRow["money"]; ?>" style="width:80px" />
  661. </td>
  662. </tr>
  663. <tr height='32'>
  664. <td width="80" class='bline'>&nbsp;????</td>
  665. <td class='bline'>
  666. <input name="keywords" type="text" id="keywords" value="<?php echo $arcRow['keywords']; ?>" style="width:70%" />
  667. </td>
  668. </tr>
  669. <tr height='32'>
  670. <td colspan='2' align='center' style='padding-top:12px'>
  671. <input name="imageField" type="image" src="img/button_ok.gif" width="60" height="22" class="np" border="0" style="cursor:pointer" />
  672. &nbsp;&nbsp;
  673. <img src="img/button_back.gif" width="60" height="22" border="0" onclick='HideObj("<?php echo $divname; ?>");ChangeFullDiv("hide");' style="cursor:pointer" />
  674. </td>
  675. </td>
  676. </tr>
  677. </table>
  678. </form>
  679. <?php
  680. //AJAX????
  681. }
  682. /*-----------------------------
  683. //?????????
  684. function quickEditSave(){ }
  685. ------------------------------*/
  686. else if($dopost=='quickEditSave')
  687. {
  688. require_once(DEDEADMIN.'/inc/inc_archives_functions.php');
  689. //????
  690. if(!TestPurview('a_Edit'))
  691. {
  692. if(TestPurview('a_AccEdit'))
  693. {
  694. CheckCatalog($typeid,"??????????? {$typeid} ??????");
  695. }
  696. else
  697. {
  698. CheckArcAdmin($aid,$cuserLogin->getUserID());
  699. }
  700. }
  701. $title = htmlspecialchars(cn_substrR($title,$cfg_title_maxlen));
  702. $shorttitle = cn_substrR($shorttitle,36);
  703. $keywords = trim(cn_substrR($keywords,60));
  704. if(!TestPurview('a_Check,a_AccCheck,a_MyCheck'))
  705. {
  706. $arcrank = -1;
  707. }
  708. $adminid = $cuserLogin->getUserID();
  709. //????
  710. $flag = isset($flags) ? join(',', $flags) : '';
  711. if(!empty($flag))
  712. {
  713. if(ereg('p', $oldflag)) $flag .= ',p';
  714. if(ereg('j', $oldflag)) $flag .= ',j';
  715. }
  716. else
  717. {
  718. $flag = $oldflag;
  719. }
  720. $query = "update `#@__archives` set
  721. typeid = '$typeid',
  722. flag = '$flag',
  723. arcrank = '$arcrank',
  724. money = '$money',
  725. title = '$title',
  726. shorttitle = '$shorttitle',
  727. keywords = '$keywords',
  728. dutyadmin = '$adminid'
  729. where id = '$aid'; ";
  730. //????
  731. $dsql->ExecuteNoneQuery($query);
  732. //????
  733. $dsql->ExecuteNoneQuery(" Update `#@__arctiny` set typeid='$typeid',arcrank='$arcrank' where id='$aid' ");
  734. //?????
  735. if($typeid != $oldtypeid)
  736. {
  737. $addtable = trim($addtable);
  738. if(empty($addtable)) $addtable = '#@__addonarticle';
  739. else $addtable = eregi_replace("[^a-z0-9__#@-]", "", $addtable);
  740. $dsql->ExecuteNoneQuery(" Update `$addtable` set typeid='$typeid' where aid='$aid' ");
  741. }
  742. //??HTML
  743. $artUrl = MakeArt($aid, true, true);
  744. $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1';
  745. ShowMsg('??????????????', $backurl);
  746. exit();
  747. }
  748. /*--------------------------
  749. ????????????
  750. function makekw(){ }
  751. --------------------------*/
  752. else if($dopost=="makekw")
  753. {
  754. include_once(DEDEINC.'/splitword.class.php');
  755. CheckPurview('a_Commend,sys_ArcBatch');
  756. if( !empty($aid) && empty($qstr) )
  757. {
  758. $qstr = $aid;
  759. }
  760. if($qstr=='')
  761. {
  762. ShowMsg("?????", $ENV_GOBACK_URL);
  763. exit();
  764. }
  765. $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
  766. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`',',',$qstr));
  767. $query = "Select arc.*, addt.* From `#@__archives` arc left join `#@__addonarticle` addt on addt.aid=arc.id where arc.id in($arcids) And arc.channel=1 ";
  768. $dsql->SetQuery($query);
  769. $dsql->Execute();
  770. while($row = $dsql->GetArray())
  771. {
  772. //???????????
  773. if(trim($row['keywords']) !='' ) continue;
  774. $aid = $row['id'];
  775. $keywords = '';
  776. $title = $row['title'];
  777. $description = $row['description'];
  778. $body = cn_substr($row['body'], 5000);
  779. $sp->SetSource($title, $cfg_soft_lang, $cfg_soft_lang);
  780. $sp->StartAnalysis();
  781. $titleindexs = preg_replace("/#p#|#e#/",'',$sp->GetFinallyIndex());
  782. $sp->SetSource(Html2Text($body), $cfg_soft_lang, $cfg_soft_lang);
  783. $allindexs = preg_replace("/#p#|#e#/",'',$sp->GetFinallyIndex());
  784. if(is_array($allindexs) && is_array($titleindexs))
  785. {
  786. foreach($titleindexs as $k)
  787. {
  788. if(strlen($keywords.$k)>=30) break;
  789. else $keywords .= $k.',';
  790. }
  791. foreach($allindexs as $k)
  792. {
  793. if(strlen($keywords.$k)>=30) break;
  794. else if(!in_array($k,$titleindexs)) $keywords .= $k.',';
  795. }
  796. }
  797. $keywords = addslashes($keywords);
  798. $description = str_replace('?', ' ', trim($description));
  799. $description = str_replace('?', ' ', $description);
  800. $description = str_replace('?', ' ', $description);
  801. $description = ereg_replace("[ \r\n\t]{1,}", ' ', $description);
  802. $description = str_replace('???', '', $description);
  803. $description = str_replace('???', '', $description);
  804. $description = addslashes($description);
  805. $dsql->ExecuteNoneQuery(" Update `#@__archives` set `keywords`='$keywords',`description`='$description' where id='{$aid}' ");
  806. }
  807. $sp = null;
  808. ShowMsg("?????????????",$ENV_GOBACK_URL);
  809. exit();
  810. }
  811. /*--------------------------
  812. //??????
  813. function attsAdd(){ }
  814. ---------------------------*/
  815. else if($dopost=='attsAdd')
  816. {
  817. CheckPurview('a_Commend,sys_ArcBatch');
  818. if( !empty($aid) && empty($qstr) )
  819. {
  820. $qstr = $aid;
  821. }
  822. if($qstr=='')
  823. {
  824. ShowMsg("?????",$ENV_GOBACK_URL);
  825. exit();
  826. }
  827. if(empty($flagname))
  828. {
  829. ShowMsg("???????????",$ENV_GOBACK_URL);
  830. exit();
  831. }
  832. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`', ',', $qstr));
  833. $query = "Select arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable From `#@__arctiny` arc
  834. left join `#@__arctype` tp on tp.id=arc.typeid
  835. left join `#@__channeltype` ch on ch.id=tp.channeltype
  836. where arc.id in($arcids) ";
  837. $dsql->SetQuery($query);
  838. $dsql->Execute();
  839. while($row = $dsql->GetArray())
  840. {
  841. $aid = $row['id'];
  842. if($row['issystem'] != -1)
  843. {
  844. $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
  845. $arr = $dsql->GetOne("Select flag From `{$maintable}` where id='$aid' ");
  846. $flag = ($arr['flag']=='' ? $flagname : $arr['flag'].','.$flagname);
  847. $dsql->ExecuteNoneQuery(" Update `{$maintable}` set `flag`='$flag' where id='{$aid}' ");
  848. }
  849. else
  850. {
  851. $maintable = trim($row['addtable']);
  852. $arr = $dsql->GetOne("Select flag From `{$maintable}` where aid='$aid' ");
  853. $flag = ($arr['flag']=='' ? $flagname : $arr['flag'].','.$flagname);
  854. $dsql->ExecuteNoneQuery(" Update `{$maintable}` set `flag`='$flag' where aid='{$aid}' ");
  855. }
  856. }
  857. ShowMsg("???????????????",$ENV_GOBACK_URL);
  858. exit();
  859. }
  860. /*--------------------------
  861. //??????
  862. function attsDel(){ }
  863. ---------------------------*/
  864. else if($dopost=='attsDel')
  865. {
  866. CheckPurview('a_Commend,sys_ArcBatch');
  867. if( !empty($aid) && empty($qstr) )
  868. {
  869. $qstr = $aid;
  870. }
  871. if($qstr=='')
  872. {
  873. ShowMsg("?????", $ENV_GOBACK_URL);
  874. exit();
  875. }
  876. if(empty($flagname))
  877. {
  878. ShowMsg("???????????", $ENV_GOBACK_URL);
  879. exit();
  880. }
  881. $arcids = ereg_replace('[^0-9,]','',ereg_replace('`', ',', $qstr));
  882. $query = "Select arc.id,arc.typeid,ch.issystem,ch.maintable,ch.addtable From `#@__arctiny` arc
  883. left join `#@__arctype` tp on tp.id=arc.typeid
  884. left join `#@__channeltype` ch on ch.id=tp.channeltype
  885. where arc.id in($arcids) ";
  886. $dsql->SetQuery($query);
  887. $dsql->Execute();
  888. while($row = $dsql->GetArray())
  889. {
  890. $aid = $row['id'];
  891. if($row['issystem'] != -1)
  892. {
  893. $idname = 'id';
  894. $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) );
  895. $arr = $dsql->GetOne("Select flag From `{$maintable}` where id='$aid' ");
  896. }
  897. else
  898. {
  899. $idname = 'aid';
  900. $maintable = trim($row['addtable']);
  901. $arr = $dsql->GetOne("Select flag From `{$maintable}` where aid='$aid' ");
  902. }
  903. $flag = $arr['flag'];
  904. if(trim($flag)=='' || !ereg($flagname, $flag) )
  905. {
  906. continue;
  907. }
  908. else
  909. {
  910. $flags = explode(',', $flag);
  911. $okflags = array();
  912. foreach($flags as $f)
  913. {
  914. if($f != $flagname) $okflags[] = $f;
  915. }
  916. }
  917. $flag = trim(join(',', $okflags));
  918. $dsql->ExecuteNoneQuery(" Update `{$maintable}` set `flag`='$flag' where {$idname}='{$aid}' ");
  919. }
  920. ShowMsg("???????????????", $ENV_GOBACK_URL);
  921. exit();
  922. }
  923. /*--------------------------
  924. //?????????AJAX??
  925. function attsDlg(){ }
  926. ---------------------------*/
  927. else if($dopost=='attsDlg')
  928. {
  929. if( !empty($aid) && empty($qstr) )
  930. {
  931. $qstr = $aid;
  932. }
  933. $dojobname = ($dojob=='attsDel' ? '??????' : '??????');
  934. AjaxHead();
  935. //??AJAX?????
  936. $divname = 'attsDlg';
  937. echo "<div class='title' onmousemove=\"DropMoveHand('{$divname}', 225);\" onmousedown=\"DropStartHand();\" onmouseup=\"DropStopHand();\">\r\n";
  938. echo " <div class='titLeft'>{$dojobname}</div>\r\n";
  939. echo " <div class='titRight'><img src='img/ico-close.gif' style='cursor:pointer;' onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='??' title='??' /></div>\r\n";
  940. echo "</div>\r\n";
  941. echo "<form name='quickeditform' action='archives_do.php' method='post'>\r\n";
  942. echo "<input type='hidden' name='dopost' value='{$dojob}' />\r\n";
  943. echo "<input type='hidden' name='qstr' value='{$qstr}' />\r\n";
  944. echo "<table width='100%' style='margin-top:6px;z-index:9000;'>\r\n";
  945. ?>
  946. <tr height='28'>
  947. <td width="80" class='bline'>&nbsp;? ??</td>
  948. <td class='bline'>
  949. <input type='hidden' name='oldflag' value='<?php echo $arcRow['flag']; ?>' />
  950. <?php
  951. $dsql->SetQuery("Select * From `#@__arcatt` order by sortid asc");
  952. $dsql->Execute();
  953. while($trow = $dsql->GetObject())
  954. {
  955. if($trow->att=='j' || $trow->att=='p') continue;
  956. echo "<input class='np' type='radio' name='flagname' id='flags{$trow->att}' value='{$trow->att}' />{$trow->attname}.{$trow->att}";
  957. }
  958. ?>
  959. </td>
  960. </tr>
  961. <tr height='32'>
  962. <td width="80" class='bline'>&nbsp;??ID?</td>
  963. <td class='bline'>
  964. <input type='text' name='tmpids' value="<?php echo $qstr; ?>" style='width:310px;overflow:hidden;' />
  965. </td>
  966. </tr>
  967. <tr height='32'>
  968. <td colspan='2' align='center' style='padding-top:12px'>
  969. <input name="imageField" type="image" src="img/button_ok.gif" width="60" height="22" class="np" border="0" style="cursor:pointer" />
  970. &nbsp;&nbsp;
  971. <img src="img/button_back.gif" width="60" height="22" border="0" onclick='HideObj("<?php echo $divname; ?>");ChangeFullDiv("hide");' style="cursor:pointer" />
  972. </td>
  973. </td>
  974. </tr>
  975. </table>
  976. </form>
  977. <?php
  978. //AJAX????
  979. }
  980. /*------------------------
  981. function getCatMap() { }
  982. -------------------------*/
  983. else if($dopost=='getCatMap')
  984. {
  985. require_once(DEDEINC.'/typeunit.class.selector.php');
  986. AjaxHead();
  987. //??AJAX?????
  988. $divname = 'getCatMap';
  989. echo "<div class='title' style='cursor:default;'>\r\n";
  990. echo " <div class='titLeft'>???????</div>\r\n";
  991. echo " <div class='titRight'><img src='img/ico-close.gif' style='cursor:pointer;' onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");' alt='??' title='??' /></div>\r\n";
  992. echo "</div>\r\n";
  993. $tus = new TypeUnitSelector();
  994. ?>
  995. <form name='quicksel' action='javascript:;' method='get'>
  996. <div class='quicksel'>
  997. <?php $tus->ListAllType($channelid); ?>
  998. </div>
  999. <div align='center' class='quickselfoot'>
  1000. <img src="img/button_ok.gif" onclick="getSelCat('<?php echo $targetid; ?>');" width="60" height="22" class="np" border="0" style="cursor:pointer" />
  1001. &nbsp;&nbsp;
  1002. <img src="img/button_back.gif" onclick='HideObj("<?php echo $divname; ?>");ChangeFullDiv("hide");' width="60" height="22" border="0" style="cursor:pointer" />
  1003. </div>
  1004. </form>
  1005. <?php
  1006. //AJAX????
  1007. }
  1008. ?>