function s2_personal_page($user_id)
{
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $post = array();
    $post['post_name'] = $username;
    $post['post_type'] = 'page';
    $post['post_content'] = esc_attr(get_option(S2MEMBER_PRIVATE_PAGE_OPTION_PREFIX . 'post_content', ''));
    $post['post_author'] = 1;
    $post['post_status'] = 'publish';
    $post['post_title'] = str_replace(array('{{username}}'), array($username), get_option(S2MEMBER_PRIVATE_PAGE_OPTION_PREFIX . 'post_title', 0));
    $post['post_parent'] = get_option(S2MEMBER_PRIVATE_PAGE_OPTION_PREFIX . 'post_parent', 0);
    $post_id = wp_insert_post($post);
    if (!$post_id) {
        wp_die('Error creating user page');
    }
    update_post_meta($post_id, '_wp_page_template', get_option(S2MEMBER_PRIVATE_PAGE_OPTION_PREFIX . 'post_template', 'page.php'));
    $user = new WP_User($user_id);
    $user->add_cap(sprintf('access_s2member_ccap_%s', $username));
    update_post_meta($post_id, 's2member_ccaps_req', $username);
    $new_options = array();
    // s2member array for security level
    $new_options["ws_plugin__s2member_level0_pages"] = $post_id;
    // set Level0 for this Page
    // s2member update
    c_ws_plugin__s2member_menu_pages::update_all_options($new_options, true, false, array("page-conflict-warnings"), true);
    return;
}
function create_member_page($user_id)
{
    $user_info = get_userdata($user_id);
    $username = $user_info->user_login;
    $post = array();
    $post['post_name'] = $username;
    // The slug for the page
    $post['post_type'] = 'page';
    //sets type
    $post['post_content'] = esc_attr($username . ' - This page was created for you and any messages that we need to send you with regards to any products, services or changes to your membership will be posted here.' . $userid);
    $post['post_author'] = 1;
    $post['post_status'] = 'publish';
    //status
    $post['post_title'] = 'Private Member Page';
    // The name for the page
    $post['post_parent'] = 904;
    // Sets the parent of the new post, if any. Default 0.
    $post_id = wp_insert_post($post);
    if (!$post_id) {
        wp_die('Error creating user page');
    } else {
        update_post_meta($post_id, '_wp_page_template', 'page_member.php');
        $user = new WP_User($user_id);
        $user->add_cap("access_s2member_ccap_{$username}");
        update_post_meta($post_id, 's2member_ccaps_req', "{$username}");
        $new_options = array();
        // s2member array for security level
        $new_options["ws_plugin__s2member_level0_pages"] = $post_id;
        // set Level0 for this Page
        c_ws_plugin__s2member_menu_pages::update_all_options($new_options, true, false, array("page-conflict-warnings"), true);
        // s2member update
    }
    return;
}
Example #3
0
 /**
  * API instance.
  *
  * @since 141004
  * @package s2Member\List_Servers
  *
  * @return AWeberAPI|null AWeber API instance.
  */
 public static function aw_api()
 {
     if (!$GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_api_key']) {
         return NULL;
     }
     // Not possible.
     if (!class_exists('AWeberAPI')) {
         // Include the AWeber API class here.
         include_once dirname(dirname(__FILE__)) . '/externals/aweber/aweber_api.php';
     }
     if (count($key_parts = explode('|', $GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_api_key'])) < 5) {
         return NULL;
     }
     // It's an invalid API key; i.e., authorization code.
     list($consumerKey, $consumerSecret, $requestToken, $tokenSecret, $verifier) = $key_parts;
     $internal_api_key_checksum = md5($consumerKey . $consumerSecret . $requestToken . $tokenSecret . $verifier);
     if (count($internal_key_parts = explode('|', $GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_internal_api_key'])) >= 5) {
         list(, , , , $checksum) = $internal_key_parts;
     }
     // Only need checksum for now.
     if (empty($checksum) || $checksum !== $internal_api_key_checksum) {
         try {
             $aw_api = new AWeberAPI($consumerKey, $consumerSecret);
             $aw_api->user->requestToken = $requestToken;
             $aw_api->user->tokenSecret = $tokenSecret;
             $aw_api->user->verifier = $verifier;
             if (!is_array($accessToken = $aw_api->getAccessToken()) || count($accessToken) < 2) {
                 return NULL;
             }
             // Not possible.
             list($accessTokenKey, $accessTokenSecret) = $accessToken;
             if (!$accessTokenKey || !$accessTokenSecret) {
                 return NULL;
             }
             // Not possible.
             $GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_internal_api_key'] = $internal_api_key = $consumerKey . '|' . $consumerSecret . '|' . $accessTokenKey . '|' . $accessTokenSecret . '|' . $internal_api_key_checksum;
             c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_aweber_internal_api_key' => $internal_api_key), TRUE, FALSE, FALSE, FALSE, FALSE);
         } catch (Exception $exception) {
             return NULL;
             // API initialization failure.
         }
     }
     if (count($internal_key_parts = explode('|', $GLOBALS['WS_PLUGIN__']['s2member']['o']['aweber_internal_api_key'])) < 5) {
         return NULL;
     }
     // It's an invalid internal API key. Cannot continue.
     list($consumerKey, $consumerSecret, $accessTokenKey, $accessTokenSecret, $checksum) = $internal_key_parts;
     try {
         $aw_api = new AWeberAPI($consumerKey, $consumerSecret);
         $aw_api->___account = $aw_api->getAccount($accessTokenKey, $accessTokenSecret);
         return $aw_api;
         // AWeberAPI instance.
     } catch (Exception $exception) {
         return NULL;
         // API initialization failure.
     }
 }
 /**
  * Builds the options panel for this Payment Gateway.
  *
  * @package s2Member\Menu_Pages
  * @since 1.5
  *
  * @return null
  */
 public static function alipay_ops_page()
 {
     c_ws_plugin__s2member_menu_pages::update_all_options();
     // Updates options.
     $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 ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["gateway_debug_logs"]) {
         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 &amp; 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);
             }
         }
     }
     include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/menu-pages/alipay-ops.inc.php";
     return;
 }
