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

287 lines
9.7KB

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