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

163 lines
6.6KB

  1. <?php
  2. /**
  3. * 仪表盘
  4. *
  5. * @version $id:index_body.php 11:06 2010年7月13日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license GNU GPL v2 (https://www.dedebiz.com/license)
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__).'/config.php');
  12. require_once(DEDEINC.'/image.func.php');
  13. require_once(DEDEINC.'/dedetag.class.php');
  14. if (empty($dopost)) {
  15. require_once(DEDEINC.'/inc/inc_fun_funAdmin.php');
  16. $verLockFile = DEDEDATA.'/admin/ver.txt';
  17. $fp = fopen($verLockFile, 'r');
  18. $upTime = trim(fread($fp, 64));
  19. fclose($fp);
  20. $oktime = substr($upTime, 0, 4).'-'.substr($upTime, 4, 2).'-'.substr($upTime, 6, 2);
  21. $offUrl = SpGetNewInfo();
  22. include DedeInclude('templets/index_body.htm');
  23. exit();
  24. } else if ($dopost == 'setskin') {
  25. $cskin = empty($cskin) ? 1 : $cskin;
  26. $skin = !in_array($cskin, array(1, 2, 3, 4)) ? 1 : $cskin;
  27. $skinconfig = DEDEDATA.'/admin/skin.txt';
  28. PutFile($skinconfig, $skin);
  29. } elseif ($dopost == 'get_seo') {
  30. //直接采用DedeBIZ重写方法
  31. exit;
  32. } elseif ($dopost == 'get_articles') {
  33. ?>
  34. <table class="table table-borderless">
  35. <?php
  36. $userCatalogSql = '';
  37. if (count($admin_catalogs) > 0) {
  38. $admin_catalog = join(',', $admin_catalogs);
  39. $userCatalogSql = "AND arc.typeid IN($admin_catalog) ";
  40. }
  41. $query = "SELECT arc.id, arc.arcrank, arc.title, arc.typeid, arc.mid, arc.pubdate, arc.channel, ch.editcon, tp.typename FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id = arc.channel LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.arcrank<>-2 {$userCatalogSql} AND arc.mid={$cuserLogin->getUserID()} ORDER BY arc.id DESC LIMIT 0,10";
  42. $arcArr = array();
  43. $dsql->Execute('m', $query);
  44. while($row = $dsql->GetArray('m'))
  45. {
  46. $arcArr[] = $row;
  47. }
  48. ?>
  49. <?php
  50. if (count($arcArr) > 0) {
  51. foreach($arcArr as $row)
  52. {
  53. if (trim($row['editcon']) == '') {
  54. $row['editcon'] = 'archives_edit.php';
  55. }
  56. $rowarcrank = $row['arcrank']==-1 ? '待审核' : '已审核';
  57. $pubdate = GetDateMk($row['pubdate']);
  58. echo "<tr class='no-wrap'>
  59. <td><a href='{$row['editcon']}?aid={$row['id']}&channelid={$row['channel']}'>{$row['title']}</a></td><td width='70'>{$rowarcrank}</td><td width='110'>{$pubdate}</td></tr>";
  60. }
  61. } else {
  62. ?>
  63. <tr><td colspan="2" align="center">暂无文档</td></tr>
  64. <?php }?>
  65. </table>
  66. <?php
  67. exit;
  68. } elseif ($dopost == "system_info") {
  69. if (empty(trim($cfg_auth_code))) {
  70. $indexHTML = '';
  71. if (file_exists(DEDEROOT."/index.html")) {
  72. $indexHTML = file_get_contents(DEDEROOT."/index.html");
  73. } else {
  74. $row = $dsql->GetOne("SELECT * FROM `#@__homepageset`");
  75. $row['templet'] = MfTemplet($row['templet']);
  76. $pv = new PartView();
  77. $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row['templet']);
  78. $row['showmod'] = isset($row['showmod']) ? $row['showmod'] : 0;
  79. if ($row['showmod'] == 0) {
  80. ob_start();
  81. $pv->Display();
  82. $indexHTML = ob_get_contents();
  83. ob_end_clean();
  84. }
  85. }
  86. $pattern = '/<a\s[^>]*href=["\']?([^"\'>\s]*)["\']?[^>]*>/is';
  87. preg_match_all($pattern, $indexHTML, $matches);
  88. $hasPowered = false;
  89. foreach ($matches[1] as $href) {
  90. if (preg_match("#^https://www.dedebiz.com#",$href)) {
  91. $hasPowered = true;
  92. }
  93. }
  94. $poweredStr = $hasPowered? "" : "请保留正确的<a href='https://www.dedebiz.com/powered_by_dedebiz' class='text-success'>底部版权信息</a>,";
  95. echo json_encode(array(
  96. "code" => -1002,
  97. "msg" => "当前站点已授权社区版,{$poweredStr}获取更多官方技术支持,请选择<a href='https://www.dedebiz.com/auth' class='text-success'>商业版</a>",
  98. "result" => null,
  99. ));
  100. exit;
  101. }
  102. if (!extension_loaded("openssl")) {
  103. echo json_encode(array(
  104. "code" => -1001,
  105. "msg" => "PHP不支持OpenSSL,无法完成商业版授权",
  106. "result" => null,
  107. ));
  108. exit;
  109. }
  110. openssl_public_decrypt(base64_decode($cfg_auth_code), $decotent, DEDEPUB);
  111. $core_info = new stdClass;
  112. if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) {
  113. $client = new DedeBizClient();
  114. $core_info = $client->SystemInfo();
  115. $client->Close();
  116. }
  117. if (!empty($decotent)) {
  118. $res = json_decode($decotent);
  119. if (isset($res->sid)) {
  120. echo json_encode(array(
  121. "code" => 200,
  122. "msg" => "",
  123. "result" => array(
  124. "domain" => $res->domain,
  125. "title" => $res->title,
  126. "stype" => $res->stype == 1 ? "企业" : "个人",
  127. "auth_version" => $res->auth_version,
  128. "auth_at" => date("Y-m-d", $res->auth_at),
  129. "core" => $core_info,
  130. ),
  131. ));
  132. }
  133. }
  134. } elseif ($dopost == 'get_statistics') {
  135. require_once(DEDEINC."/libraries/statistics.class.php");
  136. $sdate = empty($sdate) ? 0 : intval($sdate);
  137. $stat = new DedeStatistics;
  138. $rs = $stat->GetInfoByDate($sdate);
  139. echo json_encode(array(
  140. "code" => 200,
  141. "msg" => "",
  142. "result" => $rs,
  143. ));
  144. exit;
  145. } elseif ($dopost == 'get_statistics_multi') {
  146. require_once(DEDEINC."/libraries/statistics.class.php");
  147. $sdates = empty($sdates) ? array() : explode(",",preg_replace("[^\d\,]","",$sdates)) ;
  148. $stat = new DedeStatistics;
  149. $rs = $stat->GetInfoByDateMulti($sdates);
  150. echo json_encode(array(
  151. "code" => 200,
  152. "msg" => "",
  153. "result" => $rs,
  154. ));
  155. exit;
  156. } elseif ($dopost == 'safe_mode') {
  157. $safemsg = "系统运行模式为安全模式,模板管理、标签管理、数据库管理、模块管理等功能已暂停,如果您需要这些功能,在/system/common.inc.php文件大约第10行代码找到DEDEBIZ_SAFE_MODE后面值TRUE修改为FALSE恢复使用";
  158. $unsafemsg = "系统运行模式为开发模式,模板管理、标签管理、数据库管理、模块管理等功能已恢复,如果您不需要这些功能,在/system/common.inc.php文件大约第10行代码找到DEDEBIZ_SAFE_MODE后面值FALSE修改为TRUE暂停使用";
  159. $modeStr = DEDEBIZ_SAFE_MODE? $safemsg : $unsafemsg;
  160. ShowMsg($modeStr, "javascript:;");
  161. exit;
  162. }
  163. ?>