Base.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. namespace app\index;
  4. use app\aliyunoss\Aliyunoss;
  5. use app\qiniuoss\Qiniuoss;
  6. class Base extends \app\system\Base
  7. {
  8. public $info;
  9. public $mobule;
  10. public $action;
  11. public $userlogined;
  12. public $userid;
  13. public $username;
  14. public $userpassword;
  15. public $user;
  16. function initialize()
  17. {
  18. if (isset($this->info) && !in_array($this->info, array("upload"))) {
  19. if (isset($this->module) && in_array($this->module, array("apps", "app_sign", "tf", "price", "price", "utils", "promote", "login", "lost", "reg", "user_profile", "user_order", "user_aclog", "user_promote", "user_cash"))) {
  20. Chk_authkey();
  21. }
  22. }
  23. if (IN_OPEN == 0) {
  24. exit(html_message("维护通知", IN_OPENS));
  25. }
  26. db("appid")->where("in_sign", ">", "0")->where("in_sign", "<", time())->update(array("in_sign" => 0, "in_resign" => 0));
  27. $this->userid = isset($_COOKIE["in_userid"]) ? intval($_COOKIE["in_userid"]) : 0;
  28. $this->username = isset($_COOKIE["in_username"]) ? SafeSql($_COOKIE["in_username"]) : NULL;
  29. $this->userpassword = isset($_COOKIE["in_userpassword"]) ? SafeSql($_COOKIE["in_userpassword"]) : NULL;
  30. $this->user = db("user")->where("in_userid", $this->userid)->where("in_username", $this->username)->where("in_userpassword", $this->userpassword)->where("in_islock", "0")->find();
  31. if ($this->user) {
  32. $this->userlogined = true;
  33. } else {
  34. $this->userlogined = false;
  35. }
  36. $this->super_clear();
  37. }
  38. function ajax_header()
  39. {
  40. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  41. header("Cache-Control: no-cache, must-revalidate");
  42. header("Pragma: no-cache");
  43. header("Content-type: text/html;charset=" . IN_CHARSET);
  44. }
  45. function header()
  46. {
  47. include_once "public/header.php";
  48. }
  49. function static_()
  50. {
  51. ?> <link rel="stylesheet" href="//at.alicdn.com/t/font_780494_fdjuk9baed7.css"/>
  52. <link rel="stylesheet" href="/static/pack/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
  53. <link rel="stylesheet" href="/static/index/css/base.css"/>
  54. <link rel="stylesheet" href="/static/index/css/main.css"/>
  55. <link rel="stylesheet" href="/static/index/css/h5.css"/>
  56. <script charset="utf-8" src="/static/index/js/jquery.min.js"></script>
  57. <script charset="utf-8" src="/static/index/js/bootstrap.min.js"></script>
  58. <script charset="utf-8" src="/static/index/js/js.js"></script>
  59. <link rel="shortcut icon" href="//<?php echo $_SERVER["HTTP_HOST"];?>/favicon.ico" type="image/x-icon"/>
  60. <script>
  61. isHideFooter = false;
  62. </script>
  63. <?php
  64. }
  65. function footer()
  66. {
  67. include_once "public/footer.php";
  68. }
  69. function super_clear($_var_0 = 0)
  70. {
  71. $_var_1 = array();
  72. $_var_0 && ($_var_1[] = array("app_id", "=", $_var_0));
  73. $_var_2 = is_numeric(IN_SUPER_CLEAR_INTERVAL) && IN_SUPER_CLEAR_INTERVAL ? IN_SUPER_CLEAR_INTERVAL : 4;
  74. $_var_3 = db("super_sign")->where($_var_1)->where("clear_time", "0")->whereTime("update_time", "<", strtotime("- " . $_var_2 . " hours"))->paginate()->items();
  75. if ($_var_3) {
  76. $_var_4 = IN_REMOTE == 1 ? new Qiniuoss() : new Aliyunoss();
  77. foreach ($_var_3 as $_var_5 => $_var_6) {
  78. @unlink($_var_6["ipa_path"]);
  79. @unlink($_var_6["plist_path"]);
  80. if (IN_MANDATORY_REMOTE || $_var_6["remote"]) {
  81. @$_var_4->delete($_var_6["ipa_path"]);
  82. }
  83. db("super_sign")->where("id", $_var_6["id"])->update(array("clear_time" => time()));
  84. }
  85. }
  86. }
  87. }