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

251 lines
8.9KB

  1. <?php
  2. /**
  3. * 管理后台首页主体
  4. *
  5. * @version $Id: index_body.php 1 11:06 2010年7月13日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require(dirname(__FILE__).'/config.php');
  12. require(DEDEINC.'/image.func.php');
  13. require(DEDEINC.'/dedetag.class.php');
  14. $defaultIcoFile = DEDEDATA.'/admin/quickmenu.txt';
  15. $myIcoFile = DEDEDATA.'/admin/quickmenu-'.$cuserLogin->getUserID().'.txt';
  16. if (!file_exists($myIcoFile)) $myIcoFile = $defaultIcoFile;
  17. //默认主页
  18. if (empty($dopost)) {
  19. require(DEDEINC.'/inc/inc_fun_funAdmin.php');
  20. $verLockFile = DEDEDATA.'/admin/ver.txt';
  21. $fp = fopen($verLockFile, 'r');
  22. $upTime = trim(fread($fp, 64));
  23. fclose($fp);
  24. $oktime = substr($upTime, 0, 4).'-'.substr($upTime, 4, 2).'-'.substr($upTime, 6, 2);
  25. $offUrl = SpGetNewInfo();
  26. $dedecmsidc = DEDEDATA.'/admin/idc.txt';
  27. $fp = fopen($dedecmsidc, 'r');
  28. $dedeIDC = fread($fp, filesize($dedecmsidc));
  29. fclose($fp);
  30. include DedeInclude('templets/index_body.htm');
  31. exit();
  32. }
  33. /*-----------------------
  34. 增加新项
  35. function _AddNew() { }
  36. -------------------------*/
  37. else if ($dopost == 'addnew') {
  38. if (empty($link) || empty($title)) {
  39. ShowMsg("链接网址或标题不能为空", "-1");
  40. exit();
  41. }
  42. $fp = fopen($myIcoFile, 'r');
  43. $oldct = trim(fread($fp, filesize($myIcoFile)));
  44. fclose($fp);
  45. $link = preg_replace("#['\"]#", '`', $link);
  46. $title = preg_replace("#['\"]#", '`', $title);
  47. $ico = preg_replace("#['\"]#", '`', $ico);
  48. $oldct .= "\r\n<menu:item ico=\"{$ico}\" link=\"{$link}\" title=\"{$title}\">";
  49. $myIcoFileTrue = DEDEDATA.'/admin/quickmenu-'.$cuserLogin->getUserID().'.txt';
  50. $fp = fopen($myIcoFileTrue, 'w');
  51. fwrite($fp, $oldct);
  52. fclose($fp);
  53. ShowMsg("成功增加一个项目", "index_body.php?".time());
  54. exit();
  55. }
  56. /*---------------------------
  57. 保存修改的项
  58. function _EditSave() { }
  59. ----------------------------*/
  60. else if ($dopost == 'editsave') {
  61. $quickmenu = stripslashes($quickmenu);
  62. $myIcoFileTrue = DEDEDATA.'/admin/quickmenu-'.$cuserLogin->getUserID().'.txt';
  63. $fp = fopen($myIcoFileTrue, 'w');
  64. fwrite($fp, $quickmenu);
  65. fclose($fp);
  66. ShowMsg("成功修改快捷操作项目", "index_body.php?".time());
  67. exit();
  68. }
  69. /*---------------------------
  70. 保存修改的项
  71. function _EditSave() { }
  72. ----------------------------*/
  73. else if ($dopost == 'movesave') {
  74. $movedata = str_replace('\\', "", $sortorder);
  75. $movedata = json_decode($movedata, TRUE);
  76. $movedata = serialize($movedata);
  77. $myIcoFileTrue = DEDEDATA.'/admin/move-'.$cuserLogin->getUserID().'.txt';
  78. $fp = fopen($myIcoFileTrue, 'w');
  79. fwrite($fp, $movedata);
  80. fclose($fp);
  81. }
  82. /*-----------------------------
  83. 显示修改表单
  84. function _EditShow() { }
  85. -----------------------------*/
  86. else if ($dopost == 'editshow') {
  87. $fp = fopen($myIcoFile, 'r');
  88. $oldct = trim(fread($fp, filesize($myIcoFile)));
  89. fclose($fp);
  90. ?>
  91. <form name="editform" action="index_body.php" method="post">
  92. <input type="hidden" name="dopost" value="editsave">
  93. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  94. <tr>
  95. <td height="30" background="images/tbg.gif">
  96. <div style="float:left;margin-left:10px"><b>修改快捷操作项</b></div>
  97. <div style="float:right;padding:2px 10px 0 0">
  98. <a href="javascript:CloseTab('editTab')"><img src="images/close.gif"></a>
  99. </div>
  100. </td>
  101. </tr>
  102. <tr>
  103. <td style="height:10px;border-top:1px solid #8DA659"></td>
  104. </tr>
  105. <tr>
  106. <td align="center"><textarea name="quickmenu" rows="10" cols="50"><?php echo $oldct; ?></textarea></td>
  107. </tr>
  108. <tr>
  109. <td height="36" align="center">
  110. <input type="submit" name="Submit" value="保存项目" class="np coolbg" style="width:80px;cursor:pointer">&nbsp;
  111. <input type="reset" name="reset" value="重设" class="np coolbg" style="width:50px;cursor:pointer">
  112. </td>
  113. </tr>
  114. </table>
  115. </form>
  116. <?php
  117. exit();
  118. }
  119. /*---------------------------------
  120. 载入右边内容
  121. function _getRightSide() { }
  122. ---------------------------------*/
  123. else if ($dopost == 'getRightSide') {
  124. $query = " SELECT COUNT(*) AS dd FROM `#@__member` ";
  125. $row1 = $dsql->GetOne($query);
  126. $query = " SELECT COUNT(*) AS dd FROM `#@__feedback` ";
  127. $row2 = $dsql->GetOne($query);
  128. $chArrNames = array();
  129. $query = "SELECT id, typename FROM `#@__channeltype` ";
  130. $dsql->Execute('c', $query);
  131. while ($row = $dsql->GetArray('c')) {
  132. $chArrNames[$row['id']] = $row['typename'];
  133. }
  134. $query = "SELECT COUNT(channel) AS dd, channel FROM `#@__arctiny` GROUP BY channel ";
  135. $allArc = 0;
  136. $chArr = array();
  137. $dsql->Execute('a', $query);
  138. while ($row = $dsql->GetArray('a')) {
  139. $allArc += $row['dd'];
  140. $row['typename'] = $chArrNames[$row['channel']];
  141. $chArr[] = $row;
  142. }
  143. ?>
  144. <table width="100%" class="table table-borderless">
  145. <tr>
  146. <td class="nline" style="width:50%;text-align:left">会员数:</td>
  147. <td class="nline" style="text-align:left"><?php echo $row1['dd']; ?></td>
  148. </tr>
  149. <tr>
  150. <td class="nline" style="text-align:left">文档数:</td>
  151. <td class="nline" style="text-align:left"><?php echo $allArc; ?></td>
  152. </tr>
  153. <?php
  154. foreach ($chArr as $row) {
  155. ?>
  156. <tr>
  157. <td class="nline" style="text-align:left"><?php echo $row['typename']; ?>:</td>
  158. <td class="nline" style="text-align:left"><?php echo $row['dd']; ?></td>
  159. </tr>
  160. <?php
  161. }
  162. ?>
  163. <tr>
  164. <td style="text-align:left">评论数:</td>
  165. <td style="text-align:left"><?php echo $row2['dd']; ?></td>
  166. </tr>
  167. </table>
  168. <?php
  169. exit();
  170. } else if ($dopost == 'getRightSideNews') {
  171. $query = "SELECT arc.id, arc.arcrank, arc.title, arc.channel, ch.editcon FROM `#@__archives` arc
  172. LEFT JOIN `#@__channeltype` ch ON ch.id = arc.channel
  173. WHERE arc.arcrank<>-2 ORDER BY arc.id DESC LIMIT 0, 6 ";
  174. $arcArr = array();
  175. $dsql->Execute('m', $query);
  176. while ($row = $dsql->GetArray('m')) {
  177. $arcArr[] = $row;
  178. }
  179. AjaxHead();
  180. ?>
  181. <table width="100%" class="table table-borderless">
  182. <?php
  183. foreach ($arcArr as $row) {
  184. if (trim($row['editcon']) == '') {
  185. $row['editcon'] = 'archives_edit.php';
  186. }
  187. $linkstr = "·<a href='{$row['editcon']}?aid={$row['id']}&channelid={$row['channel']}'>{$row['title']}</a>";
  188. if ($row['arcrank'] == -1) $linkstr .= "<span style='color:#dc3545'>(未审核)</span>";
  189. ?>
  190. <tr>
  191. <td class="nline"><?php echo $linkstr; ?></td>
  192. </tr>
  193. <?php
  194. }
  195. ?>
  196. </table>
  197. <?php
  198. exit;
  199. } else if ($dopost == 'setskin') {
  200. $cskin = empty($cskin) ? 1 : $cskin;
  201. $skin = !in_array($cskin, array(1, 2, 3, 4)) ? 1 : $cskin;
  202. $skinconfig = DEDEDATA.'/admin/skin.txt';
  203. PutFile($skinconfig, $skin);
  204. } elseif ($dopost == 'get_seo') {
  205. //直接采用DedeBIZ重写方法
  206. exit;
  207. } elseif ($dopost == "system_info") {
  208. if (!extension_loaded("openssl")) {
  209. echo json_encode(array(
  210. "code" => -1001,
  211. "msg" => "PHP不支持OpenSSL,无法完成商业版授权",
  212. "result" => null,
  213. ));
  214. exit;
  215. }
  216. if (empty($cfg_auth_code)) {
  217. echo json_encode(array(
  218. "code" => -1002,
  219. "msg" => "当前站点尚未购买商业版授权",
  220. "result" => null,
  221. ));
  222. exit;
  223. }
  224. openssl_public_decrypt(base64_decode($cfg_auth_code), $decotent, DEDEPUB);
  225. $core_info = new stdClass;
  226. if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
  227. $client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port);
  228. $client->appid = $cfg_bizcore_appid;
  229. $client->key = $cfg_bizcore_key;
  230. $core_info = $client->SystemInfo();
  231. $client->Close();
  232. }
  233. if (!empty($decotent)) {
  234. $res = json_decode($decotent);
  235. if (isset($res->sid)) {
  236. echo json_encode(array(
  237. "code" => 200,
  238. "msg" => "",
  239. "result" => array(
  240. "domain" => $res->domain,
  241. "title" => $res->title,
  242. "stype" => $res->stype == 1 ? "企业单位" : "个人",
  243. "auth_version" => $res->auth_version,
  244. "auth_at" => date("Y-m-d", $res->auth_at),
  245. "core" => $core_info,
  246. ),
  247. ));
  248. }
  249. }
  250. }
  251. ?>