国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.5KB

  1. <?php
  2. /**
  3. * @version $Id: story_add_photo_action.php 1 9:02 2010年9月25日Z 蓝色随想 $
  4. * @package DedeCMS.Module.Book
  5. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  6. * @license http://help.dedecms.com/usersguide/license.html
  7. * @link http://www.dedecms.com
  8. */
  9. require_once(dirname(__FILE__). "/config.php");
  10. CheckPurview('story_New');
  11. require_once(DEDEINC. "/image.func.php");
  12. require_once(DEDEINC. "/oxwindow.class.php");
  13. require_once(DEDEADMIN. '/inc/inc_archives_functions.php');
  14. if( empty($chapterid)
  15. || (!empty($addchapter) && !empty($chapternew)) )
  16. {
  17. if(empty($chapternew))
  18. {
  19. ShowMsg("由于你发布的内容没选择章节,系统拒绝发布!","-1");
  20. exit();
  21. }
  22. $row = $dsql->GetOne("SELECT * FROM #@__story_chapter WHERE bookid='$bookid' ORDER BY chapnum DESC");
  23. if(is_array($row))
  24. {
  25. $nchapnum = $row['chapnum']+1;
  26. }
  27. else
  28. {
  29. $nchapnum = 1;
  30. }
  31. $query = "INSERT INTO `#@__story_chapter`(`bookid`,`catid`,`chapnum`,`mid`,`chaptername`,`bookname`)
  32. VALUES ('$bookid', '$catid', '$nchapnum', '0', '$chapternew','$bookname');";
  33. $rs = $dsql->ExecuteNoneQuery($query);
  34. if($rs)
  35. {
  36. $chapterid = $dsql->GetLastID();
  37. }
  38. else
  39. {
  40. ShowMsg("增加章节失败,请检查原因!", "-1");
  41. exit();
  42. }
  43. }
  44. //获得父栏目
  45. $nrow = $dsql->GetOne("SELECT * FROM #@__story_catalog WHERE id='$catid' ");
  46. $bcatid = $nrow['pid'];
  47. $booktype = $nrow['booktype'];
  48. $addtime = time();
  49. //本章最后一个漫画的排列顺次序
  50. $lrow = $dsql->GetOne("SELECT sortid FROM #@__story_content WHERE bookid='$bookid' AND chapterid='$chapterid' ORDER BY sortid DESC");
  51. if(empty($lrow))
  52. {
  53. $sortid = 1;
  54. }
  55. else
  56. {
  57. $sortid = $lrow['sortid']+1;
  58. }
  59. //处理上传的图片
  60. if(!isset($isremote))
  61. {
  62. $isremote = 0;
  63. }
  64. //$bigpic = UploadOneImage('bigpic',$bigpicname,$ddisremote);
  65. $adminID = $cuserLogin->getUserID();
  66. $postnum = 0;
  67. for($i=1;$i<=$photonum;$i++)
  68. {
  69. $bigpic = UploadOneImage('imgfile'.$i,${'imgurl'.$i},$isremote);
  70. if($bigpic!='')
  71. {
  72. $titlen = ${'title'.$i};
  73. if(empty($titlen))
  74. {
  75. $titlen = ${'title'};
  76. }
  77. $inQuery = "
  78. INSERT INTO `#@__story_content`(`title`,`bookname`,`chapterid`,`catid`,`bcatid`,`booktype`,`bookid`,`sortid`,
  79. `mid`,`bigpic`,`body`,`addtime`)
  80. VALUES ('$titlen','$bookname', '$chapterid', '$catid','$bcatid','$booktype', '$bookid','$sortid', '0', '$bigpic' , '', '$addtime');";
  81. $rs = $dsql->ExecuteNoneQuery($inQuery);
  82. //if(!$rs) echo $inQuery."<hr>\r\n";
  83. if($rs)
  84. {
  85. $sortid++;
  86. $postnum++;
  87. }
  88. }
  89. }
  90. $arcID = $dsql->GetLastID();
  91. //更新图书的内容数
  92. $row = $dsql->GetOne("SELECT count(id) AS dd FROM #@__story_content WHERE bookid = '$bookid' ");
  93. $dsql->ExecuteNoneQuery("UPDATE #@__story_books SET postnum='{$row['dd']}',lastpost='".time()."' WHERE bid='$bookid' ");
  94. //更新章节的内容数
  95. $row = $dsql->GetOne("SELECT count(id) AS dd FROM #@__story_content WHERE bookid = '$bookid' AND chapterid='$chapterid' ");
  96. $dsql->ExecuteNoneQuery("UPDATE #@__story_chapter SET postnum='{$row['dd']}' WHERE id='$chapterid' ");
  97. if(empty($arcID))
  98. {
  99. ShowMsg("没成功保存任何图片,可能是系统有问题!","-1");
  100. exit();
  101. }
  102. //生成HTML
  103. //$artUrl = MakeArt($arcID,true);
  104. if(empty($artcontentUrl)) $artcontentUrl="";
  105. if($artcontentUrl=="") $artcontentUrl = $cfg_mainsite.$cfg_cmspath."/book/show-photo.php?id=$arcID&bookid=$bookid&chapterid=$chapterid";
  106. require_once(DEDEROOT. '/book/include/story.view.class.php');
  107. $bv = new BookView($bookid, 'book');
  108. $artUrl = $bv->MakeHtml();
  109. $bv->Close();
  110. //返回成功信息
  111. $msg = "
  112.   请选择你的后续操作:
  113. <a href='story_add_photo.php?bookid={$bookid}'><u>继续发布</u></a>
  114. &nbsp;&nbsp;
  115. <a href='$artUrl' target='_blank'><u>预览漫画</u></a>
  116. &nbsp;&nbsp;
  117. <a href='$artcontentUrl' target='_blank'><u>预览内容</u></a>
  118. &nbsp;&nbsp;
  119. <a href='story_list_content.php?bookid={$bookid}'><u>本书所有内容</u></a>
  120. &nbsp;&nbsp;
  121. <a href='story_books.php'><u>管理所有图书</u></a>
  122. ";
  123. $wintitle = "成功发布图片!";
  124. $wecome_info = "连载管理::发布图片";
  125. $win = new OxWindow();
  126. $win->AddTitle("成功发布图片:");
  127. $win->AddMsgItem($msg);
  128. $winform = $win->GetWindow("hand", "&nbsp;", false);
  129. $win->Display();