Example #5
0
 /**
  * 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 &amp; 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());
 }
 public function __construct()
 {
     echo '<div class="wrap ws-menu-page">' . "\n";
     echo '<div class="ws-menu-page-toolbox">' . "\n";
     c_ws_plugin__s2member_menu_pages_tb::display();
     echo '</div>' . "\n";
     echo '<h2>Imports / Exports</h2>' . "\n";
     echo '<table class="ws-menu-page-table">' . "\n";
     echo '<tbody class="ws-menu-page-table-tbody">' . "\n";
     echo '<tr class="ws-menu-page-table-tr">' . "\n";
     echo '<td class="ws-menu-page-table-l">' . "\n";
     if (isset($_REQUEST['enable_advanced_tools'])) {
         c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_pro_import_export_advanced_mode' => (string) (int) $_REQUEST['enable_advanced_tools']), TRUE, FALSE, FALSE, FALSE, FALSE);
     }
     $enable_advanced_tools = $GLOBALS['WS_PLUGIN__']['s2member']['o']['pro_import_export_advanced_mode'];
     if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
         if (!$enable_advanced_tools) {
             echo '<p><i class="fa fa-eye"></i> <a href="' . esc_attr(add_query_arg('enable_advanced_tools', '1')) . '">click here to enable the Advanced Import/Export Tools</a> <i class="fa fa-eye"></i></p>';
         } else {
             echo '<p><i class="fa fa-eye-slash"></i> <a href="' . esc_attr(add_query_arg('enable_advanced_tools', '0')) . '">click here to disable the Advanced Import/Export Tools</a> <i class="fa fa-eye-slash"></i></p>';
         }
     }
     /*
      * Advanced version.
      */
     if ($enable_advanced_tools) {
         echo '<div class="ws-menu-page-group" title="Advanced User/Member CSV Importation"' . (isset($_POST["ws_plugin__s2member_pro_import_users"]) ? ' default-state="open"' : '') . '>' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-user-importation-section">' . "\n";
         echo '<h3>User/Member Importation (upload file / or direct input)</h3>' . "\n";
         echo '<p>Import files can be uploaded in CSV format, or you can copy/paste data into the form field provided. In either case, you must follow the <a href="http://www.s2member.com/kb/advanced-import-tools/" target="_blank" rel="external">examples given here</a>. Please double-check your data before clicking the Import button. Make sure that all data fields are properly encapsulated by double-quotes, and separated by commas. After importing Users/Members, you can inspect your work by going to: <strong>WordPress → Users</strong>.</p>' . "\n";
         echo '<p><em><strong>No Email Notification:</strong> This import routine works silently. Users/Members will not be contacted by s2Member—that is, unless you have another plugin installed that conflicts with s2Member\'s ability to perform the Import properly. You should always test one or two accounts before importing a large number of Users all at once. If you want Users/Members to be contacted, you can add them manually, by going to <strong>WordPress → Users → Add New</strong>, and selecting one of the s2Member Roles from the drop-down menu.</em></p>' . "\n";
         echo version_compare(PHP_VERSION, "5.3", "<") ? '<p><em><strong>PHP v5.3+ recommended:</strong> In order for s2Member to properly import CSV files containing escape sequences, PHP v5.3 or higher is required. While s2Member may be able to parse import files in most cases, PHP v5.3 provides the best stability.</em></p>' . "\n" : '';
         echo '<p class="info"><em><strong>Advanced:</strong> This importer uses an entirely different format. See <a href="http://www.s2member.com/kb/advanced-import-tools/" target="_blank" rel="external">this KB article for details</a>.</em></p>' . "\n";
         echo '<p class="warning"><em><strong>Important Warning:</strong> Please do not attempt to import a file that you originally exported with the default s2Member User Export system; it is not compatible. This tool uses an entirely different format; i.e., the Advanced Export Tool format is required here. Importing with the wrong format may result in User database table corruption.</em></p>' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<form method="post" enctype="multipart/form-data" name="ws_plugin__s2member_pro_import_users_form" id="ws-plugin--s2member-pro-import-users-form" autocomplete="off">' . "\n";
         echo '<input type="hidden" name="ws_plugin__s2member_pro_import_users" id="ws-plugin--s2member-pro-import-users" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-import-users")) . '" />' . "\n";
         echo '<input type="file" name="ws_plugin__s2member_pro_import_users_file" id="ws-plugin--s2member-pro-import-users-file" />&nbsp;&nbsp;&nbsp;(up to 1000 lines per file)&nbsp;&nbsp;&nbsp;<input type="submit" value="Import Now" style="font-size:120%; font-weight:normal;" /><br /><br />' . "\n";
         echo '<textarea name="ws_plugin__s2member_pro_import_users_direct_input" id="ws-plugin--s2member-pro-import-users-direct-input" rows="10" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit(trim(stripslashes(@$_POST["ws_plugin__s2member_pro_import_users_direct_input"]))) . '</textarea><br />' . "\n";
         echo 'One User/Member per line please. See <a href="http://www.s2member.com/kb/advanced-import-tools/" target="_blank" rel="external">this KB article for details</a>.' . "\n";
         echo '</form>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     /*
      * Simple version.
      */
     if (!$enable_advanced_tools) {
         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo '<div class="ws-menu-page-group" title="User/Member CSV Importation"' . (isset($_POST["ws_plugin__s2member_pro_import_simple_users"]) ? ' default-state="open"' : '') . '>' . "\n";
             echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-user-importation-section">' . "\n";
             echo '<h3>User/Member Importation (upload file / or direct input)</h3>' . "\n";
             echo '<p>Import files can be uploaded in CSV format, or you can copy/paste data into the form field provided. In either case, you must follow the examples given below. Please double-check your data before clicking the Import button. Make sure that all data fields are properly encapsulated by double-quotes, and separated by commas. You\'ll also need to make sure that all of your data fields are in the proper order, based on the examples given below. After importing Users/Members, you can inspect your work by going to: <strong>WordPress → Users</strong>.</p>' . "\n";
             echo '<p><em><strong>No Email Notification:</strong> This import routine works silently. Users/Members will not be contacted by s2Member—that is, unless you have another plugin installed that conflicts with s2Member\'s ability to perform the Import properly. You should always test one or two accounts before importing a large number of Users all at once. If you want Users/Members to be contacted, you can add them manually, by going to <strong>WordPress → Users → Add New</strong>, and selecting one of the s2Member Roles from the drop-down menu.</em></p>' . "\n";
             echo version_compare(PHP_VERSION, "5.3", "<") ? '<p><em><strong>PHP v5.3+ recommended:</strong> In order for s2Member to properly import CSV files containing escape sequences, PHP v5.3 or higher is required. While s2Member may be able to parse import files in most cases, PHP v5.3 provides the best stability.</em></p>' . "\n" : '';
             echo '<table class="form-table">' . "\n";
             echo '<tbody>' . "\n";
             echo '<tr>' . "\n";
             echo '<td>' . "\n";
             echo '<form method="post" enctype="multipart/form-data" name="ws_plugin__s2member_pro_import_users_form" id="ws-plugin--s2member-pro-import-users-form" autocomplete="off">' . "\n";
             echo '<input type="hidden" name="ws_plugin__s2member_pro_import_simple_users" id="ws-plugin--s2member-pro-import-users" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-import-users")) . '" />' . "\n";
             echo '<input type="file" name="ws_plugin__s2member_pro_import_users_file" id="ws-plugin--s2member-pro-import-users-file" />&nbsp;&nbsp;&nbsp;(up to 1000 lines per file)&nbsp;&nbsp;&nbsp;<input type="submit" value="Import Now" style="font-size:120%; font-weight:normal;" /><br /><br />' . "\n";
             echo '<textarea name="ws_plugin__s2member_pro_import_users_direct_input" id="ws-plugin--s2member-pro-import-users-direct-input" rows="10" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit(trim(stripslashes(@$_POST["ws_plugin__s2member_pro_import_users_direct_input"]))) . '</textarea><br />' . "\n";
             echo 'One User/Member per line please. Here is a quick example:<br />' . "\n";
             echo '<code>"ID","Username","First Name","Last Name","Display Name","Email"</code>' . "\n";
             echo '<div class="ws-menu-page-hr"></div>' . "\n";
             echo 'If you fill the ID field, the Import routine will update an account matching the ID you specify (so long as the account ID does not belong to an Administrator, this is for security). When importing new Users/Members, you can leave the ID field empty Don\'t remove it, just leave it empty(i.e., <code>""</code>).<br /><br />' . "\n";
             echo 'Example: <code>"","Username","First Name","Last Name","Display Name","Email"</code><br /><br />' . "\n";
             echo 'Additional extended information can also be included; even Custom Registration/Profile Fields:<br />' . "\n";
             echo '<code>"ID","Username","First Name","Last Name","Display Name","Email","Website","Level[0-9]+ or Role ID","Custom Capabilities","Registration Date (mm/dd/yyyy)","First Payment Date (mm/dd/yyyy)","Last Payment Date (mm/dd/yyyy)","Auto-EOT Date (mm/dd/yyyy)","Custom Value (starts w/domain)","Paid Subscr. ID","Paid Subscr. Gateway","Custom Registration/Profile Field Value","another Custom Registration/Profile Field Value", ... and so on—for as many Custom Registration/Profile Fields that you\'d like import.</code><br /><br />' . "\n";
             echo 'Here is a full example with all fields filled in, including extended details; and two Custom Field values:<br />' . "\n";
             echo '<code>"","johnsmith22","John","Smith","John Smith","*****@*****.**","http://www.example.com/","2","music,videos","12/31/2000","01/10/2001","12/31/2020","12/31/2021","www.example.com|123.357.125.654","I-2342934SSER243","paypal","fishing,biking,computers","xx-large"</code><br /><br />' . "\n";
             echo 'Here is a full example with some fields left empty:<br />' . "\n";
             echo '<code>"","johnsmith22","John","Smith","John Smith","*****@*****.**","","s2member_level2","","","","","12/31/2021"</code>' . "\n";
             echo '<div class="ws-menu-page-hr"></div>' . "\n";
             echo '<em>* If you supply a Paid Subscr. Gateway, you must use one of these values: <code>paypal</code>, <code>alipay</code>, <code>authnet</code>, <code>ccbill</code>, <code>clickbank</code>, <code>google</code>.</em><br /><br />' . "\n";
             echo '<em>* If you supply Custom Fields, your Custom Field values should be listed in alphabetical order, based on your Custom Field IDs (i.e., values listed in the order of your alphabetized Custom Field IDs). This is based on the Custom Field IDs you\'ve configured with s2Member. See: <strong>s2Member → General Options → Registration/Profile Fields</strong>. In the example above, you will see two Custom Field values (<code>... "fishing,biking,computers","xx-large"</code>). The first value comes first, because it maps to the Custom Field ID <code>interests</code>, and the second one comes last, because it maps to the Custom Field ID <code>t_shirt_size</code> (i.e., alphabetical order—based on the underlying Custom Field IDs that you\'re mapping this data to).</em><br /><br />' . "\n";
             echo '<em>* If you have a Custom Field that contains an array of multiple values, you can import the array using PHP\'s <a href="http://php.net/manual/en/function.serialize.php" target="_blank" rel="external">serialize()</a> function. This allows you to convert the array into a string representation. s2Member will automatically unserialize the value during importation. If you have any trouble, please perform an export first. s2Member\'s export files are already formatted for easy re-importation. In other words, you can use them as a guideline for building your own import files.</em><br /><br />' . "\n";
             echo '<em>* If you supply "First Payment Date", you have two options available. You can either supply a simple date in this format (mm/dd/yyyy), or you can import an array of First Payment Dates, in the form of Unix timestamps. s2Member has the ability to record and monitor First Payment Dates at each specific Membership Level. The array it expects, consists of the following: <code>array("level" => [timestamp of first payment date regardless of level], "level1" => [timestamp of first payment date at level #1], "level2" => [timestamp], "level3" => [timestamp], "level4" => [timestamp])</code>. Of course, if you decide to import an array with some of these timestamps, you will need to use PHP\'s <a href="http://php.net/manual/en/function.serialize.php" target="_blank" rel="external">serialize()</a> function to convert the array into a string representation. If you have any trouble, please perform an export first. s2Member\'s export files are already formatted for easy re-importation. In other words, you can use them as a guideline for building your own import files. By default, s2Member exports an array of timestamps.</em>' . "\n";
             echo '</form>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             echo '</tbody>' . "\n";
             echo '</table>' . "\n";
             echo '</div>' . "\n";
             echo '</div>' . "\n";
         } else {
             echo '<div class="ws-menu-page-group" title="User/Member CSV Importation"' . (isset($_POST["ws_plugin__s2member_pro_import_simple_users"]) ? ' default-state="open"' : '') . '>' . "\n";
             echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-user-importation-section">' . "\n";
             echo '<h3>User/Member Importation (upload file / or direct input)</h3>' . "\n";
             echo '<p>Import files can be uploaded in CSV format, or you can copy/paste data into the form field provided. In either case, you must follow the examples given below. Please double-check your data before clicking the Import button. Make sure that all data fields are properly encapsulated by double-quotes, and separated by commas. You\'ll also need to make sure that all of your data fields are in the proper order, based on the examples given below. After importing Users/Members, you can inspect your work by going to: <strong>WordPress → Users</strong>.</p>' . "\n";
             echo '<p><em><strong>No Email Notification:</strong> This import routine works silently. Users/Members will not be contacted by s2Member—that is, unless you have another plugin installed that conflicts with s2Member\'s ability to perform the Import properly. You should always test one or two accounts before importing a large number of Users all at once. If you want Users/Members to be contacted, you can add them manually, by going to <strong>WordPress → Users → Add New</strong>, and selecting one of the s2Member Roles from the drop-down menu.</em></p>' . "\n";
             echo version_compare(PHP_VERSION, "5.3", "<") ? '<p><em><strong>PHP v5.3+ recommended:</strong> In order for s2Member to properly import CSV files containing escape sequences, PHP v5.3 or higher is required. While s2Member may be able to parse import files in most cases, PHP v5.3 provides the best stability.</em></p>' . "\n" : '';
             echo '<table class="form-table">' . "\n";
             echo '<tbody>' . "\n";
             echo '<tr>' . "\n";
             echo '<td>' . "\n";
             echo '<form method="post" enctype="multipart/form-data" name="ws_plugin__s2member_pro_import_users_form" id="ws-plugin--s2member-pro-import-users-form" autocomplete="off">' . "\n";
             echo '<input type="hidden" name="ws_plugin__s2member_pro_import_simple_users" id="ws-plugin--s2member-pro-import-users" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-import-users")) . '" />' . "\n";
             echo '<input type="file" name="ws_plugin__s2member_pro_import_users_file" id="ws-plugin--s2member-pro-import-users-file" />&nbsp;&nbsp;&nbsp;(up to 1000 lines per file)&nbsp;&nbsp;&nbsp;<input type="submit" value="Import Now" style="font-size:120%; font-weight:normal;" /><br /><br />' . "\n";
             echo '<textarea name="ws_plugin__s2member_pro_import_users_direct_input" id="ws-plugin--s2member-pro-import-users-direct-input" rows="10" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit(trim(stripslashes(@$_POST["ws_plugin__s2member_pro_import_users_direct_input"]))) . '</textarea><br />' . "\n";
             echo 'One User/Member per line please. Here is a quick example:<br />' . "\n";
             echo '<code>"ID","Username","Password","First Name","Last Name","Display Name","Email"</code><br /><br />' . "\n";
             echo 'If you fill the ID field, the Import routine will update an account matching the ID you specify (so long as the account ID does not belong to an Administrator, this is for security). When importing new Users/Members, you can leave the ID field empty Don\'t remove it, just leave it empty(i.e., <code>""</code>).<br /><br />' . "\n";
             echo 'Example: <code>"","Username","Password","First Name","Last Name","Display Name","Email"</code>' . "\n";
             echo '<div class="ws-menu-page-hr"></div>' . "\n";
             echo 'Additional extended information can also be included; even Custom Registration/Profile Fields:<br />' . "\n";
             echo 'Please see this KB article for more detailed instructions: <a href="http://www.s2member.com/kb/importing-updating-users/" target="_blank" rel="external nofollow x-link">Import (Or Mass Update Users)</a>' . "\n";
             echo '</form>' . "\n";
             echo '</td>' . "\n";
             echo '</tr>' . "\n";
             echo '</tbody>' . "\n";
             echo '</table>' . "\n";
             echo '</div>' . "\n";
             echo '</div>' . "\n";
         }
     }
     /*
      * Advanced version.
      */
     if ($enable_advanced_tools) {
         echo '<div class="ws-menu-page-group" title="Advanced User/Member CSV Exportation">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-user-exportation-section">' . "\n";
         echo '<h3>User/Member Exportation (download CSV export files)</h3>' . "\n";
         echo '<p class="info"><em><strong>Advanced:</strong> This exporter uses an entirely different format. See <a href="http://www.s2member.com/kb/advanced-import-tools/" target="_blank" rel="external">this KB article for details</a>.</em></p>' . "\n";
         echo '<p class="warning"><em><strong>Important Warning:</strong> The export you receive from this Advanced Tool is not compatible with the default s2Member User Import system. This tool uses an entirely different format; i.e., files exported here are in the Advanced Import Tool format. If you plan to reimport and/or mass update existing Users/Members based on these Advanced files, you must use the Advanced Import Tool to do so. Attempting to import an Advanced Export file with the Default Import Tool may result in User database table corruption.</em></p>' . "\n";
         echo '<form method="post" name="ws_plugin__s2member_pro_export_users_form" id="ws-plugin--s2member-pro-export-users-form" autocomplete="off">' . "\n";
         echo '<input type="hidden" name="ws_plugin__s2member_pro_export_users" id="ws-plugin--s2member-pro-export-users" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-export-users")) . '" />' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-format">' . "\n";
         echo 'CSV File Preference:' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<select name="ws_plugin__s2member_pro_export_users_format" id="ws-plugin--s2member-pro-export-users-format">' . "\n";
         echo '<option value="" selected="selected">Default (CSV, perfectly formatted for easy re-importation)</option>' . "\n";
         echo '<option value="readable">Easy-Read (CSV w/ improved readability; cannot be re-imported)</option>' . "\n";
         echo '</select><br />' . "\n";
         echo '<em>Open CSV files with Notepad, TextEdit (Mac), Numbers (Mac), MS Excel, or <a href="http://s2member.com/r/openoffice/" target="_blank" rel="external">OpenOffice</a> (recommended).</em>';
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-utf8-bom">' . "\n";
         echo 'Add UTF-8 BOM (Byte Order Marker)?' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<select name="ws_plugin__s2member_pro_export_users_utf8_bom" id="ws-plugin--s2member-pro-export-users-utf8-bom">' . "\n";
         echo '<option value="0" selected="selected">Default (no, I will choose UTF-8 encoding when I open the file)</option>' . "\n";
         echo '<option value="1">Yes (add a UTF-8 Byte Order Marker so that UTF-8 encoding is always in use for this file)</option>' . "\n";
         echo '</select><br />' . "\n";
         echo '<em>If <code>Yes</code>—please open CSV files with Numbers (Mac) or <a href="http://s2member.com/r/openoffice/" target="_blank" rel="external">OpenOffice</a> (recommended).</em>';
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-start">' . "\n";
         echo 'CSV File Exportation:' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo 'You have a total of ' . number_format(c_ws_plugin__s2member_utils_users::users_in_database()) . ' User/Member rows in the database' . (is_multisite() ? ' for this site' : '') . '.<br />' . "\n";
         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo 'You can export up to 1000 database rows in each file; starting from a particular row that you specify.<br />' . "\n";
             echo 'Export, starting with row#: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_start" id="ws-plugin--s2member-pro-export-users-start" style="width:100px;" value="1" /> <input type="submit" value="Export Now" style="font-size:120%; font-weight:normal;" />' . "\n";
         } else {
             echo 'Export, starting with row#: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_start" id="ws-plugin--s2member-pro-export-users-start" style="width:100px;" value="1" /> limit to: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_limit" id="ws-plugin--s2member-pro-export-users-limit" style="width:100px;" value="1000" /> rows <input type="submit" value="Export Now" style="font-size:120%; font-weight:normal;" />' . "\n";
         }
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<em>Please note. Export files do not contain Passwords. Passwords are stored by WordPress with one-way encryption. In other words, it\'s not possible for s2Member to include them in the export file. However, this does not create a problem, because when/if you re-import existing Users/Members with the Password field empty, s2Member will simply keep the existing Password that is already on file. For further information, please read all Import instructions, regarding Passwords.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</form>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     /*
      * Simple version.
      */
     if (!$enable_advanced_tools) {
         echo '<div class="ws-menu-page-group" title="User/Member CSV Exportation">' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-user-exportation-section">' . "\n";
         echo '<h3>User/Member Exportation (download CSV export files)</h3>' . "\n";
         echo '<form method="post" name="ws_plugin__s2member_pro_export_users_form" id="ws-plugin--s2member-pro-export-users-form" autocomplete="off">' . "\n";
         echo '<input type="hidden" name="ws_plugin__s2member_pro_export_simple_users" id="ws-plugin--s2member-pro-export-users" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-export-users")) . '" />' . "\n";
         echo '<table class="form-table">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-format">' . "\n";
         echo 'CSV File Preference:' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<select name="ws_plugin__s2member_pro_export_users_format" id="ws-plugin--s2member-pro-export-users-format">' . "\n";
         echo '<option value="" selected="selected">Default (CSV, perfectly formatted for easy re-importation)</option>' . "\n";
         echo '<option value="readable">Easy-Read (CSV w/ improved readability; cannot be re-imported)</option>' . "\n";
         echo '</select><br />' . "\n";
         echo '<em>Open CSV files with Notepad, TextEdit (Mac), Numbers (Mac), MS Excel, or <a href="http://s2member.com/r/openoffice/" target="_blank" rel="external">OpenOffice</a> (recommended).</em>';
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-utf8-bom">' . "\n";
         echo 'Add UTF-8 BOM (Byte Order Marker)?' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<select name="ws_plugin__s2member_pro_export_users_utf8_bom" id="ws-plugin--s2member-pro-export-users-utf8-bom">' . "\n";
         echo '<option value="0" selected="selected">Default (no, I will choose UTF-8 encoding when I open the file)</option>' . "\n";
         echo '<option value="1">Yes (add a UTF-8 Byte Order Marker so that UTF-8 encoding is always in use for this file)</option>' . "\n";
         echo '</select><br />' . "\n";
         echo '<em>If <code>Yes</code>—please open CSV files with Numbers (Mac) or <a href="http://s2member.com/r/openoffice/" target="_blank" rel="external">OpenOffice</a> (recommended).</em>';
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-pro-export-users-start">' . "\n";
         echo 'CSV File Exportation:' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo 'You have a total of ' . number_format(c_ws_plugin__s2member_utils_users::users_in_database()) . ' User/Member rows in the database' . (is_multisite() ? ' for this site' : '') . '.<br />' . "\n";
         if (is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && !is_main_site()) {
             echo 'You can export up to 1000 database rows in each file; starting from a particular row that you specify.<br />' . "\n";
             echo 'Export, starting with row#: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_start" id="ws-plugin--s2member-pro-export-users-start" style="width:100px;" value="1" /> <input type="submit" value="Export Now" style="font-size:120%; font-weight:normal;" />' . "\n";
         } else {
             echo 'Export, starting with row#: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_start" id="ws-plugin--s2member-pro-export-users-start" style="width:100px;" value="1" /> limit to: <input type="text" autocomplete="off" name="ws_plugin__s2member_pro_export_users_limit" id="ws-plugin--s2member-pro-export-users-limit" style="width:100px;" value="1000" /> rows <input type="submit" value="Export Now" style="font-size:120%; font-weight:normal;" />' . "\n";
         }
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<em>Please note. Export files do not contain Passwords. Passwords are stored by WordPress with one-way encryption. In other words, it\'s not possible for s2Member to include them in the export file. However, this does not create a problem, because when/if you re-import existing Users/Members with the Password field empty, s2Member will simply keep the existing Password that is already on file. For further information, please read all Import instructions, regarding Passwords.</em>' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</form>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
     }
     /*
      * There is no variation on this one; always the same.
      */
     echo '<div class="ws-menu-page-group" title="s2Member Options (Import/Export)"' . (isset($_POST["ws_plugin__s2member_pro_import_ops"]) ? ' default-state="open"' : '') . '>' . "\n";
     echo '<div class="ws-menu-page-section ws-plugin--s2member-pro-ops-importation-exportation-section">' . "\n";
     echo '<h3 style="margin-bottom:5px;">s2Member Options Export <small>(<a href="' . esc_attr(home_url("/?ws_plugin__s2member_pro_export_ops=" . urlencode(wp_create_nonce("ws-plugin--s2member-pro-export-ops")))) . '">download serialized export file</a>)</small></h3>' . "\n";
     echo '<p style="margin-top:5px;">This allows you to export your current s2Member configuration, and then import it into another instance of WordPress.' . "\n";
     echo '<div class="ws-menu-page-hr"></div>' . "\n";
     echo '<h3 style="margin-bottom:5px;">s2Member Options Import <small>(upload your serialized export file)</small></h3>' . "\n";
     echo '<p style="margin-top:5px;">This allows you to import your s2Member configuration export file, from another instance of WordPress.' . "\n";
     echo '<table class="form-table">' . "\n";
     echo '<tbody>' . "\n";
     echo '<tr>' . "\n";
     echo '<td>' . "\n";
     echo '<form method="post" enctype="multipart/form-data" name="ws_plugin__s2member_pro_import_ops_form" id="ws-plugin--s2member-pro-import-ops-form" autocomplete="off">' . "\n";
     echo '<input type="hidden" name="ws_plugin__s2member_pro_import_ops" id="ws-plugin--s2member-pro-import-ops" value="' . esc_attr(wp_create_nonce("ws-plugin--s2member-pro-import-ops")) . '" />' . "\n";
     echo '<input type="file" name="ws_plugin__s2member_pro_import_ops_file" id="ws-plugin--s2member-pro-import-ops-file" />&nbsp;&nbsp;&nbsp;<input type="submit" value="Import Now" style="font-size:120%; font-weight:normal;" />' . "\n";
     echo '</form>' . "\n";
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     echo '</td>' . "\n";
     echo '<td class="ws-menu-page-table-r">' . "\n";
     c_ws_plugin__s2member_menu_pages_rs::display();
     echo '</td>' . "\n";
     echo '</tr>' . "\n";
     echo '</tbody>' . "\n";
     echo '</table>' . "\n";
     echo '</div>' . "\n";
 }
