ftn_cross.inc.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: ftn_cross.inc.php 29265 2012-03-31 06:03:26Z yexinhao $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $storageService = Cloud::loadClass('Service_Storage');
  12. if(empty($_GET['ftn_formhash']) || empty($_G['uid']) || empty($_GET['filesize']) || empty($_GET['sha1']) || empty($_GET['filename'])){
  13. if(empty($_GET['allcount']) && empty($_GET['uploadedcount']) && empty($_GET['errorcount'])){
  14. exit;
  15. } else {
  16. if($_GET['allcount'] == ($_GET['uploadedcount']+$_GET['errorcount'])){
  17. $allowUpdate = 1;
  18. } else {
  19. $allowUpdate = 0;
  20. }
  21. include template('xf_storage:cross');
  22. }
  23. } elseif($_GET['ftn_formhash'] != $storageService->ftnFormhash()){
  24. exit;//showmessage('操作超时或者数据来源错误','','error');
  25. }
  26. if($_GET['ftn_submit']) {
  27. $data = array();$index = array();
  28. $filesize = intval($_GET['filesize']);
  29. $filename = diconv(trim($_GET['filename']),'UTF-8');
  30. $filename = str_replace(array('\'','"','\/','\\','<','>'),array('','','','','',''),$filename);
  31. $sha = trim($_GET['sha1']);
  32. $index = array(
  33. 'tid' => 0,
  34. 'pid' => 0,
  35. 'uid' => $_G['uid'],
  36. 'tableid' => '127',
  37. 'downloads' => 0
  38. );
  39. $aid = C::t('forum_attachment')->insert($index, 1);
  40. $data = array(
  41. 'aid' => $aid,
  42. 'uid' => $_G['uid'],
  43. 'dateline' => $_G['timestamp'],
  44. 'filename' => $filename,
  45. 'filesize' => $filesize,
  46. 'attachment' => 'storage:' . $sha,
  47. 'remote' => 0,
  48. 'isimage' => 0,
  49. 'width' => 0,
  50. 'thumb' => 0,
  51. );
  52. C::t('forum_attachment_unused')->insert($data);
  53. if(empty($_GET['allcount']) && empty($_GET['uploadedcount']) && empty($_GET['errorcount'])){
  54. exit;
  55. } else {
  56. if($_GET['allcount'] == ($_GET['uploadedcount'] + $_GET['errorcount'])){
  57. $allowUpdate = 1;
  58. } else {
  59. $allowUpdate = 0;
  60. }
  61. include template('xf_storage:cross');
  62. }
  63. }