本文整理汇总了PHP中AIOWPSecurity_Utility::is_multisite_install方法的典型用法代码示例。如果您正苦于以下问题:PHP AIOWPSecurity_Utility::is_multisite_install方法的具体用法?PHP AIOWPSecurity_Utility::is_multisite_install怎么用?PHP AIOWPSecurity_Utility::is_multisite_install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AIOWPSecurity_Utility
的用法示例。
在下文中一共展示了AIOWPSecurity_Utility::is_multisite_install方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: aiowps_validate_registration_with_captcha
function aiowps_validate_registration_with_captcha($errors, $sanitized_user_login, $user_email)
{
global $aio_wp_security;
$locked = $aio_wp_security->user_login_obj->check_locked_user();
if ($locked == null) {
//user is not locked continue
} else {
$errors->add('authentication_failed', __('<strong>ERROR</strong>: You are not allowed to register because your IP address is currently locked!', 'all-in-one-wp-security-and-firewall'));
return $errors;
}
if (array_key_exists('aiowps-captcha-answer', $_POST)) {
isset($_POST['aiowps-captcha-answer']) ? $captcha_answer = strip_tags(trim($_POST['aiowps-captcha-answer'])) : ($captcha_answer = '');
$captcha_secret_string = $aio_wp_security->configs->get_value('aiowps_captcha_secret_key');
$submitted_encoded_string = base64_encode($_POST['aiowps-captcha-temp-string'] . $captcha_secret_string . $captcha_answer);
$trans_handle = sanitize_text_field($_POST['aiowps-captcha-string-info']);
$captcha_string_info_trans = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('aiowps_captcha_string_info_' . $trans_handle) : get_transient('aiowps_captcha_string_info_' . $trans_handle);
if ($submitted_encoded_string !== $captcha_string_info_trans) {
//This means a wrong answer was entered
//return new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Your answer was incorrect - please try again.', 'all-in-one-wp-security-and-firewall'));
$errors->add('authentication_failed', __('<strong>ERROR</strong>: Your answer was incorrect - please try again.', 'all-in-one-wp-security-and-firewall'));
return $errors;
}
}
return $errors;
}
示例2: prepare_items
function prepare_items()
{
//First, lets decide how many records per page to show
$per_page = 20;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
//$this->process_bulk_action();
global $wpdb;
global $aio_wp_security;
$logged_in_users = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('users_online') : get_transient('users_online');
if ($logged_in_users !== FALSE) {
foreach ($logged_in_users as $key => $val) {
$userdata = get_userdata($val['user_id']);
$username = $userdata->user_login;
$val['username'] = $username;
$logged_in_users[$key] = $val;
}
} else {
$logged_in_users = array();
//If no transient found set to empty array
}
$data = $logged_in_users;
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
$this->items = $data;
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
}
示例3: generate_maths_question
function generate_maths_question()
{
global $aio_wp_security;
//For now we will only do plus, minus, multiplication
$equation_string = '';
$operator_type = array('+', '−', '×');
$operand_display = array('word', 'number');
//let's now generate an equation
$operator = $operator_type[rand(0, 2)];
if ($operator === '×') {
//Don't make the question too hard if multiplication
$first_digit = rand(1, 5);
$second_digit = rand(1, 5);
} else {
$first_digit = rand(1, 20);
$second_digit = rand(1, 20);
}
if ($operand_display[rand(0, 1)] == 'word') {
$first_operand = $this->number_word_mapping($first_digit);
} else {
$first_operand = $first_digit;
}
if ($operand_display[rand(0, 1)] == 'word') {
$second_operand = $this->number_word_mapping($second_digit);
} else {
$second_operand = $second_digit;
}
//Let's caluclate the result and construct the equation string
if ($operator === '+') {
//Addition
$result = $first_digit + $second_digit;
$equation_string .= $first_operand . ' ' . $operator . ' ' . $second_operand . ' = ';
} else {
if ($operator === '−') {
//Subtraction
//If we are going to be negative let's swap operands around
if ($first_digit < $second_digit) {
$equation_string .= $second_operand . ' ' . $operator . ' ' . $first_operand . ' = ';
$result = $second_digit - $first_digit;
} else {
$equation_string .= $first_operand . ' ' . $operator . ' ' . $second_operand . ' = ';
$result = $first_digit - $second_digit;
}
} elseif ($operator === '×') {
//Multiplication
$equation_string .= $first_operand . ' ' . $operator . ' ' . $second_operand . ' = ';
$result = $first_digit * $second_digit;
}
}
//Let's encode correct answer
$captcha_secret_string = $aio_wp_security->configs->get_value('aiowps_captcha_secret_key');
$current_time = time();
$enc_result = base64_encode($current_time . $captcha_secret_string . $result);
$random_str = AIOWPSecurity_Utility::generate_alpha_numeric_random_string(10);
AIOWPSecurity_Utility::is_multisite_install() ? set_site_transient('aiowps_captcha_string_info_' . $random_str, $enc_result, 30 * 60) : set_transient('aiowps_captcha_string_info_' . $random_str, $enc_result, 30 * 60);
$equation_string .= '<input type="hidden" name="aiowps-captcha-string-info" id="aiowps-captcha-string-info" value="' . $random_str . '" />';
$equation_string .= '<input type="hidden" name="aiowps-captcha-temp-string" id="aiowps-captcha-temp-string" value="' . $current_time . '" />';
$equation_string .= '<input type="text" size="2" id="aiowps-captcha-answer" name="aiowps-captcha-answer" value="" />';
return $equation_string;
}
示例4: check_user_exists
static function check_user_exists($username)
{
global $wpdb;
//if username is empty just return false
if ($username == '') {
return false;
}
//If multisite
if (AIOWPSecurity_Utility::is_multisite_install()) {
$blog_id = get_current_blog_id();
$admin_users = get_users('blog_id=' . $blog_id . 'orderby=login&role=administrator');
$acct_name_exists = false;
foreach ($admin_users as $user) {
if ($user->user_login == $username) {
$acct_name_exists = true;
break;
}
}
return $acct_name_exists;
}
//check users table
$user = $wpdb->get_var("SELECT user_login FROM `" . $wpdb->users . "` WHERE user_login='" . sanitize_text_field($username) . "';");
$userid = $wpdb->get_var("SELECT ID FROM `" . $wpdb->users . "` WHERE ID='" . sanitize_text_field($username) . "';");
if ($user == $username || $userid == $username) {
return true;
} else {
return false;
}
}
示例5: prepare_items
function prepare_items()
{
//First, lets decide how many records per page to show
$per_page = 20;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
//$this->process_bulk_action();
global $wpdb;
global $aio_wp_security;
/* -- Ordering parameters -- */
//Parameters that are going to be used to order the result
$orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'user_id';
$order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : 'DESC';
$logged_in_users = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('users_online') : get_transient('users_online');
foreach ($logged_in_users as $key => $val) {
$userdata = get_userdata($val['user_id']);
$username = $userdata->user_login;
$val['username'] = $username;
$logged_in_users[$key] = $val;
}
$data = $logged_in_users;
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, ($current_page - 1) * $per_page, $per_page);
$this->items = $data;
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
}
示例6: set_menu_tabs
function set_menu_tabs()
{
if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1) {
//Suppress the DB prefix change tab if site is a multi site AND not the main site
$this->menu_tabs = array('tab2' => __('DB Backup', 'aiowpsecurity'));
} else {
$this->menu_tabs = array('tab1' => __('DB Prefix', 'aiowpsecurity'), 'tab2' => __('DB Backup', 'aiowpsecurity'));
}
}
示例7: get_bulk_actions
function get_bulk_actions()
{
if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1) {
//Suppress the block link if site is a multi site AND not the main site
$actions = array();
//blank array
} else {
$actions = array('block' => 'Block');
}
return $actions;
}
示例8: render_menu_tabs
function render_menu_tabs()
{
$current_tab = $this->get_current_tab();
echo '<h2 class="nav-tab-wrapper">';
foreach ($this->menu_tabs as $tab_key => $tab_caption) {
if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1 && stristr($tab_caption, "Rename Login Page") === false && stristr($tab_caption, "Login Captcha") === false) {
//Suppress the all Brute Force menu tabs if site is a multi site AND not the main site except "rename login" and "captcha"
} else {
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
}
}
echo '</h2>';
}
示例9: render_tab1
//.........这里部分代码省略.........
?>
</div></div>
</div><!-- aiowps_dashboard_box -->
<?php
}
//End if statement for Rename Login box
if ($aio_wp_security->configs->get_value('aiowps_enable_automated_fcd_scan') == '1') {
echo '<div class="aiowps_dashboard_box_small">';
echo '<div class="postbox">';
echo '<h3><label for="title">File Change Detection</label></h3>';
echo '<div class="inside">';
if ($aio_wp_security->configs->get_value('aiowps_fcds_change_detected')) {
echo '<div class="aio_red_box aio_padding_10">File change detected!</div>';
echo '<p>Please review the changes from the <a href="admin.php?page=' . AIOWPSEC_FILESCAN_MENU_SLUG . '">scanner menu</a></p>';
} else {
echo '<div class="aio_green_box aio_padding_10">No recent file changes detected.</div>';
}
echo '</div></div>';
echo '</div>';
//<!-- aiowps_dashboard_box -->
}
//End if statement for automated scan box
?>
<div class="aiowps_dashboard_box_small">
<div class="postbox">
<h3><label for="title"><?php
_e('Logged In Users', 'aiowpsecurity');
?>
</label></h3>
<div class="inside">
<?php
$users_online_link = '<a href="admin.php?page=' . AIOWPSEC_USER_LOGIN_MENU_SLUG . '&tab=tab5">Logged In Users</a>';
if (AIOWPSecurity_Utility::is_multisite_install()) {
$logged_in_users = get_site_transient('users_online');
$num_users = count($logged_in_users);
if ($num_users > 1) {
echo '<div class="aio_red_box"><p>' . __('Number of users currently logged in site-wide is:', 'aiowpsecurity') . ' <strong>' . $num_users . '</strong></p>';
$info_msg = '<p>' . sprintf(__('Go to the %s menu to see more details', 'aiowpsecurity'), $users_online_link) . '</p>';
echo $info_msg . '</div>';
} else {
echo '<div class="aio_green_box"><p>' . __('There are no other site-wide users currently logged in.', 'aiowpsecurity') . '</p></div>';
}
} else {
$logged_in_users = get_transient('users_online');
if ($logged_in_users === false || $logged_in_users == NULL) {
$num_users = 0;
} else {
$num_users = count($logged_in_users);
}
if ($num_users > 1) {
echo '<div class="aio_red_box"><p>' . __('Number of users currently logged into your site (including you) is:', 'aiowpsecurity') . ' <strong>' . $num_users . '</strong></p>';
$info_msg = '<p>' . sprintf(__('Go to the %s menu to see more details', 'aiowpsecurity'), $users_online_link) . '</p>';
echo $info_msg . '</div>';
} else {
echo '<div class="aio_green_box"><p>' . __('There are no other users currently logged in.', 'aiowpsecurity') . '</p></div>';
}
}
?>
</div></div>
</div><!-- aiowps_dashboard_box -->
<div class="aiowps_dashboard_box_small">
<div class="postbox">
<h3><label for="title"><?php
_e('Locked IP Addresses', 'aiowpsecurity');
示例10: render_tab2
//.........这里部分代码省略.........
</table>
<input type="submit" name="aiowps_auto_spam_block" value="<?php
_e('Save Settings', 'all-in-one-wp-security-and-firewall');
?>
" class="button-primary" />
</form>
</div></div>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php
_e('List SPAMMER IP Addresses', 'all-in-one-wp-security-and-firewall');
?>
</label></h3>
<div class="inside">
<div class="aio_blue_box">
<?php
echo '<p>' . __('This section displays a list of the IP addresses of the people or bots who have left SPAM comments on your site.', 'all-in-one-wp-security-and-firewall') . '
<br />' . __('This information can be handy for identifying the most persistent IP addresses or ranges used by spammers.', 'all-in-one-wp-security-and-firewall') . '
<br />' . __('By inspecting the IP address data coming from spammers you will be in a better position to determine which addresses or address ranges you should block by adding them to your blacklist.', 'all-in-one-wp-security-and-firewall') . '
<br />' . __('To add one or more of the IP addresses displayed in the table below to your blacklist, simply click the "Block" link for the individual row or select more than one address
using the checkboxes and then choose the "block" option from the Bulk Actions dropdown list and click the "Apply" button.', 'all-in-one-wp-security-and-firewall') . '
</p>';
?>
</div>
<form action="" method="POST">
<?php
wp_nonce_field('aiowpsec-spammer-ip-list-nonce');
?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php
_e('Minimum number of SPAM comments per IP', 'all-in-one-wp-security-and-firewall');
?>
:</th>
<td><input type="text" size="5" name="aiowps_spam_ip_min_comments" value="<?php
echo $aio_wp_security->configs->get_value('aiowps_spam_ip_min_comments');
?>
" />
<span class="description"><?php
_e('This field allows you to list only those IP addresses which have been used to post X or more SPAM comments.', 'all-in-one-wp-security-and-firewall');
?>
</span>
<span class="aiowps_more_info_anchor"><span class="aiowps_more_info_toggle_char">+</span><span class="aiowps_more_info_toggle_text"><?php
_e('More Info', 'all-in-one-wp-security-and-firewall');
?>
</span></span>
<div class="aiowps_more_info_body">
<?php
echo '<p class="description">' . __('Example 1: Setting this value to "0" or "1" will list ALL IP addresses which were used to submit SPAM comments.', 'all-in-one-wp-security-and-firewall') . '</p>';
echo '<p class="description">' . __('Example 2: Setting this value to "5" will list only those IP addresses which were used to submit 5 SPAM comments or more on your site.', 'all-in-one-wp-security-and-firewall') . '</p>';
?>
</div>
</td>
</tr>
</table>
<input type="submit" name="aiowps_ip_spam_comment_search" value="<?php
_e('Find IP Addresses', 'all-in-one-wp-security-and-firewall');
?>
" class="button-primary" />
</form>
</div></div>
<div class="postbox">
<h3 class="hndle"><label for="title"><?php
_e('SPAMMER IP Address Results', 'all-in-one-wp-security-and-firewall');
?>
</label></h3>
<div class="inside">
<?php
if (AIOWPSecurity_Utility::is_multisite_install() && get_current_blog_id() != 1) {
echo '<div class="aio_yellow_box">';
echo '<p>' . __('The plugin has detected that you are using a Multi-Site WordPress installation.', 'all-in-one-wp-security-and-firewall') . '</p>
<p>' . __('Only the "superadmin" can block IP addresses from the main site.', 'all-in-one-wp-security-and-firewall') . '</p>
<p>' . __('Take note of the IP addresses you want blocked and ask the superadmin to add these to the blacklist using the "Blacklist Manager" on the main site.', 'all-in-one-wp-security-and-firewall') . '</p>';
echo '</div>';
}
//Fetch, prepare, sort, and filter our data...
$spammer_ip_list->prepare_items();
//echo "put table of locked entries here";
?>
<form id="tables-filter" method="get" onSubmit="return confirm('Are you sure you want to perform this bulk operation on the selected entries?');">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php
echo esc_attr($_REQUEST['page']);
?>
" />
<input type="hidden" name="tab" value="<?php
echo esc_attr($_REQUEST['tab']);
?>
" />
<!-- Now we can render the completed list table -->
<?php
$spammer_ip_list->display();
?>
</form>
</div></div>
<?php
}
示例11: change_db_prefix
function change_db_prefix($table_old_prefix, $table_new_prefix)
{
global $wpdb, $aio_wp_security;
$old_prefix_length = strlen($table_old_prefix);
$error = 0;
//Config file path
$config_file = AIOWPSecurity_Utility_File::get_wp_config_file_path();
//Get the table resource
//$result = mysql_list_tables(DB_NAME);
$result = $this->get_mysql_tables(DB_NAME);
//Fix for deprecated php mysql_list_tables function
//Count the number of tables
if (is_array($result) && count($result) > 0) {
$num_rows = count($result);
} else {
echo '<div class="aio_red_box"><p>' . __('Error - Could not get tables or no tables found!', 'all-in-one-wp-security-and-firewall') . '</p></div>';
return;
}
$table_count = 0;
$info_msg_string = '<p class="aio_info_with_icon">' . __('Starting DB prefix change operations.....', 'all-in-one-wp-security-and-firewall') . '</p>';
$info_msg_string .= '<p class="aio_info_with_icon">' . sprintf(__('Your WordPress system has a total of %s tables and your new DB prefix will be: %s', 'all-in-one-wp-security-and-firewall'), '<strong>' . $num_rows . '</strong>', '<strong>' . $table_new_prefix . '</strong>') . '</p>';
echo $info_msg_string;
//Do a back of the config file
if (!AIOWPSecurity_Utility_File::backup_and_rename_wp_config($config_file)) {
echo '<div class="aio_red_box"><p>' . __('Failed to make a backup of the wp-config.php file. This operation will not go ahead.', 'all-in-one-wp-security-and-firewall') . '</p></div>';
return;
} else {
echo '<p class="aio_success_with_icon">' . __('A backup copy of your wp-config.php file was created successfully!', 'all-in-one-wp-security-and-firewall') . '</p>';
}
//Get multisite blog_ids if applicable
if (AIOWPSecurity_Utility::is_multisite_install()) {
$blog_ids = AIOWPSecurity_Utility::get_blog_ids();
}
//Rename all the table names
foreach ($result as $db_table) {
//Get table name with old prefix
$table_old_name = $db_table;
if (strpos($table_old_name, $table_old_prefix) === 0) {
//Get table name with new prefix
$table_new_name = $table_new_prefix . substr($table_old_name, $old_prefix_length);
//Write query to rename tables name
$sql = "RENAME TABLE `" . $table_old_name . "` TO `" . $table_new_name . "`";
//$sql = "RENAME TABLE %s TO %s";
//Execute the query
if (false === $wpdb->query($sql)) {
$error = 1;
echo '<p class="aio_error_with_icon">' . sprintf(__('%s table name update failed', 'all-in-one-wp-security-and-firewall'), '<strong>' . $table_old_name . '</strong>') . '</p>';
$aio_wp_security->debug_logger->log_debug("DB Security Feature - Unable to change prefix of table " . $table_old_name, 4);
} else {
$table_count++;
}
} else {
continue;
}
}
if ($error == 1) {
echo '<p class="aio_error_with_icon">' . sprintf(__('Please change the prefix manually for the above tables to: %s', 'all-in-one-wp-security-and-firewall'), '<strong>' . $table_new_prefix . '</strong>') . '</p>';
} else {
echo '<p class="aio_success_with_icon">' . sprintf(__('%s tables had their prefix updated successfully!', 'all-in-one-wp-security-and-firewall'), '<strong>' . $table_count . '</strong>') . '</p>';
}
//Get wp-config.php file contents and modify it with new info
$config_contents = file($config_file);
$prefix_match_string = '$table_prefix=';
//this is our search string for the wp-config.php file
foreach ($config_contents as $line_num => $line) {
$no_ws_line = preg_replace('/\\s+/', '', $line);
//Strip white spaces
if (strpos($no_ws_line, $prefix_match_string) !== FALSE) {
$config_contents[$line_num] = str_replace($table_old_prefix, $table_new_prefix, $line);
break;
}
}
//Now let's modify the wp-config.php file
if (AIOWPSecurity_Utility_File::write_content_to_file($config_file, $config_contents)) {
echo '<p class="aio_success_with_icon">' . __('wp-config.php file was updated successfully!', 'all-in-one-wp-security-and-firewall') . '</p>';
} else {
echo '<p class="aio_error_with_icon">' . sprintf(__('The "wp-config.php" file was not able to be modified. Please modify this file manually using your favourite editor and search
for variable "$table_prefix" and assign the following value to that variable: %s', 'all-in-one-wp-security-and-firewall'), '<strong>' . $table_new_prefix . '</strong>') . '</p>';
$aio_wp_security->debug_logger->log_debug("DB Security Feature - Unable to modify wp-config.php", 4);
}
//Now let's update the options table
$update_option_table_query = "UPDATE " . $table_new_prefix . "options \r\r\n SET option_name = '" . $table_new_prefix . "user_roles' \r\r\n WHERE option_name = '" . $table_old_prefix . "user_roles' \r\r\n LIMIT 1";
if (false === $wpdb->query($update_option_table_query)) {
echo '<p class="aio_error_with_icon">' . sprintf(__('Update of table %s failed: unable to change %s to %s', 'all-in-one-wp-security-and-firewall'), $table_new_prefix . 'options', $table_old_prefix . 'user_roles', $table_new_prefix . 'user_roles') . '</p>';
$aio_wp_security->debug_logger->log_debug("DB Security Feature - Error when updating the options table", 4);
//Log the highly unlikely event of DB error
} else {
echo '<p class="aio_success_with_icon">' . sprintf(__('The options table records which had references to the old DB prefix were updated successfully!', 'all-in-one-wp-security-and-firewall')) . '</p>';
}
//Now let's update the options tables for the multisite subsites if applicable
if (AIOWPSecurity_Utility::is_multisite_install()) {
if (!empty($blog_ids)) {
foreach ($blog_ids as $blog_id) {
if ($blog_id == 1) {
continue;
}
//skip main site
$new_pref_and_site_id = $table_new_prefix . $blog_id . '_';
$old_pref_and_site_id = $table_old_prefix . $blog_id . '_';
$update_ms_option_table_query = "UPDATE " . $new_pref_and_site_id . "options\r\r\n SET option_name = '" . $new_pref_and_site_id . "user_roles'\r\r\n WHERE option_name = '" . $old_pref_and_site_id . "user_roles'\r\r\n LIMIT 1";
//.........这里部分代码省略.........
示例12: update_user_online_transient
/**
* This will clean up the "users_online" transient entry for the current user.
*
*/
function update_user_online_transient($user_id, $ip_addr)
{
global $aio_wp_security;
$logged_in_users = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('users_online') : get_transient('users_online');
//$logged_in_users = get_transient('users_online');
if ($logged_in_users === false || $logged_in_users == NULL) {
return;
}
$j = 0;
foreach ($logged_in_users as $value) {
if ($value['user_id'] == $user_id && strcmp($value['ip_address'], $ip_addr) == 0) {
unset($logged_in_users[$j]);
break;
}
$j++;
}
//Save the transient
AIOWPSecurity_Utility::is_multisite_install() ? set_site_transient('users_online', $logged_in_users, 30 * 60) : set_transient('users_online', $logged_in_users, 30 * 60);
//set_transient('users_online', $logged_in_users, 30 * 60); //Set transient with the data obtained above and also set the expiry to 30min
return;
}
示例13: do_additional_plugins_loaded_tasks
function do_additional_plugins_loaded_tasks()
{
if (isset($_GET['aiowpsec_do_log_out'])) {
wp_logout();
if (isset($_GET['after_logout'])) {
$after_logout_url = esc_url($_GET['after_logout']);
AIOWPSecurity_Utility::redirect_to_url($after_logout_url);
}
$additional_data = strip_tags($_GET['al_additional_data']);
if (isset($additional_data)) {
$login_url = '';
//Inspect the payload and do redirect to login page with a msg and redirect url
$logout_payload = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('aiowps_logout_payload') : get_transient('aiowps_logout_payload');
if (!empty($logout_payload['redirect_to'])) {
$login_url = AIOWPSecurity_Utility::add_query_data_to_url(wp_login_url(), 'redirect_to', $logout_payload['redirect_to']);
}
if (!empty($logout_payload['msg'])) {
$login_url .= '&' . $logout_payload['msg'];
}
if (!empty($login_url)) {
AIOWPSecurity_Utility::redirect_to_url($login_url);
}
}
}
}
示例14: update_logged_in_user_transient
function update_logged_in_user_transient()
{
if (is_user_logged_in()) {
$current_user_ip = AIOWPSecurity_Utility_IP::get_user_ip_address();
// get the logged in users list from transients entry
$logged_in_users = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('users_online') : get_transient('users_online');
// $logged_in_users = get_transient('users_online');
$current_user = wp_get_current_user();
$current_user = $current_user->ID;
$current_time = current_time('timestamp');
$current_user_info = array("user_id" => $current_user, "last_activity" => $current_time, "ip_address" => $current_user_ip);
//We will store last activity time and ip address in transient entry
if ($logged_in_users === false || $logged_in_users == NULL) {
$logged_in_users = array();
$logged_in_users[] = $current_user_info;
AIOWPSecurity_Utility::is_multisite_install() ? set_site_transient('users_online', $logged_in_users, 30 * 60) : set_transient('users_online', $logged_in_users, 30 * 60);
// set_transient('users_online', $logged_in_users, 30 * 60); //Set transient with the data obtained above and also set the expire to 30min
} else {
$key = 0;
$do_nothing = false;
$update_existing = false;
$item_index = 0;
foreach ($logged_in_users as $value) {
if ($value['user_id'] == $current_user && strcmp($value['ip_address'], $current_user_ip) == 0) {
if ($value['last_activity'] < $current_time - 15 * 60) {
$update_existing = true;
$item_index = $key;
break;
} else {
$do_nothing = true;
break;
}
}
$key++;
}
if ($update_existing) {
//Update transient if the last activity was less than 15 min ago for this user
$logged_in_users[$item_index] = $current_user_info;
AIOWPSecurity_Utility::is_multisite_install() ? set_site_transient('users_online', $logged_in_users, 30 * 60) : set_transient('users_online', $logged_in_users, 30 * 60);
} else {
if ($do_nothing) {
//Do nothing
} else {
$logged_in_users[] = $current_user_info;
AIOWPSecurity_Utility::is_multisite_install() ? set_site_transient('users_online', $logged_in_users, 30 * 60) : set_transient('users_online', $logged_in_users, 30 * 60);
}
}
}
}
}
示例15: buddy_press_signup_validate_captcha
function buddy_press_signup_validate_captcha($errors)
{
global $bp, $aio_wp_security;
//Check if captcha enabled
if (array_key_exists('aiowps-captcha-answer', $_POST)) {
isset($_POST['aiowps-captcha-answer']) ? $captcha_answer = strip_tags(trim($_POST['aiowps-captcha-answer'])) : ($captcha_answer = '');
$captcha_secret_string = $aio_wp_security->configs->get_value('aiowps_captcha_secret_key');
$submitted_encoded_string = base64_encode($_POST['aiowps-captcha-temp-string'] . $captcha_secret_string . $captcha_answer);
$trans_handle = sanitize_text_field($_POST['aiowps-captcha-string-info']);
$captcha_string_info_trans = AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('aiowps_captcha_string_info_' . $trans_handle) : get_transient('aiowps_captcha_string_info_' . $trans_handle);
if ($submitted_encoded_string !== $captcha_string_info_trans) {
//This means a wrong answer was entered
$bp->signup->errors['aiowps-captcha-answer'] = __('Your CAPTCHA answer was incorrect - please try again.', 'all-in-one-wp-security-and-firewall');
}
}
return;
}