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

270 lines
9.5KB

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