Example #7
0
 /**
  * Builds the Coupon Codes page.
  *
  * @package s2Member\Menu_Pages
  * @since 1.5
  */
 public static function coupon_codes_page()
 {
     c_ws_plugin__s2member_menu_pages::update_all_options();
     // Updates options.
     include_once dirname(dirname(__FILE__)) . "/menu-pages/coupon-codes.inc.php";
 }
Example #8
0
 /**
  * Handles the importation of options.
  *
  * @package s2Member\Imports
  * @since 110815
  *
  * @return null
  */
 public static function import_ops()
 {
     if (!empty($_POST["ws_plugin__s2member_pro_import_ops"]) && ($nonce = $_POST["ws_plugin__s2member_pro_import_ops"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-pro-import-ops") && current_user_can("create_users")) {
         @set_time_limit(0);
         // Make time for processing large import files.
         @ini_set("memory_limit", apply_filters("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
         if (!empty($_FILES["ws_plugin__s2member_pro_import_ops_file"]) && empty($_FILES["ws_plugin__s2member_pro_import_ops_file"]["error"])) {
             $file = file_get_contents($_FILES["ws_plugin__s2member_pro_import_ops_file"]["tmp_name"], "r");
         }
         if (!empty($file)) {
             if (is_array($import = c_ws_plugin__s2member_pro_utils_ops::op_replace(@unserialize($file), true)) && !empty($import) && ($import["configured"] = "1")) {
                 unset($import["options_checksum"], $import["options_version"]);
                 foreach ($import as $key => $value) {
                     is_array($value) ? array_unshift($value, "update-signal") : null;
                     $import["ws_plugin__s2member_" . $key] = $value;
                     unset($import[$key]);
                 }
                 c_ws_plugin__s2member_menu_pages::update_all_options($import, true, true, false, false, false);
             } else {
                 $errors[] = "Invalid data received. Please try again.";
             }
             // Unserialization failed?
         } else {
             $errors[] = "No data was received. Please try again.";
         }
         // The upload failed, or it was empty.
         if (!empty($errors)) {
             // Here is where a detailed error log will be returned to the Site Owner; as a way of clarifying what just happened during importation.
             c_ws_plugin__s2member_admin_notices::display_admin_notice('<strong>The following errors were encountered during importation:</strong><ul style="font-size:80%; list-style:disc outside; margin-left:25px;"><li>' . implode("</li><li>", $errors) . '</li></ul>', true);
         } else {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Operation complete. Options imported.');
         }
     }
     return;
 }
 /**
  * Saves data entered into meta boxes on Post/Page editing stations.
  *
  * @package s2Member\Meta_Boxes
  * @since 3.5
  *
  * @attaches-to ``add_action("save_post");``
  *
  * @param int|string $post_id Numeric Post/Page ID.
  * @return null
  */
 public static function save_meta_boxes($post_id = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_save_meta_boxes", get_defined_vars());
     unset($__refs, $__v);
     if ($post_id && !empty($_POST["ws_plugin__s2member_security_meta_box_save"]) && ($nonce = $_POST["ws_plugin__s2member_security_meta_box_save"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-security-meta-box-save")) {
         if (!empty($_POST["ws_plugin__s2member_security_meta_box_save_id"]) && $post_id == $_POST["ws_plugin__s2member_security_meta_box_save_id"] && !empty($_POST["post_type"])) {
             $_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST));
             if ($_p["post_type"] === "page" && current_user_can("edit_page", $post_id) || current_user_can("edit_post", $post_id)) {
                 if ($_p["post_type"] === "page" && ($page_id = $post_id)) {
                     if (isset($_p["ws_plugin__s2member_security_meta_box_level"])) {
                         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             $pages[$n] = array_unique(preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"]));
                         }
                         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             $posts[$n] = array_unique(preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]));
                         }
                         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             if (($i = array_search($page_id, $pages[$n])) !== false) {
                                 unset($pages[$n][$i]);
                             }
                         }
                         if (isset($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array($pages[$_p["ws_plugin__s2member_security_meta_box_level"]])) {
                             if ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array("all") && !in_array("all-page", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && !in_array("all-pages", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]])) {
                                 array_push($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], (string) $page_id);
                             }
                         }
                         for ($n = 0, $new_options = array(); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             $new_options = array_merge($new_options, array("ws_plugin__s2member_level" . $n . "_pages" => trim(implode(",", $pages[$n]))));
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars());
                         unset($__refs, $__v);
                         c_ws_plugin__s2member_menu_pages::update_all_options($new_options, true, false, array("page-conflict-warnings"), true);
                     }
                 } else {
                     if (isset($_p["ws_plugin__s2member_security_meta_box_level"])) {
                         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             $posts[$n] = array_unique(preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]));
                         }
                         for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             if (($i = array_search($post_id, $posts[$n])) !== false) {
                                 unset($posts[$n][$i]);
                             }
                         }
                         if (isset($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array($posts[$_p["ws_plugin__s2member_security_meta_box_level"]])) {
                             if ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array("all") && !in_array("all-" . $_p["post_type"], $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && !in_array("all-" . $_p["post_type"] . "s", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]])) {
                                 array_push($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], (string) $post_id);
                             }
                         }
                         for ($n = 0, $new_options = array(); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++) {
                             $new_options = array_merge($new_options, array("ws_plugin__s2member_level" . $n . "_posts" => trim(implode(",", $posts[$n]))));
                         }
                         foreach (array_keys(get_defined_vars()) as $__v) {
                             $__refs[$__v] =& ${$__v};
                         }
                         do_action("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars());
                         unset($__refs, $__v);
                         c_ws_plugin__s2member_menu_pages::update_all_options($new_options, true, false, array("page-conflict-warnings"), true);
                     }
                 }
                 if ($_p["post_type"] === "page" && ($page_id = $post_id)) {
                     if (isset($_p["ws_plugin__s2member_security_meta_box_ccaps"])) {
                         $ccaps_req = trim(strtolower($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
                         $ccaps_req = trim(preg_replace("/[^a-z_0-9,]/", "", $ccaps_req), ",");
                         if (strlen($ccaps_req) && ($s2member_ccaps_req = preg_split("/[\r\n\t\\s;,]+/", $ccaps_req))) {
                             update_post_meta($page_id, "s2member_ccaps_req", $s2member_ccaps_req);
                         } else {
                             // Otherwise, the array is empty. Safe to delete.
                             delete_post_meta($page_id, "s2member_ccaps_req");
                         }
                     }
                 } else {
                     if (isset($_p["ws_plugin__s2member_security_meta_box_ccaps"])) {
                         $ccaps_req = trim(strtolower($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
                         $ccaps_req = trim(preg_replace("/[^a-z_0-9,]/", "", $ccaps_req), ",");
                         if (strlen($ccaps_req) && ($s2member_ccaps_req = preg_split("/[\r\n\t\\s;,]+/", $ccaps_req))) {
                             update_post_meta($post_id, "s2member_ccaps_req", $s2member_ccaps_req);
                         } else {
                             // Otherwise, the array is empty. Safe to delete.
                             delete_post_meta($post_id, "s2member_ccaps_req");
                         }
                     }
                 }
             }
         }
     }
     do_action("ws_plugin__s2member_after_save_meta_boxes", get_defined_vars());
     return;
 }
