Advertisement
Guest User

Untitled

a guest
May 21st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. <?php
  2.  
  3. function license(array $options = array(), cmstop $cmstop) {
  4. if (defined("INTERNAL")) {
  5. return true;
  6. }
  7. $buy_license_message = "<br />\xe8\xaf\xb7\xe8\x81\x94\xe7\xb3\xbb <a href=\"http://www.cmstop.com/\" target=\"_blank\">CmsTop</a> \xe5\xae\x98\xe6\x96\xb9\xe8\xb4\xad\xe4\xb9\xb0\xe6\x8e\x88\xe6\x9d\x83";
  8. static $license;
  9. if (is_null($license)) {
  10. $file = ROOT_PATH . "license";
  11. if (!is_file($file)) {
  12. $cmstop->showmessage("\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8" . $buy_license_message);
  13. }
  14. if (!is_readable($file) || !strlen($license = file_get_contents($file))) {
  15. $cmstop->showmessage("\xe6\x97\xa0\xe6\xb3\x95\xe8\xaf\xbb\xe5\x8f\x96\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6");
  16. }
  17. $key = "[email protected]";
  18. $license = strrev($license);
  19. $license = base64_decode($license);
  20. $license = substr($license, 10, -15 - strlen($key));
  21. $license = cmstop::licenseDecode($license, $key);
  22. $license = explode("|", $license);
  23. }
  24. if (empty($license)) {
  25. $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe6\x9c\x89\xe8\xaf\xaf" . $buy_license_message);
  26. }
  27. $mobile_expires = $license[9];
  28. $version = $license[8];
  29. $contents = $license[7];
  30. $expires = $license[6];
  31. $admins = $license[5];
  32. $specials = $license[4];
  33. $admindomain = $license[3];
  34. $ip = $license[2];
  35. $domain = $license[1];
  36. $apps = $license[0];
  37. if (!$version) {
  38. $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe6\x9c\x89\xe8\xaf\xaf" . $buy_license_message);
  39. }
  40. static $internal_validate;
  41. if (!$internal_validate) {
  42. if ($expires && $expires < time()) {
  43. $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe5\xb7\xb2\xe8\xbf\x87\xe6\x9c\x9f" . $buy_license_message);
  44. }
  45. $host = $_SERVER["SERVER_NAME"];
  46. if (empty($host)) {
  47. $host = $_SERVER["HTTP_HOST"];
  48. }
  49. if (md5($host) !== $admindomain) {
  50. $cmstop->showmessage("\xe6\x82\xa8\xe5\xbd\x93\xe5\x89\x8d\xe4\xbd\xbf\xe7\x94\xa8\xe7\x9a\x84\xe5\x9f\x9f\xe5\x90\x8d\xe4\xb8\x8e\xe6\x8e\x88\xe6\x9d\x83\xe5\x9f\x9f\xe5\x90\x8d\xe4\xb8\x8d\xe7\xac\xa6" . $buy_license_message);
  51. }
  52. $ip = explode(",", $ip);
  53. $addr = $_SERVER["SERVER_ADDR"];
  54. if (empty($addr)) {
  55. $addr = $_SERVER["LOCAL_ADDR"];
  56. }
  57. if (!in_array($addr, $ip)) {
  58. $cmstop->showmessage("\xe6\x82\xa8\xe5\xbd\x93\xe5\x89\x8d\xe4\xbd\xbf\xe7\x94\xa8\xe7\x9a\x84 IP \xe4\xb8\x8e\xe6\x8e\x88\xe6\x9d\x83 IP \xe4\xb8\x8d\xe7\xac\xa6" . $buy_license_message);
  59. }
  60. $apps = explode(",", $apps);
  61. $license_apps = (array("interview", "survey", "magazine", "paper", "dms", "mobile", "baoliao"));
  62. if (in_array($cmstop->app, $license_apps) && !in_array($cmstop->app, $apps)) {
  63. $cmstop->showmessage("\xe5\xbd\x93\xe5\x89\x8d\xe5\xba\x94\xe7\x94\xa8\xe6\x9c\xaa\xe8\xb4\xad\xe4\xb9\xb0\xe6\x8e\x88\xe6\x9d\x83" . $buy_license_message);
  64. }
  65. $aca = '' . $cmstop->app . "/" . $cmstop->controller . "/" . $cmstop->action;
  66. if ($admins && ($admins_in_db = factory::db()->get("SELECT COUNT(*) AS `total` FROM `#table_admin`")) && ($admins_in_db = intval($admins_in_db["total"]))) {
  67. if ($aca == "system/administrator/add" && $admins < $admins_in_db + 1) {
  68. $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xae\xa1\xe7\x90\x86\xe5\x91\x98\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
  69. }
  70. else {
  71. if ($admins < $admins_in_db) {
  72. $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xae\xa1\xe7\x90\x86\xe5\x91\x98\xe6\x95\xb0\xe8\xb6\x85\xe5\x87\xba\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x95\xb0\xe9\x87\x8f" . $buy_license_message);
  73. }
  74. }
  75. }
  76. if ($specials && ('' . $cmstop->app . "/" . $cmstop->controller == "special/online" || $aca == "special/special/add")) {
  77. $speicals_sql = "SELECT COUNT(*) AS `total` FROM `#table_special`";
  78. if ($version != "special") {
  79. $speicals_sql .= "s LEFT JOIN `#table_content` c ON s.`contentid` = c.`contentid`\n WHERE c.`created` >= " . strtotime(date("Y-01-01 00:00:00", TIME));
  80. }
  81. $specials_in_db = factory::db()->get($speicals_sql);
  82. if ($specials_in_db && ($specials_in_db = intval($specials_in_db["total"]))) {
  83. if ($aca == "special/special/add" && $specials < $specials_in_db + 1) {
  84. $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe4\xb8\x93\xe9\xa2\x98\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
  85. }
  86. else {
  87. if ($specials < $specials_in_db) {
  88. $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe4\xb8\x93\xe9\xa2\x98\xe6\x95\xb0\xe8\xb6\x85\xe5\x87\xba\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x95\xb0\xe9\x87\x8f" . $buy_license_message);
  89. }
  90. }
  91. }
  92. }
  93. if ($mobile_expires) {
  94. define("MOBILE_EXPIRES", $mobile_expires);
  95. }
  96. define("CMSTOP_VERSION", "CmsTop " . ucfirst($version));
  97. $internal_validate = true;
  98. }
  99. if ($contents && !empty($options["contents"]) && $contents * 10000 < $options["contents"]) {
  100. $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xa8\xbf\xe4\xbb\xb6\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
  101. }
  102. return true;
  103. }
  104.  
  105. function admin_log($app, $controller, $action) {
  106. $log = loader::model("admin/admin_log", "system");
  107. $log->insert(array("aca" => $app . "/admin/" . $controller . "/" . $action, "dur" => sprintf("%7.3f", microtime(true) - MICROTIME)));
  108. unset($log);
  109. unset($log);
  110. }
  111. ...............................................................
  112. ...................................
  113. ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement