/wp-content/plugins/s2member/includes/classes/s-badge-status-in.inc.php

https://gitlab.com/Gashler/sg · PHP · 98 lines · 60 code · 7 blank · 31 comment · 44 complexity · 34846a4871335ac269c084b5f762f3b7 MD5 · raw file

  1. <?php
  2. /**
  3. * Security Badge Status API (inner processing routines).
  4. *
  5. * Copyright: © 2009-2011
  6. * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
  7. * (coded in the USA)
  8. *
  9. * Released under the terms of the GNU General Public License.
  10. * You should have received a copy of the GNU General Public License,
  11. * along with this software. In the main directory, see: /licensing/
  12. * If not, see: {@link http://www.gnu.org/licenses/}.
  13. *
  14. * @package s2Member\Security_Badges
  15. * @since 110524RC
  16. */
  17. if(!defined('WPINC')) // MUST have WordPress.
  18. exit ("Do not access this file directly.");
  19. if (!class_exists ("c_ws_plugin__s2member_s_badge_status_in"))
  20. {
  21. /**
  22. * Security Badge Status API (inner processing routines).
  23. *
  24. * @package s2Member\Security_Badges
  25. * @since 110524RC
  26. */
  27. class c_ws_plugin__s2member_s_badge_status_in
  28. {
  29. /**
  30. * Handles Security Badge Status API.
  31. *
  32. * @package s2Member\Security_Badges
  33. * @since 110524RC
  34. *
  35. * @attaches-to ``add_action("init");``
  36. *
  37. * @return null Exits script execution after status output.
  38. */
  39. public static function s_badge_status ()
  40. {
  41. do_action("ws_plugin__s2member_before_s_badge_status", get_defined_vars ());
  42. if (!empty($_GET["s2member_s_badge_status"]))
  43. {
  44. status_header (200); // Send a 200 OK status.
  45. header ("Content-Type: text/plain; charset=UTF-8");
  46. @ini_set("zlib.output_compression", 0);
  47. if(function_exists("apache_setenv"))
  48. @apache_setenv("no-gzip", "1");
  49. while (@ob_end_clean ()); // Clean any existing output buffers.
  50. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["s_badge_status_enabled"])
  51. {
  52. if (strlen ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) >= 56)
  53. {
  54. if (defined ("AUTH_KEY") && strlen (AUTH_KEY) >= 60 && stripos (AUTH_KEY, "unique phrase") === false)
  55. if (defined ("SECURE_AUTH_KEY") && strlen (SECURE_AUTH_KEY) >= 60 && stripos (SECURE_AUTH_KEY, "unique phrase") === false)
  56. {
  57. if (defined ("AUTH_SALT") && strlen (AUTH_SALT) >= 60 && stripos (AUTH_SALT, "unique phrase") === false)
  58. if (defined ("SECURE_AUTH_SALT") && strlen (SECURE_AUTH_SALT) >= 60 && stripos (SECURE_AUTH_SALT, "unique phrase") === false)
  59. {
  60. if (defined ("LOGGED_IN_KEY") && strlen (LOGGED_IN_KEY) >= 60 && stripos (LOGGED_IN_KEY, "unique phrase") === false)
  61. if (defined ("LOGGED_IN_SALT") && strlen (LOGGED_IN_SALT) >= 60 && stripos (LOGGED_IN_SALT, "unique phrase") === false)
  62. {
  63. if (defined ("NONCE_KEY") && strlen (NONCE_KEY) >= 60 && stripos (NONCE_KEY, "unique phrase") === false)
  64. if (defined ("NONCE_SALT") && strlen (NONCE_SALT) >= 60 && stripos (NONCE_SALT, "unique phrase") === false)
  65. {
  66. if (defined ("DB_USER") && DB_USER && defined ("DB_PASSWORD") && DB_PASSWORD && DB_USER !== DB_PASSWORD)
  67. {
  68. if ((!apply_filters("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
  69. || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_simultaneous_logins"]) /* Either of these are acceptable. */)
  70. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"])
  71. {
  72. if ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"] && !glob($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"].'/*'))
  73. || $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] !== $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["default_logs_dir"])
  74. {
  75. exit ("1"); // OK good. Things look pretty secure here.
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. exit ("0"); // Else, NOT secure.
  85. }
  86. else exit ("-"); // Else, service NOT enabled.
  87. }
  88. do_action("ws_plugin__s2member_after_s_badge_status", get_defined_vars ());
  89. }
  90. }
  91. }