Example #10
0
 /**
  * Activation routines for s2Member.
  *
  * @package s2Member\Installation
  * @since 3.5
  *
  * @param string $reactivation_reason Optional.
  */
 public static function activate($reactivation_reason = '')
 {
     global $wpdb;
     /** @var $wpdb wpdb */
     global $current_site, $current_blog;
     // Multisite.
     do_action('ws_plugin__s2member_before_activation', get_defined_vars());
     c_ws_plugin__s2member_roles_caps::config_roles();
     // Config Roles/Caps.
     update_option('ws_plugin__s2member_activated_levels', $GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']);
     if (!is_dir($files_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir'])) {
         if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
             mkdir($files_dir, 0777, TRUE);
         }
     }
     if (is_dir($files_dir) && is_writable($files_dir)) {
         if (!is_file($htaccess = $files_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_files_dir_htaccess', !is_writable($files_dir . '/.htaccess'), get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['files_dir_htaccess']))));
         }
     }
     c_ws_plugin__s2member_files::write_no_gzip_into_root_htaccess();
     // Handle the root `.htaccess` file as well now, for GZIP exclusions.
     if (!is_dir($logs_dir = $GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])) {
         if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) {
             mkdir($logs_dir, 0777, TRUE);
         }
     }
     if (is_dir($logs_dir) && is_writable($logs_dir)) {
         if (!is_file($htaccess = $logs_dir . '/.htaccess') || !apply_filters('ws_plugin__s2member_preserve_logs_dir_htaccess', !is_writable($logs_dir . '/.htaccess'), get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir_htaccess']))));
         }
     }
     !is_array(get_option('ws_plugin__s2member_cache')) ? update_option('ws_plugin__s2member_cache', array()) : NULL;
     !is_array(get_option('ws_plugin__s2member_notices')) ? update_option('ws_plugin__s2member_notices', array()) : NULL;
     !is_array(get_option('ws_plugin__s2member_options')) ? update_option('ws_plugin__s2member_options', array()) : NULL;
     !is_numeric(get_option('ws_plugin__s2member_configured')) ? update_option('ws_plugin__s2member_configured', '0') : NULL;
     if ($GLOBALS['WS_PLUGIN__']['s2member']['c']['configured']) {
         $v = get_option('ws_plugin__s2member_activated_version');
         // Currently.
         if (!$v || !version_compare($v, '3.2', '>=')) {
             $like = "`meta_key` LIKE 's2member\\_%' AND `meta_key` NOT LIKE '%s2member\\_originating\\_blog%'";
             $wpdb->query("UPDATE `" . $wpdb->usermeta . "` SET `meta_key` = CONCAT('" . $wpdb->prefix . "', `meta_key`) WHERE " . $like);
         }
         if (!$v || !version_compare($v, '3.2.5', '>=')) {
             $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\\_transient\\_%'");
         }
         if (!$v || !version_compare($v, '3.2.6', '>=')) {
             $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
         }
         if (!$v || !version_compare($v, '110912', '>=') && $GLOBALS['WS_PLUGIN__']['s2member']['o']['filter_wp_query'] === array('all')) {
             $notice = '<strong>IMPORTANT:</strong> This version of s2Member changes the way your <code>Alternative View Protections</code> work. Please review your options under: <strong>s2Member → Restriction Options → Alternative View Protections</strong>.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
         }
         if ($v && version_compare($v, '130316', '<=')) {
             c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_gateway_debug_logs' => '0', 'ws_plugin__s2member_gateway_debug_logs_extensive' => '0'), TRUE, FALSE, FALSE, FALSE, FALSE);
             $notice = '<strong>IMPORTANT:</strong> This version of s2Member disables s2Member\'s debug logging by default (for added security). Please see: <a href="' . esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-logs')) . '">s2Member → Log Files (Debug) → Configuration</a> for further details.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
             $notice = '<strong>IMPORTANT / Regarding s2Member Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member Security Badge until you disable logging (and you must also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a> for further details. If you have existing s2Member log files, you will need to delete those files from the server before your s2Member Security Badge can be re-enabled. s2Member stores log files here: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS['WS_PLUGIN__']['s2member']['c']['logs_dir'])) . '</code>. See also: <a href="' . esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-logs')) . '">s2Member → Log Files (Debug) → Configuration</a> for further details.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
         }
         if ($v && version_compare($v, '140128', '<=')) {
             if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['triggers_immediate_eot'] === 'refunds,reversals') {
                 // `refunds,reversals` => `refunds,partial_refunds,reversals`
                 c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_triggers_immediate_eot' => 'refunds,partial_refunds,reversals'), TRUE, FALSE, FALSE, FALSE, FALSE);
             }
         }
         $notice = '<strong>s2Member</strong> has been <strong>reactivated</strong>, with ' . ($reactivation_reason === 'levels' ? '<code>' . esc_html($GLOBALS['WS_PLUGIN__']['s2member']['c']['levels']) . '</code> Membership Levels' : 'the latest version') . '.<br />';
         $notice .= 'You now have version ' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . '. Your existing configuration remains.';
         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
             // No Changelog on a Multisite Blog Farm.
             $notice .= '<br />Have fun, <a href="' . esc_attr(c_ws_plugin__s2member_readmes::parse_readme_value('Changelog URI')) . '" target="_blank">read the Changelog</a>, and make some money! :-)';
         }
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
     } else {
         $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, 'blog:users.php', FALSE, FALSE, TRUE);
         $notice = '<strong>s2Member</strong> v' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . ' has been <strong>activated</strong>. Nice work!<br />';
         $notice .= 'Have fun, <a href="' . esc_attr(admin_url('/admin.php?page=ws-plugin--s2member-start')) . '">read the Quick Start Guide</a>, and make some money! :-)';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
     }
     if (is_multisite() && is_main_site()) {
         $wpdb->query("INSERT INTO `" . $wpdb->usermeta . "` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 's2member_originating_blog', '" . esc_sql($current_site->blog_id) . "' FROM `" . $wpdb->users . "` WHERE `ID` NOT IN (SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_originating_blog')");
         $notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . '.<br />';
         $notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
         $notice .= 'In the Dashboard for your Main Site, see:<br />';
         $notice .= '<strong>s2Member → Multisite (Config)</strong>.';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array('blog|network:plugins.php', 'blog|network:ws-plugin--s2member-start', 'blog|network:ws-plugin--s2member-mms-ops', 'blog|network:ws-plugin--s2member-gen-ops', 'blog|network:ws-plugin--s2member-res-ops'));
         update_site_option('ws_plugin__s2member_options', (array) get_option('ws_plugin__s2member_options'));
         update_option('ws_plugin__s2member_activated_mms_version', WS_PLUGIN__S2MEMBER_VERSION);
     }
     update_option('ws_plugin__s2member_activated_version', WS_PLUGIN__S2MEMBER_VERSION);
     do_action('ws_plugin__s2member_after_activation', get_defined_vars());
 }
