Source Code Documentation


s2member\includes\classes\s-badge-status-in.inc.php


  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 (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  18. exit ("Do not access this file directly.");
  19.  
  20. if (!class_exists ("c_ws_plugin__s2member_s_badge_status_in"))
  21. {
  22. /**
  23. * Security Badge Status API (inner processing routines).
  24. *
  25. * @package s2Member\Security_Badges
  26. * @since 110524RC
  27. */
  28. class c_ws_plugin__s2member_s_badge_status_in
  29. {
  30. /**
  31. * Handles Security Badge Status API.
  32. *
  33. * @package s2Member\Security_Badges
  34. * @since 110524RC
  35. *
  36. * @attaches-to ``add_action("init");``
  37. *
  38. * @return null Exits script execution after status output.
  39. */
  40. public static function s_badge_status ()
  41. {
  42. do_action ("ws_plugin__s2member_before_s_badge_status", get_defined_vars ());
  43.  
  44. if (!empty ($_GET["s2member_s_badge_status"]))
  45. {
  46. status_header (200); // Send a 200 OK status.
  47.  
  48. header ("Content-Type: text/plain; charset=UTF-8");
  49.  
  50. @ini_set("zlib.output_compression", 0);
  51. if(function_exists("apache_setenv"))
  52. @apache_setenv("no-gzip", "1");
  53.  
  54. while (@ob_end_clean ()); // Clean any existing output buffers.
  55.  
  56. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["s_badge_status_enabled"])
  57. {
  58. if (strlen ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key"]) >= 56)
  59. {
  60. if (defined ("AUTH_KEY") && strlen (AUTH_KEY) >= 60 && stripos (AUTH_KEY, "unique phrase") === false)
  61. if (defined ("SECURE_AUTH_KEY") && strlen (SECURE_AUTH_KEY) >= 60 && stripos (SECURE_AUTH_KEY, "unique phrase") === false)
  62. {
  63. if (defined ("AUTH_SALT") && strlen (AUTH_SALT) >= 60 && stripos (AUTH_SALT, "unique phrase") === false)
  64. if (defined ("SECURE_AUTH_SALT") && strlen (SECURE_AUTH_SALT) >= 60 && stripos (SECURE_AUTH_SALT, "unique phrase") === false)
  65. {
  66. if (defined ("LOGGED_IN_KEY") && strlen (LOGGED_IN_KEY) >= 60 && stripos (LOGGED_IN_KEY, "unique phrase") === false)
  67. if (defined ("LOGGED_IN_SALT") && strlen (LOGGED_IN_SALT) >= 60 && stripos (LOGGED_IN_SALT, "unique phrase") === false)
  68. {
  69. if (defined ("NONCE_KEY") && strlen (NONCE_KEY) >= 60 && stripos (NONCE_KEY, "unique phrase") === false)
  70. if (defined ("NONCE_SALT") && strlen (NONCE_SALT) >= 60 && stripos (NONCE_SALT, "unique phrase") === false)
  71. {
  72. if (defined ("DB_USER") && DB_USER && defined ("DB_PASSWORD") && DB_PASSWORD && DB_USER !== DB_PASSWORD)
  73. {
  74. if (!apply_filters ("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
  75. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"])
  76. {
  77. if ((!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"] && !glob($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"].'/*'))
  78. || $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] !== $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["default_logs_dir"])
  79. {
  80. exit ("1"); // OK good. Things look pretty secure here.
  81. }
  82. }
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. exit ("0"); // Else, NOT secure.
  90. }
  91. else exit ("-"); // Else, service NOT enabled.
  92. }
  93.  
  94. do_action ("ws_plugin__s2member_after_s_badge_status", get_defined_vars ());
  95. }
  96. }
  97. }
  98. ?>

s2member\includes\classes\s-badge-status-in.inc.php

Source Code Documentation