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

254 lines
9.3KB

  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='26' background="images/tbg.gif">
  96. <div style='float:left'><b>修改快捷操作项</b></div>
  97. <div style='float:right;padding:3px 10px 0 0;'>
  98. <a href="javascript:CloseTab('editTab')"><img src="images/close.gif" width="12" height="12" border="0"></a>
  99. </div>
  100. </td>
  101. </tr>
  102. <tr>
  103. <td style="height:6px;font-size:1px;border-top:1px solid #8DA659">&nbsp;</td>
  104. </tr>
  105. <tr>
  106. <td>按原格式修改/增加XML项。</td>
  107. </tr>
  108. <tr>
  109. <td align='center'><textarea name="quickmenu" rows="10" cols="50" style="width:94%;height:220px"><?php echo $oldct; ?></textarea></td>
  110. </tr>
  111. <tr>
  112. <td height="46" align="center">
  113. <input type="submit" name="Submit" value="保存项目" class="np coolbg" style="width:80px;cursor:pointer">&nbsp;
  114. <input type="reset" name="reset" value="重设" class="np coolbg" style="width:50px;cursor:pointer">
  115. </td>
  116. </tr>
  117. </table>
  118. </form>
  119. <?php
  120. exit();
  121. }
  122. /*---------------------------------
  123. 载入右边内容
  124. function _getRightSide() { }
  125. ---------------------------------*/
  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'><?php echo $linkstr; ?></td>
  195. </tr>
  196. <?php
  197. }
  198. ?>
  199. </table>
  200. <?php
  201. exit;
  202. } else if ($dopost == 'setskin') {
  203. $cskin = empty($cskin) ? 1 : $cskin;
  204. $skin = !in_array($cskin, array(1, 2, 3, 4)) ? 1 : $cskin;
  205. $skinconfig = DEDEDATA.'/admin/skin.txt';
  206. PutFile($skinconfig, $skin);
  207. } elseif ($dopost == 'get_seo') {
  208. //直接采用DedeBIZ重写方法
  209. exit;
  210. } elseif ($dopost == "system_info") {
  211. if (!extension_loaded("openssl")) {
  212. echo json_encode(array(
  213. "code" => -1001,
  214. "msg" => "PHP不支持OpenSSL,无法完成商业版授权",
  215. "result" => null,
  216. ));
  217. exit;
  218. }
  219. if (empty($cfg_auth_code)) {
  220. echo json_encode(array(
  221. "code" => -1002,
  222. "msg" => "当前站点尚未购买商业版授权",
  223. "result" => null,
  224. ));
  225. exit;
  226. }
  227. openssl_public_decrypt(base64_decode($cfg_auth_code), $decotent, DEDEPUB);
  228. $core_info = new stdClass;
  229. if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
  230. $client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port);
  231. $client->appid = $cfg_bizcore_appid;
  232. $client->key = $cfg_bizcore_key;
  233. $core_info = $client->SystemInfo();
  234. $client->Close();
  235. }
  236. if (!empty($decotent)) {
  237. $res = json_decode($decotent);
  238. if (isset($res->sid)) {
  239. echo json_encode(array(
  240. "code" => 200,
  241. "msg" => "",
  242. "result" => array(
  243. "domain" => $res->domain,
  244. "title" => $res->title,
  245. "stype" => $res->stype == 1 ? "企业单位" : "个人",
  246. "auth_version" => $res->auth_version,
  247. "auth_at" => date("Y-m-d", $res->auth_at),
  248. "core" => $core_info,
  249. ),
  250. ));
  251. }
  252. }
  253. }
  254. ?>