/** * Builds and handles the Logs page. * * @package s2Member\Menu_Pages * @since 120310 */ public static function logs_page() { do_action('ws_plugin__s2member_before_logs_page', get_defined_vars()); c_ws_plugin__s2member_menu_pages::update_all_options(); c_ws_plugin__s2member_menu_pages::archive_logs_start_fresh(); c_ws_plugin__s2member_menu_pages::delete_logs_start_fresh(); $logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir']; if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) { mkdir($logs_dir, 0777, TRUE) . clearstatcache(); } $htaccess = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'] . '/.htaccess'; $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess']))); if (is_dir($logs_dir) && is_writable($logs_dir) && !file_exists($htaccess)) { file_put_contents($htaccess, $htaccess_contents) . clearstatcache(); } if (!is_dir($logs_dir)) { // If the security-enabled logs directory does not exist yet. c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) does not exist. Please create this directory manually & make it writable (chmod 777).', TRUE); } else { if (!is_writable($logs_dir)) { // If the logs directory is not writable yet. c_ws_plugin__s2member_admin_notices::display_admin_notice('Permissions error. The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) is not writable. Please make this directory writable (chmod 777).', TRUE); } } if (!file_exists($htaccess)) { // If the .htaccess file has not been created yet. c_ws_plugin__s2member_admin_notices::display_admin_notice('The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', TRUE); } else { if (!preg_match('/deny from all/i', file_get_contents($htaccess))) { // Else if the .htaccess file does not offer the required protection. c_ws_plugin__s2member_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', TRUE); } } if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['gateway_debug_logs']) { // Logging disabled? c_ws_plugin__s2member_admin_notices::display_admin_notice('Logging is currently disabled by your configuration.'); } include_once dirname(dirname(__FILE__)) . '/menu-pages/logs.inc.php'; do_action('ws_plugin__s2member_after_logs_page', get_defined_vars()); }
/** * Builds and handles the Logs page. * * @package s2Member\Menu_Pages * @since 120310 * * @return null */ public static function logs_page() { do_action("ws_plugin__s2member_before_logs_page", get_defined_vars()); c_ws_plugin__s2member_menu_pages::update_all_options(); c_ws_plugin__s2member_menu_pages::archive_logs_start_fresh(); c_ws_plugin__s2member_menu_pages::delete_logs_start_fresh(); $logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]; if (!is_dir($logs_dir) && is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) { mkdir($logs_dir, 0777, true) . clearstatcache(); } $htaccess = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] . "/.htaccess"; $htaccess_contents = trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir_htaccess"]))); if (is_dir($logs_dir) && is_writable($logs_dir) && !file_exists($htaccess)) { file_put_contents($htaccess, $htaccess_contents) . clearstatcache(); } if (!is_dir($logs_dir)) { c_ws_plugin__s2member_admin_notices::display_admin_notice('The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) does not exist. Please create this directory manually & make it writable (chmod 777).', true); } else { if (!is_writable($logs_dir)) { c_ws_plugin__s2member_admin_notices::display_admin_notice('Permissions error. The security-enabled logs directory (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($logs_dir)) . '</code>) is not writable. Please make this directory writable (chmod 777).', true); } } if (!file_exists($htaccess)) { c_ws_plugin__s2member_admin_notices::display_admin_notice('The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not exist. Please create this file manually. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', true); } else { if (!preg_match("/deny from all/i", file_get_contents($htaccess))) { c_ws_plugin__s2member_admin_notices::display_admin_notice('Unprotected. The .htaccess protection file (<code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($htaccess)) . '</code>) does not contain <code>deny from all</code>. Inside your .htaccess file, add this:<br /><pre>' . esc_html($htaccess_contents) . '</pre>', true); } } if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) { c_ws_plugin__s2member_admin_notices::display_admin_notice('Logging is currently disabled by your configuration.'); } include_once dirname(dirname(__FILE__)) . "/menu-pages/logs.inc.php"; do_action("ws_plugin__s2member_after_logs_page", get_defined_vars()); return; }