Example #11
0
 /**
  * Handles the importation of options.
  *
  * @package s2Member\Imports
  * @since 110815
  */
 public static function import_ops()
 {
     if (!empty($_POST['ws_plugin__s2member_pro_import_ops']) && ($nonce = $_POST['ws_plugin__s2member_pro_import_ops']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-pro-import-ops') && current_user_can('create_users')) {
         @set_time_limit(0);
         // Make time for processing large import files.
         @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
         if (!empty($_FILES['ws_plugin__s2member_pro_import_ops_file']) && empty($_FILES['ws_plugin__s2member_pro_import_ops_file']['error'])) {
             $file = file_get_contents($_FILES['ws_plugin__s2member_pro_import_ops_file']['tmp_name'], 'r');
         }
         if (!empty($file)) {
             if (is_array($import = c_ws_plugin__s2member_pro_utils_ops::op_replace(@unserialize($file), TRUE)) && !empty($import) && ($import['configured'] = '1')) {
                 unset($import['options_checksum'], $import['options_version']);
                 foreach ($import as $key => $value) {
                     is_array($value) ? array_unshift($value, 'update-signal') : NULL;
                     $import['ws_plugin__s2member_' . $key] = $value;
                     unset($import[$key]);
                 }
                 c_ws_plugin__s2member_menu_pages::update_all_options($import, TRUE, TRUE, FALSE, FALSE, FALSE);
             } else {
                 $errors[] = 'Invalid data received. Please try again.';
             }
             // Unserialization failed?
         } else {
             $errors[] = 'No data was received. Please try again.';
         }
         // The upload failed, or it was empty.
         if (!empty($errors)) {
             // Here is where a detailed error log will be returned to the Site Owner; as a way of clarifying what just happened during importation.
             c_ws_plugin__s2member_admin_notices::display_admin_notice('<strong>The following errors were encountered during importation:</strong><ul style="font-size:80%; list-style:disc outside; margin-left:25px;"><li>' . implode('</li><li>', $errors) . '</li></ul>', TRUE);
         } else {
             c_ws_plugin__s2member_admin_notices::display_admin_notice('Operation complete. Options imported.');
         }
     }
 }
Example #12
0
 /**
  * Resets Amazon S3/CloudFront configuration.
  *
  * @package s2Member\Files
  * @since 140812
  */
 public static function reset_aws_cf_config_values()
 {
     c_ws_plugin__s2member_menu_pages::update_all_options(array('ws_plugin__s2member_amazon_cf_files_private_key' => '', 'ws_plugin__s2member_amazon_cf_files_private_key_id' => '', 'ws_plugin__s2member_amazon_cf_files_distros_access_id' => '', 'ws_plugin__s2member_amazon_cf_files_distros_s3_access_id' => '', 'ws_plugin__s2member_amazon_cf_files_distro_downloads_id' => '', 'ws_plugin__s2member_amazon_cf_files_distro_downloads_cname' => '', 'ws_plugin__s2member_amazon_cf_files_distro_downloads_dname' => '', 'ws_plugin__s2member_amazon_cf_files_distro_streaming_id' => '', 'ws_plugin__s2member_amazon_cf_files_distro_streaming_cname' => '', 'ws_plugin__s2member_amazon_cf_files_distro_streaming_dname' => '', 'ws_plugin__s2member_amazon_cf_files_distros_auto_config_status' => ''), TRUE, FALSE, FALSE, FALSE, FALSE);
 }
 /**
  * Activation routines for s2Member.
  *
  * @package s2Member\Installation
  * @since 3.5
  *
  * @return null
  */
 public static function activate($reactivation_reason = FALSE)
 {
     global $wpdb;
     global $current_site, $current_blog;
     do_action("ws_plugin__s2member_before_activation", get_defined_vars());
     c_ws_plugin__s2member_roles_caps::config_roles();
     update_option("ws_plugin__s2member_activated_levels", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]);
     if (!is_dir($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) {
         if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($files_dir)))) {
             mkdir($files_dir, 0777, true);
         }
     }
     if (is_dir($files_dir) && is_writable($files_dir)) {
         if (!file_exists($htaccess = $files_dir . "/.htaccess") || !apply_filters("ws_plugin__s2member_preserve_files_dir_htaccess", false, get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir_htaccess"]))));
         }
     }
     c_ws_plugin__s2member_files::write_no_gzip_into_root_htaccess();
     if (!is_dir($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) {
         if (is_writable(dirname(c_ws_plugin__s2member_utils_dirs::strip_dir_app_data($logs_dir)))) {
             mkdir($logs_dir, 0777, true);
         }
     }
     if (is_dir($logs_dir) && is_writable($logs_dir)) {
         if (!file_exists($htaccess = $logs_dir . "/.htaccess") || !apply_filters("ws_plugin__s2member_preserve_logs_dir_htaccess", false, get_defined_vars())) {
             file_put_contents($htaccess, trim(c_ws_plugin__s2member_utilities::evl(file_get_contents($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir_htaccess"]))));
         }
     }
     !is_array(get_option("ws_plugin__s2member_cache")) ? update_option("ws_plugin__s2member_cache", array()) : null;
     !is_array(get_option("ws_plugin__s2member_notices")) ? update_option("ws_plugin__s2member_notices", array()) : null;
     !is_array(get_option("ws_plugin__s2member_options")) ? update_option("ws_plugin__s2member_options", array()) : null;
     !is_numeric(get_option("ws_plugin__s2member_configured")) ? update_option("ws_plugin__s2member_configured", "0") : null;
     if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"]) {
         $v = get_option("ws_plugin__s2member_activated_version");
         if (!$v || !version_compare($v, "3.2", ">=")) {
             $like = "`meta_key` LIKE 's2member\\_%' AND `meta_key` NOT LIKE '%s2member\\_originating\\_blog%'";
             $wpdb->query("UPDATE `" . $wpdb->usermeta . "` SET `meta_key` = CONCAT('" . $wpdb->prefix . "', `meta_key`) WHERE " . $like);
         }
         if (!$v || !version_compare($v, "3.2.5", ">=")) {
             $wpdb->query("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\\_transient\\_%'");
         }
         if (!$v || !version_compare($v, "3.2.6", ">=")) {
             $wpdb->query("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
         }
         if (!$v || !version_compare($v, "110912", ">=") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === array("all")) {
             $notice = '<strong>IMPORTANT:</strong> This version of s2Member changes the way your <code>Alternative View Protections</code> work. Please review your options under: <code>s2Member -› Restriction Options -› Alternative View Protections</code>.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
         }
         if ($v && version_compare($v, "130316", "<=")) {
             c_ws_plugin__s2member_menu_pages::update_all_options(array("ws_plugin__s2member_gateway_debug_logs" => "0", "ws_plugin__s2member_gateway_debug_logs_extensive" => "0"), true, false, false, false, false);
             $notice = '<strong>IMPORTANT:</strong> This version of s2Member disables s2Member\'s debug logging by default (for added security). Please see: <a href="' . esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")) . '">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
             $notice = '<strong>IMPORTANT / Regarding s2Member Security Badges:</strong> If debug logging is enabled, your site will no longer qualify for an s2Member Security Badge until you disable logging (and you MUST also download, and then delete any existing log files from the past). Please see KB Article: <a href="http://www.s2member.com/kb/security-badges/" target="_blank" rel="external">s2Member Security Badges</a> for further details. If you have existing s2Member log files, you will need to delete those files from the server before your s2Member Security Badge can be re-enabled. s2Member stores log files here: <code>' . esc_html(c_ws_plugin__s2member_utils_dirs::doc_root_path($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"])) . '</code>. See also: <a href="' . esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-logs")) . '">s2Member -› Log Files (Debug) -› Configuration</a> for further details.';
             c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
         }
         $notice = '<strong>s2Member</strong> has been <strong>reactivated</strong>, with ' . ($reactivation_reason === "levels" ? '<code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]) . '</code> Membership Levels' : 'the latest version') . '.<br />';
         $notice .= 'You now have version ' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . '. Your existing configuration remains.';
         if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site()) {
             // No Changelog on a Multisite Blog Farm.
             $notice .= '<br />Have fun, <a href="' . esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-info#rm-changelog")) . '">read the Changelog</a>, and make some money! :-)';
         }
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
     } else {
         $notice = '<strong>Note:</strong> s2Member adds some new data columns to your list of Users/Members. If your list gets overcrowded, please use the <strong>Screen Options</strong> tab <em>(upper right-hand corner)</em>. With WordPress Screen Options, you can add/remove specific data columns; thereby making the most important data easier to read. For example, if you create Custom Registration/Profile Fields with s2Member, those Custom Fields will result in new data columns; which can cause your list of Users/Members to become nearly unreadable. So just use the Screen Options tab to clean things up.';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, "blog:users.php", false, false, true);
         $notice = '<strong>s2Member</strong> v' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . ' has been <strong>activated</strong>. Nice work!<br />';
         $notice .= 'Have fun, <a href="' . esc_attr(admin_url("/admin.php?page=ws-plugin--s2member-start")) . '">read the Quick Start Guide</a>, and make some money! :-)';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
     }
     if (is_multisite() && is_main_site()) {
         $wpdb->query("INSERT INTO `" . $wpdb->usermeta . "` (`user_id`, `meta_key`, `meta_value`) SELECT `ID`, 's2member_originating_blog', '" . esc_sql($current_site->blog_id) . "' FROM `" . $wpdb->users . "` WHERE `ID` NOT IN (SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_originating_blog')");
         $notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v' . esc_html(WS_PLUGIN__S2MEMBER_VERSION) . '.<br />';
         $notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
         $notice .= 'In the Dashboard for your Main Site, see:<br />';
         $notice .= '<code>s2Member -› Multisite (Config)</code>.';
         c_ws_plugin__s2member_admin_notices::enqueue_admin_notice($notice, array("blog|network:plugins.php", "blog|network:ws-plugin--s2member-start", "blog|network:ws-plugin--s2member-mms-ops", "blog|network:ws-plugin--s2member-gen-ops", "blog|network:ws-plugin--s2member-res-ops"));
         update_site_option("ws_plugin__s2member_options", (array) get_option("ws_plugin__s2member_options"));
         update_option("ws_plugin__s2member_activated_mms_version", WS_PLUGIN__S2MEMBER_VERSION);
     }
     update_option("ws_plugin__s2member_activated_version", WS_PLUGIN__S2MEMBER_VERSION);
     do_action("ws_plugin__s2member_after_activation", get_defined_vars());
     return;
 }
 /**
  * Handles saves on the MMS ops page.
  *
  * @attaches-to `ws_plugin__s2member_before_mms_ops_page`
  *
  * @package s2Member\Menu_Pages
  * @since 160119
  */
 public static function before_mms_ops_page_hook()
 {
     if (c_ws_plugin__s2member_menu_pages::update_all_options()) {
         c_ws_plugin__s2member_pro_mms_patches::mms_patches(TRUE);
     }
 }
 /**
  * Auto-configures Amazon S3/CloudFront distros.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @return array Array containing a true `success` element on success, else a failure array.
  * 	Failure array will contain a failure `code`, and a failure `message`.
  */
 public static function amazon_cf_auto_configure_distros()
 {
     foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value) {
         if (preg_match("/^amazon_cf_files_/", $option) && ($option = preg_replace("/^amazon_cf_files_/", "", $option))) {
             $cfc[$option] = $option_value;
         }
     }
     $s3c["bucket"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_bucket"];
     $cfc["access_key"] = $s3c["access_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_access_key"];
     $cfc["secret_key"] = $s3c["secret_key"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"];
     if ($s3c["bucket"] && $s3c["access_key"] && $s3c["secret_key"]) {
         if ($cfc["private_key"] && $cfc["private_key_id"]) {
             if (!$cfc["distro_downloads_id"] || $cfc["distro_downloads_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro($cfc["distro_downloads_id"], "downloads")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)) {
                 if (!$cfc["distro_downloads_id"] || $cfc["distro_downloads_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404) {
                     $cf_distro_downloads_clear = true;
                 } else {
                     if ($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"]) {
                         return array("success" => false, "code" => -86, "message" => _x("Unable to delete existing Amazon CloudFront Downloads Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
                     } else {
                         if ($cfc["distro_downloads_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_downloads_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"]) {
                             $cf_distro_downloads_clear = true;
                         } else {
                             if (isset($cf_del_response["code"], $cf_del_response["message"])) {
                                 /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                 return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
                             }
                         }
                     }
                 }
                 if (isset($cf_distro_downloads_clear) && $cf_distro_downloads_clear) {
                     unset($cf_get_response, $cf_del_response);
                     if (!$cfc["distro_streaming_id"] || $cfc["distro_streaming_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_distro($cfc["distro_streaming_id"], "streaming")) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)) {
                         if (!$cfc["distro_streaming_id"] || $cfc["distro_streaming_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404) {
                             $cf_distro_streaming_clear = true;
                         } else {
                             if ($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && !$cf_get_response["deployed"]) {
                                 return array("success" => false, "code" => -87, "message" => _x("Unable to delete existing Amazon CloudFront Streaming Distro. Still in a `pending` state. Please wait 15 minutes, then try again. There is a certain process that s2Member must strictly adhere to when re-configuring your Amazon CloudFront Distros. You may have to tick the auto-configure checkbox again, and re-run s2Member's auto-configuration routine many times, because s2Member will likely run into several `pending` challenges, as it works to completely re-configure your Amazon CloudFront Distros for you. Thanks for your patience. Please wait 15 minutes, then try again.", "s2member-admin", "s2member"));
                             } else {
                                 if ($cfc["distro_streaming_id"] && $cf_get_response && $cf_get_response["success"] && $cf_get_response["deployed"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_distro($cfc["distro_streaming_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"]) {
                                     $cf_distro_streaming_clear = true;
                                 } else {
                                     if (isset($cf_del_response["code"], $cf_del_response["message"])) {
                                         /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                         return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
                                     }
                                 }
                             }
                         }
                         if (isset($cf_distro_streaming_clear) && $cf_distro_streaming_clear) {
                             unset($cf_get_response, $cf_del_response);
                             if (!$cfc["distros_access_id"] || $cfc["distros_access_id"] && ($cf_get_response = c_ws_plugin__s2member_files_in::amazon_cf_get_access_origin_identity($cfc["distros_access_id"])) && ($cf_get_response["success"] || $cf_get_response["code"] === 404)) {
                                 if (!$cfc["distros_access_id"] || $cfc["distros_access_id"] && $cf_get_response && !$cf_get_response["success"] && $cf_get_response["code"] === 404) {
                                     $cf_distros_access_clear = true;
                                 } else {
                                     if ($cfc["distros_access_id"] && $cf_get_response && $cf_get_response["success"] && ($cf_del_response = c_ws_plugin__s2member_files_in::amazon_cf_del_access_origin_identity($cfc["distros_access_id"], $cf_get_response["etag"], $cf_get_response["xml"])) && $cf_del_response["success"]) {
                                         $cf_distros_access_clear = true;
                                     } else {
                                         if (isset($cf_del_response["code"], $cf_del_response["message"])) {
                                             /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                             return array("success" => false, "code" => $cf_del_response["code"], "message" => sprintf(_x("Unable to delete existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_del_response["message"]));
                                         }
                                     }
                                 }
                                 if (isset($cf_distros_access_clear) && $cf_distros_access_clear) {
                                     unset($cf_get_response, $cf_del_response);
                                     $cfc = array_merge($cfc, array("distros_access_id" => "", "distros_s3_access_id" => "", "distro_downloads_id" => "", "distro_downloads_dname" => "", "distro_streaming_id" => "", "distro_streaming_dname" => "", "distros_auto_config_status" => ""));
                                     $cf_options = array("ws_plugin__s2member_amazon_cf_files_distros_access_id" => "", "ws_plugin__s2member_amazon_cf_files_distros_s3_access_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_downloads_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_downloads_dname" => "", "ws_plugin__s2member_amazon_cf_files_distro_streaming_id" => "", "ws_plugin__s2member_amazon_cf_files_distro_streaming_dname" => "", "ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "");
                                     c_ws_plugin__s2member_menu_pages::update_all_options($cf_options, true, false, false, false, false);
                                     if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distros_access_origin_identity()) && $cf_response["success"]) {
                                         $cfc = array_merge($cfc, array("distros_access_id" => $cf_response["distros_access_id"], "distros_s3_access_id" => $cf_response["distros_s3_access_id"]));
                                         $cf_options = array("ws_plugin__s2member_amazon_cf_files_distros_access_id" => $cf_response["distros_access_id"], "ws_plugin__s2member_amazon_cf_files_distros_s3_access_id" => $cf_response["distros_s3_access_id"]);
                                         c_ws_plugin__s2member_menu_pages::update_all_options($cf_options, true, false, false, false, false);
                                         if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distro("downloads")) && $cf_response["success"]) {
                                             $cfc = array_merge($cfc, array("distro_downloads_id" => $cf_response["distro_downloads_id"], "distro_downloads_dname" => $cf_response["distro_downloads_dname"]));
                                             $cf_options = array("ws_plugin__s2member_amazon_cf_files_distro_downloads_id" => $cf_response["distro_downloads_id"], "ws_plugin__s2member_amazon_cf_files_distro_downloads_dname" => $cf_response["distro_downloads_dname"]);
                                             c_ws_plugin__s2member_menu_pages::update_all_options($cf_options, true, false, false, false, false);
                                             if (($cf_response = c_ws_plugin__s2member_files_in::amazon_cf_create_distro("streaming")) && $cf_response["success"]) {
                                                 $cfc = array_merge($cfc, array("distro_streaming_id" => $cf_response["distro_streaming_id"], "distro_streaming_dname" => $cf_response["distro_streaming_dname"]));
                                                 $cf_options = array("ws_plugin__s2member_amazon_cf_files_distro_streaming_id" => $cf_response["distro_streaming_id"], "ws_plugin__s2member_amazon_cf_files_distro_streaming_dname" => $cf_response["distro_streaming_dname"]);
                                                 c_ws_plugin__s2member_menu_pages::update_all_options($cf_options, true, false, false, false, false);
                                                 for ($a = 1, $attempts = 4, $sleep = 2, sleep($sleep); $a <= $attempts; $a++, $a <= $attempts ? sleep($sleep) : null) {
                                                     /* Allow a generous propagation time here. Amazon's high-availability services do NOT guarantee real-time updates.
                                                     			Since we DO need a fully propagated Origin Access Identity now, we need to make several attempts at success.
                                                     			For further details, please see this thread: <https://forums.aws.amazon.com/message.jspa?messageID=42875>. */
                                                     if (($s3_response = c_ws_plugin__s2member_files_in::amazon_s3_auto_configure_acls()) && $s3_response["success"]) {
                                                         $cfc = array_merge($cfc, array("distros_auto_config_status" => "configured"));
                                                         $cf_options = array("ws_plugin__s2member_amazon_cf_files_distros_auto_config_status" => "configured");
                                                         c_ws_plugin__s2member_menu_pages::update_all_options($cf_options, true, false, false, false, false);
                                                         return array("success" => true, "code" => null, "message" => null);
                                                     }
                                                 }
                                                 if (isset($s3_response["code"], $s3_response["message"])) {
                                                     /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon S3 API call. Feel free to exclude `%s` if you like. */
                                                     return array("success" => false, "code" => $s3_response["code"], "message" => sprintf(_x("Unable to update existing Amazon S3 ACLs. %s", "s2member-admin", "s2member"), $s3_response["message"]));
                                                 } else {
                                                     // Else, we use a default error code and message.
                                                     return array("success" => false, "code" => -88, "message" => _x("Unable to update existing Amazon S3 ACLs. Connection failed.", "s2member-admin", "s2member"));
                                                 }
                                             } else {
                                                 if (isset($cf_response["code"], $cf_response["message"])) {
                                                     /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                                     return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
                                                 } else {
                                                     // Else, we use a default error code and message.
                                                     return array("success" => false, "code" => -89, "message" => _x("Unable to create Amazon CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
                                                 }
                                             }
                                         } else {
                                             if (isset($cf_response["code"], $cf_response["message"])) {
                                                 /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                                 return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_response["message"]));
                                             } else {
                                                 // Else, we use a default error code and message.
                                                 return array("success" => false, "code" => -90, "message" => _x("Unable to create Amazon CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
                                             }
                                         }
                                     } else {
                                         if (isset($cf_response["code"], $cf_response["message"])) {
                                             /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                             return array("success" => false, "code" => $cf_response["code"], "message" => sprintf(_x("Unable to create Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_response["message"]));
                                         } else {
                                             // Else, we use a default error code and message.
                                             return array("success" => false, "code" => -91, "message" => _x("Unable to create Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
                                         }
                                     }
                                 } else {
                                     // Else, we use a default error code and message.
                                     return array("success" => false, "code" => -92, "message" => _x("Unable to clear existing Amazon CloudFront Origin Access Identity.", "s2member-admin", "s2member"));
                                 }
                             } else {
                                 if (isset($cf_get_response["code"], $cf_get_response["message"])) {
                                     /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                                     return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Origin Access Identity. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
                                 } else {
                                     // Else, we use a default error code and message.
                                     return array("success" => false, "code" => -93, "message" => _x("Unable to acquire existing Amazon CloudFront Origin Access Identity. Connection failed.", "s2member-admin", "s2member"));
                                 }
                             }
                         } else {
                             // Else, we use a default error code and message.
                             return array("success" => false, "code" => -94, "message" => _x("Unable to clear existing Amazon CloudFront Streaming Distro.", "s2member-admin", "s2member"));
                         }
                     } else {
                         if (isset($cf_get_response["code"], $cf_get_response["message"])) {
                             /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                             return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Streaming Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
                         } else {
                             // Else, we use a default error code and message.
                             return array("success" => false, "code" => -95, "message" => _x("Unable to acquire existing Amazon CloudFront Streaming Distro. Connection failed.", "s2member-admin", "s2member"));
                         }
                     }
                 } else {
                     // Else, we use a default error code and message.
                     return array("success" => false, "code" => -96, "message" => _x("Unable to clear existing Amazon CloudFront Downloads Distro.", "s2member-admin", "s2member"));
                 }
             } else {
                 if (isset($cf_get_response["code"], $cf_get_response["message"])) {
                     /* translators: In this translation, `%s` may be filled with an English message, which comes from the Amazon CloudFront API call. Feel free to exclude `%s` if you like. */
                     return array("success" => false, "code" => $cf_get_response["code"], "message" => sprintf(_x("Unable to acquire existing Amazon CloudFront Downloads Distro. %s", "s2member-admin", "s2member"), $cf_get_response["message"]));
                 } else {
                     // Else, we use a default error code and message.
                     return array("success" => false, "code" => -97, "message" => _x("Unable to acquire existing Amazon CloudFront Downloads Distro. Connection failed.", "s2member-admin", "s2member"));
                 }
             }
         } else {
             // Else, we use a default error code and message.
             return array("success" => false, "code" => -98, "message" => _x("Unable to auto-configure Amazon CloudFront Distros. Incomplete Amazon CloudFront configuration options. Missing of one: Amazon CloudFront Private Key-Pair-ID, or Private Key file contents.", "s2member-admin", "s2member"));
         }
     } else {
         // Else, we use a default error code and message.
         return array("success" => false, "code" => -99, "message" => _x("Unable to auto-configure Amazon S3/CloudFront Distros. Incomplete Amazon S3 configuration options. Missing one of: Amazon S3 Bucket, Access Key, or Secret Key. You must provide s2Member with an Amazon S3 configuration before enabling CloudFront.", "s2member-admin", "s2member"));
     }
 }
 /**
  * Builds and handles the API Notifications page.
  * 
  * @package s2Member\Menu_Pages
  * @since 3.5
  * 
  * @return null
  */
 public static function api_ops_page()
 {
     do_action("ws_plugin__s2member_before_api_ops_page", get_defined_vars());
     /**/
     c_ws_plugin__s2member_menu_pages::update_all_options();
     /**/
     include_once dirname(dirname(__FILE__)) . "/menu-pages/api-ops.inc.php";
     /**/
     do_action("ws_plugin__s2member_after_api_ops_page", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
 /**
  * Builds the Coupon Codes page.
  *
  * @package s2Member\Menu_Pages
  * @since 1.5
  *
  * @return null
  */
 public static function coupon_codes_page()
 {
     c_ws_plugin__s2member_menu_pages::update_all_options();
     /* Updates options. */
     /**/
     include_once dirname(dirname(__FILE__)) . "/menu-pages/coupon-codes.inc.php";
     /**/
     return;
     /* Return for uniformity. */
 }
Example #18
0
 /**
  * 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 &amp; 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;
 }