国内流行的内容管理系统(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.

125 lines
4.0KB

  1. <?php
  2. /**
  3. * @version $Id: story_add_content_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. require_once(DEDEINC. "/oxwindow.class.php");
  11. require_once(DEDEROOT. '/book/include/story.func.php');
  12. if( empty($chapterid)
  13. || (!empty($addchapter) && !empty($chapternew)) )
  14. {
  15. if(empty($chapternew))
  16. {
  17. ShowMsg("由于你发布的内容没选择章节,系统拒绝发布!", "-1");
  18. exit();
  19. }
  20. $row = $dsql->GetOne("SELECT * FROM #@__story_chapter WHERE bookid='$bookid' ORDER BY chapnum desc");
  21. if(is_array($row))
  22. {
  23. $nchapnum = $row['chapnum']+1;
  24. }
  25. else
  26. {
  27. $nchapnum = 1;
  28. }
  29. $query = "INSERT INTO `#@__story_chapter`(`bookid`,`catid`,`chapnum`,`mid`,`chaptername`,`bookname`)
  30. VALUES ('$bookid', '$catid', '$nchapnum', '0', '$chapternew','$bookname');";
  31. $rs = $dsql->ExecuteNoneQuery($query);
  32. if($rs)
  33. {
  34. $chapterid = $dsql->GetLastID();
  35. }
  36. else
  37. {
  38. ShowMsg("增加章节失败,请检查原因!","-1");
  39. exit();
  40. }
  41. }
  42. //获得父栏目
  43. $nrow = $dsql->GetOne("SELECT * FROM #@__story_catalog WHERE id='$catid' ");
  44. $bcatid = $nrow['pid'];
  45. $booktype = $nrow['booktype'];
  46. if(empty($bcatid))
  47. {
  48. $bcatid = 0;
  49. }
  50. if(empty($booktype))
  51. {
  52. $booktype = 0;
  53. }
  54. $addtime = time();
  55. //处理上传的缩略图
  56. //$litpic = GetDDImage('litpic',$litpicname,0);
  57. $adminID = $cuserLogin->getUserID();
  58. //本章最后一个小说的排列顺次序
  59. $lrow = $dsql->GetOne("SELECT sortid From #@__story_content WHERE bookid='$bookid' AND chapterid='$chapterid' ORDER BY sortid DESC");
  60. if(empty($lrow))
  61. {
  62. $sortid = 1;
  63. }
  64. else
  65. {
  66. $sortid = $lrow['sortid']+1;
  67. }
  68. $inQuery = "
  69. INSERT INTO `#@__story_content`(`title`,`bookname`,`chapterid`,`catid`,`bcatid`,`bookid`,`booktype`,`sortid`,
  70. `mid`,`bigpic`,`body`,`addtime`)
  71. VALUES ('$title','$bookname', '$chapterid', '$catid','$bcatid', '$bookid','$booktype','$sortid', '0', '' , '', '$addtime');";
  72. if(!$dsql->ExecuteNoneQuery($inQuery))
  73. {
  74. ShowMsg("把数据保存到数据库时出错,请检查!".$dsql->GetError().$inQuery,"-1");
  75. $dsql->Close();
  76. exit();
  77. }
  78. $arcID = $dsql->GetLastID();
  79. WriteBookText($arcID,$body);
  80. //更新图书的内容数
  81. $row = $dsql->GetOne("Select count(id) AS dd FROM #@__story_content WHERE bookid = '$bookid' ");
  82. $dsql->ExecuteNoneQuery("UPDATE #@__story_books SET postnum='{$row['dd']}',lastpost='".time()."' WHERE bid='$bookid' ");
  83. //更新章节的内容数
  84. $row = $dsql->GetOne("SELECT count(id) AS dd FROM #@__story_content WHERE bookid = '$bookid' AND chapterid='$chapterid' ");
  85. $dsql->ExecuteNoneQuery("UPDATE #@__story_chapter SET postnum='{$row['dd']}' WHERE id='$chapterid' ");
  86. //生成HTML
  87. //$artUrl = MakeArt($arcID,true);
  88. if(empty($artcontentUrl)) $artcontentUrl = '';
  89. if($artcontentUrl=="") $artcontentUrl = $cfg_cmspath."/book/story.php?id=$arcID";
  90. require_once(DEDEROOT.'/book/include/story.view.class.php');
  91. $bv = new BookView($bookid, 'book');
  92. $artUrl = $bv->MakeHtml();
  93. $bv->Close();
  94. //返回成功信息
  95. $msg = "
  96.   请选择你的后续操作:
  97. <a href='story_add_content.php?bookid={$bookid}'><u>继续发布</u></a>
  98. &nbsp;&nbsp;
  99. <a href='$artUrl' target='_blank'><u>预览小说</u></a>
  100. &nbsp;&nbsp;
  101. <a href='$artcontentUrl' target='_blank'><u>预览内容</u></a>
  102. &nbsp;&nbsp;
  103. <a href='story_list_content.php?bookid={$bookid}'><u>管理所有内容</u></a>
  104. &nbsp;&nbsp;
  105. <a href='story_books.php'><u>管理所有图书</u></a>
  106. ";
  107. $wintitle = "成功发布文章!";
  108. $wecome_info = "连载管理::发布文章";
  109. $win = new OxWindow();
  110. $win->AddTitle("成功发布文章:");
  111. $win->AddMsgItem($msg);
  112. $winform = $win->GetWindow("hand","&nbsp;",false);
  113. $win->Display();
  114. //ClearAllLink();