Base.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <?php
  2. namespace app\admin;
  3. class Base extends \app\system\Base
  4. {
  5. public $siteurl;
  6. function initialize()
  7. {
  8. $_var_0 = "http://" . $_SERVER["HTTP_HOST"];
  9. $this->siteurl = is_ssl() ? str_replace("http://", "https://", $_var_0) : $_var_0;
  10. $_var_1 = db("config")->where("name", "IN_BUILD")->value("value");
  11. if ($_var_1 > IN_BUILD) {
  12. $_var_2 = db("config")->select();
  13. $_var_3 = ["<?php"];
  14. foreach ($_var_2 as $_var_4 => $_var_5) {
  15. if ($_var_5["name"] == "IN_STAT") {
  16. $_var_5["value"] = base64_encode($_var_5["value"]);
  17. }
  18. $_var_3[] = "define('" . $_var_5["name"] . "','" . $_var_5["value"] . "');";
  19. }
  20. $_var_6 = IN_ROOT . "source/system/my.php";
  21. file_put_contents($_var_6, implode("\n", $_var_3));
  22. }
  23. }
  24. function Administrator($_var_7)
  25. {
  26. if (!isAdminLogin()) {
  27. $this->ShowMessage("未登录或登录已过期,请重新登录管理中心!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 0);
  28. }
  29. setcookie("in_adminexpire", $_COOKIE["in_adminexpire"], time() + 36000);
  30. $_var_8 = explode(",", $_COOKIE["in_permission"]);
  31. $_var_9 = false;
  32. for ($_var_10 = 0; $_var_10 < count($_var_8); $_var_10++) {
  33. if ($_var_8[$_var_10] == $_var_7) {
  34. $_var_9 = true;
  35. }
  36. }
  37. if (!$_var_9) {
  38. $this->ShowMessage("权限不够,无法进入此页面!", "?c=body", "infotitle3", 3000, 0);
  39. }
  40. }
  41. function header($exclude = [])
  42. {
  43. if (in_array($this->action, $exclude)) {
  44. return null;
  45. }
  46. ?><!DOCTYPE html >
  47. <html lang="">
  48. <head>
  49. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo IN_CHARSET;?>"/>
  50. <meta http-equiv="x-ua-compatible" content="ie=7"/>
  51. <title><?php echo IN_NAME;?></title>
  52. <link rel="stylesheet" href="/xinadmin/lib/layui/css/layui.css">
  53. <link rel="stylesheet" href="/static/pack/layui/css/layui.css" media="all">
  54. <link href="/static/admincp/css/main.css" rel="stylesheet" type="text/css"/>
  55. <script src="/static/pack/layer/jquery.js"></script>
  56. <script src="/static/pack/layui/layui.js"></script>
  57. <script src="/static/pack/layer/lib.js"></script>
  58. <script src="/static/pack/layer/confirm-lib.js"></script>
  59. <style type="text/css">
  60. .itemtitle h3 {
  61. float: left;
  62. margin-right: 20px;
  63. line-height: 30px;
  64. width: 100px;
  65. display: block;
  66. text-align: center;
  67. text-decoration: none;
  68. margin-right: 1px;
  69. padding: 0px;
  70. background: #1f282d;
  71. border: 1px solid #fff;
  72. color: #fbf9f9;
  73. }
  74. .x-nav {
  75. padding: 0px 20px;
  76. position: relative;
  77. z-index: 99;
  78. border-bottom: 1px solid rgb(229, 229, 229);
  79. line-height: 39px;
  80. height: 49px;
  81. overflow: hidden;
  82. }
  83. </style>
  84. </head>
  85. <body><?php
  86. }
  87. function nav3()
  88. {
  89. $_var_11 = SafeRequest("c", "get");
  90. function getTitle($_var_12)
  91. {
  92. if (empty($_var_12["pid"]) && empty($_var_12["name"])) {
  93. return "";
  94. }
  95. $_var_13 = db("action")->where("id", $_var_12["pid"])->find();
  96. return getTitle($_var_13) . " - " . $_var_12["name"];
  97. }
  98. $_var_14 = db("action")->where("c", $_var_11)->where("a", $this->action)->where("pid", "<>", "0")->find();
  99. $_var_15 = IN_NAME . "管理中心 - " . getTitle($_var_14);
  100. if ($_var_14) {
  101. $_var_16 = db("action")->where("pid", $_var_14["pid"])->where("status", "1")->select();
  102. $_var_17 = db("action")->where("pid", $_var_14["id"])->where("status", "1")->select();
  103. if (count($_var_16)) {
  104. ?> <script>
  105. parent.document.title = "<?php echo $_var_15;?>";
  106. if (parent.$('#admincpnav'))
  107. parent.$('#admincpnav').innerHTML = "<?php echo $_var_15;?>";
  108. </script>
  109. <div class="x-nav">
  110. <a class="layui-btn layui-btn-primary layui-btn-small" style="line-height:1.6em;margin-top:3px;float:left" href="javascript:location.replace(location.href);" title="刷新">
  111. <i class="layui-icon" style="line-height:38px">ဂ</i></a>
  112. </div>
  113. <?php
  114. }
  115. if (count($_var_17)) {
  116. ?> <table class="tb tb2">
  117. <tr>
  118. <td>
  119. <?php
  120. foreach ($_var_17 as $_var_18 => $_var_19) {
  121. ?> <a href="?c=<?php echo $_var_19["c"];?>&a=<?php echo $_var_19["a"];?><?php echo $_var_19["p"] ? "&" . $_var_19["p"] : "";?>">
  122. <input type="button" value="<?php echo $_var_19["name"];?>" class="btn"/></a>
  123. <?php
  124. }
  125. ?> </td>
  126. </tr>
  127. </table>
  128. <?php
  129. }
  130. }
  131. }
  132. function searchForm($mark = '', $before = '', $middle = '', $after = '')
  133. {
  134. ?> <form name="btnsearch" method="get" action="<?php echo $_SERVER["PHP_SELF"];?>">
  135. <?php
  136. if ($mark) {
  137. ?> <table class="tb tb2">
  138. <tr>
  139. <td class="tipsblock">
  140. <ul>
  141. <li><?php echo $mark;?></li>
  142. </ul>
  143. </td>
  144. </tr>
  145. </table>
  146. <?php
  147. }
  148. ?> <table class="tb tb2">
  149. <tr>
  150. <td>
  151. <?php
  152. if ($before) {
  153. $before();
  154. }
  155. ?> <input type="hidden" name="c" value="<?php echo $this->module;?>">
  156. <input type="hidden" name="a" value="<?php echo $this->action;?>">
  157. 关键词:<input class="txt" x-webkit-speech type="search" name="search" value="<?php
  158. if (isset($this->search)) {
  159. ?><?php echo $this->search;?><?php
  160. }
  161. ?>"/>
  162. <?php
  163. if ($middle) {
  164. $middle();
  165. }
  166. ?> 时间:<input class="txt" type="text" name="start_time" id="start_time">-
  167. <input class="txt" type="text" name="end_time" id="end_time">
  168. <input type="button" value="搜索" class="layui-btn layui-btn-sm layui-btn-normal" onclick="document.btnsearch.submit();"/>
  169. <input class="layui-btn layui-btn-sm layui-btn-normal" type="reset" value="重置">
  170. <?php
  171. if ($after) {
  172. $after();
  173. }
  174. ?> </td>
  175. </tr>
  176. </table>
  177. </form>
  178. <?php
  179. }
  180. function mapTime($field, $isInt = false, &$map = [])
  181. {
  182. $this->start_time = SafeRequest("start_time", "get");
  183. $this->start_time && ($map[] = [$field, ">=", $isInt ? strtotime($this->start_time) . "" : $this->start_time]);
  184. $this->end_time = SafeRequest("end_time", "get");
  185. $_var_20 = strtotime("+1days", strtotime($this->end_time));
  186. $_var_21 = date("Y-m-d", $_var_20);
  187. $this->end_time && ($map[] = [$field, "<=", $isInt ? $_var_20 : $_var_21]);
  188. }
  189. function render($_var_22, $_var_23 = false)
  190. {
  191. if ($_var_22) {
  192. $_var_22 = "<table class=\"tb tb2\"><tr><td>" . $_var_22 . "</td></tr></table>";
  193. }
  194. if ($_var_23) {
  195. echo $_var_22;
  196. }
  197. return $_var_22;
  198. }
  199. function footer($exclude = [])
  200. {
  201. if (in_array($this->action, $exclude)) {
  202. return null;
  203. }
  204. $_var_24 = $_var_25 = "";
  205. if (isset($this->start_time)) {
  206. $_var_24 = $this->start_time;
  207. $_var_24 = is_numeric($_var_24) ? date("Y-m-d", $_var_24) : $_var_24;
  208. }
  209. if (isset($this->end_time)) {
  210. $_var_25 = $this->end_time;
  211. $_var_25 = is_numeric($_var_25) ? date("Y-m-d", $_var_25) : $_var_25;
  212. }
  213. ?> <script>
  214. layui.use(['laydate', 'layer'], function () {
  215. var laydate = layui.laydate;
  216. layer = layui.layer;
  217. //执行一个laydate实例
  218. laydate.render({
  219. elem: '#start_time', //指定元素
  220. type: 'date',
  221. value: "<?php echo $_var_24;?>"
  222. });
  223. //执行一个laydate实例
  224. laydate.render({
  225. elem: '#end_time', //指定元素
  226. type: 'date',
  227. value: "<?php echo $_var_25;?>"
  228. });
  229. });
  230. var pop = {
  231. up: function (scrolling, text, url, width, height, top) {
  232. layer.open({
  233. type: 2,
  234. maxmin: true,
  235. title: text,
  236. content: [url, scrolling],
  237. area: [width, height],
  238. offset: top,
  239. shade: false
  240. });
  241. }
  242. };
  243. function CheckAll(form) {
  244. for (var i = 0; i < form.elements.length; i++) {
  245. var e = form.elements[i];
  246. if (e.name != 'chkall') {
  247. e.checked = form.chkall.checked;
  248. }
  249. }
  250. all_save(form);
  251. }
  252. function all_save(form) {
  253. if (form.chkall.checked) {
  254. layer.tips('删除操作不可逆,请谨慎操作!', '#chkall', {
  255. tips: 3
  256. });
  257. }
  258. }
  259. /**
  260. * @return {boolean}
  261. */
  262. function CheckForm() {
  263. if (document.form.in_adminname.value == "") {
  264. layer.msg("登录帐号不能为空,请填写!", {icon: 1, time: 2000});
  265. document.form.in_adminname.focus();
  266. return false;
  267. } else {
  268. return true;
  269. }
  270. }
  271. function del_msg(href) {
  272. layer.confirm('删除操作不可逆,确认继续?', {
  273. btn: ['确认', '取消'] //按钮
  274. }, function () {
  275. location.href = href;
  276. });
  277. }
  278. //删除管理员确定窗口
  279. function del_msg1(href) {
  280. layer.confirm('删除操作不可逆,确认继续?', {
  281. btn: ['确认', '取消'] //按钮
  282. }, function () {
  283. $.ajax({
  284. type: 'GET',
  285. url: href,
  286. dataType: 'json',
  287. success: function (str) {
  288. if (str.status == "1") {
  289. layer.alert(str.msg,function(){
  290. window.location.reload();
  291. });
  292. }
  293. }
  294. });
  295. });
  296. }
  297. //删除应用
  298. function del_msgyy(href) {
  299. layer.confirm('确定删除此应用?', {
  300. btn: ['确认', '取消'] //按钮
  301. }, function () {
  302. location.href = href;
  303. });
  304. }
  305. //删除授权码
  306. function del_msgsqm(href) {
  307. layer.confirm('确定删除此授权码?', {
  308. btn: ['确认', '取消'] //按钮
  309. }, function () {
  310. location.href = href;
  311. });
  312. }
  313. //删除会员
  314. function del_msghy(href) {
  315. layer.confirm('确定删除此会员?', {
  316. btn: ['确认', '取消'] //按钮
  317. }, function () {
  318. location.href = href;
  319. });
  320. }
  321. function dosearch() {
  322. document.btnsearch.submit();
  323. }
  324. </script>
  325. </body></html><?php
  326. }
  327. function kindeditor()
  328. {
  329. ?> <link rel="stylesheet" href="/static/pack/kindeditor/themes/default/default.css"/>
  330. <script charset="utf-8" src="/static/pack/kindeditor/kindeditor-all-min.js"></script>
  331. <script charset="utf-8" src="/static/pack/kindeditor/lang/zh-CN.js"></script>
  332. <script>
  333. var editor;
  334. KindEditor.ready(function (K) {
  335. editor = K.create('textarea[name="content"]', {
  336. // allowFileManager: true,
  337. uploadJson: '/upload/index/kindeditor',
  338. themeType: 'simple',
  339. afterBlur: function () {
  340. this.sync();
  341. }
  342. });
  343. });
  344. </script>
  345. <?php
  346. }
  347. function editemplate($_var_26 = '')
  348. {
  349. ?><div class="container"><?php echo $this->nav3();?><table class="tb tb2"><?php echo $_var_26;?></table></div><?php
  350. }
  351. function mainjump()
  352. {
  353. ?><meta http-equiv="Content-Type" content="text/html; charset=<?php echo IN_CHARSET;?>" /><style type="text/css">body{background:#F2F9FD;}</style><?php
  354. }
  355. function Menu_App()
  356. {
  357. global $develop_auth;
  358. $_var_27 = "<li><a href=\"" . (is_ssl() ? str_replace("http://", "https://", $develop_auth) : $develop_auth) . "\" hidefocus=\"true\" target=\"main\"><em onclick=\"menuNewwin(this)\" title=\"新窗口打开\"></em>应用中心</a></li>";
  359. $_var_28 = "<li><a href=\"?c=module\" hidefocus=\"true\" target=\"main\"><em onclick=\"menuNewwin(this)\" title=\"新窗口打开\"></em>所有应用</a></li>";
  360. $_var_29 = "";
  361. $_var_30 = db("plugin")->where("in_type>0")->order("in_addtime desc")->select();
  362. foreach ($_var_30 as $_var_31) {
  363. $_var_29 = $_var_29 . "<li><a href=\"plugin.php/" . $_var_31["in_dir"] . "/" . $_var_31["in_file"] . "/\" hidefocus=\"true\" target=\"main\"><em onclick=\"menuNewwin(this)\" title=\"新窗口打开\"></em>" . $_var_31["in_name"] . "</a></li>";
  364. }
  365. return $_var_27 . $_var_28 . $_var_29;
  366. }
  367. function ShowMessage1($in_msg, $in_url, $in_style, $in_time, $in_type)
  368. {
  369. ?><script>layer.alert("<?php echo $in_msg ?>"); window.location.reload();</script><?php
  370. exit;
  371. }
  372. function ShowMessage($in_msg, $in_url, $in_style, $in_time, $in_type)
  373. {
  374. if ($in_type == 1) {
  375. ?><div class="container"><div class="infobox"><h4 class="<?php echo $in_style;?>"><?php echo $in_msg;?></h4><script type="text/javascript">setTimeout("location.href='<?php echo $in_url;?>';",<?php echo $in_time;?>);</script><p class="marginbot"><a href="<?php echo $in_url;?>" class="lightlink">3秒后返回,可点击这里立即返回</a></p></div></div><?php
  376. } elseif ($in_type == 2) {
  377. ?><div class="container"><h3>提示</h3><div class="infobox"><h4 class="<?php echo $in_style;?>"><?php echo $in_msg;?></h4><script type="text/javascript">setTimeout("<?php echo $in_url;?>",<?php echo $in_time;?>);</script><p class="marginbot"><a href="javascript:history.go(-1);" class="lightlink">如果您的浏览器没有自动跳转,请点击这里</a></p></div></div><?php
  378. } else {
  379. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo IN_CHARSET;?>" /><meta http-equiv="x-ua-compatible" content="ie=7" /><title>提示信息</title><link href="<?php echo IN_PATH;?>static/admincp/css/main.css" rel="stylesheet" type="text/css" /></head><body><div class="container"><h3>提示</h3><div class="infobox"><h4 class="<?php echo $in_style;?>"><?php echo $in_msg;?></h4><script type="text/javascript">setTimeout("location.href='<?php echo $in_url;?>';",<?php echo $in_time;?>);</script><p class="marginbot"><a href="<?php echo $in_url;?>" class="lightlink">如果您的浏览器没有自动跳转,请点击这里</a></p></div></div><?php
  380. }
  381. ?></body></html><?php
  382. exit;
  383. }
  384. }