Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions wp/wp-admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,46 @@
<div class="about__section changelog has-subtle-background-color">
<div class="column">
<h2><?php _e( 'Maintenance and Security Releases' ); ?></h2>
<p>
<?php
printf(
/* translators: %s: WordPress version. */
__( '<strong>Version %s</strong> addressed some security issues.' ),
'7.0.4'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
sanitize_title( '7.0.4' )
)
);
?>
</p>
<p>
<?php
printf(
/* translators: %s: WordPress version. */
__( '<strong>Version %s</strong> addressed some security issues.' ),
'7.0.3'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL. */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version. */
esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ),
sanitize_title( '7.0.3' )
)
);
?>
</p>
<p>
<?php
printf(
Expand Down
11 changes: 8 additions & 3 deletions wp/wp-admin/includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function edit_user( $user_id = 0 ) {
$user->user_login = sanitize_user( wp_unslash( $_POST['user_login'] ), true );
}

$errors = new WP_Error();

$pass1 = '';
$pass2 = '';
if ( isset( $_POST['pass1'] ) ) {
Expand Down Expand Up @@ -78,7 +80,12 @@ function edit_user( $user_id = 0 ) {
}

if ( isset( $_POST['email'] ) ) {
$user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) );
$maybe_email = wp_unslash( $_POST['email'] );
if ( is_string( $maybe_email ) && is_email( $maybe_email ) ) {
$user->user_email = $maybe_email;
} else {
$errors->add( 'invalid_email', __( '<strong>Error:</strong> The email address is not correct.' ), array( 'form-field' => 'email' ) );
}
}
if ( isset( $_POST['url'] ) ) {
if ( empty( $_POST['url'] ) || 'http://' === $_POST['url'] ) {
Expand Down Expand Up @@ -145,8 +152,6 @@ function edit_user( $user_id = 0 ) {
$user->use_ssl = 1;
}

$errors = new WP_Error();

/* checking that username has been typed */
if ( '' === $user->user_login ) {
$errors->add( 'user_login', __( '<strong>Error:</strong> Please enter a username.' ) );
Expand Down
7 changes: 6 additions & 1 deletion wp/wp-admin/js/inline-edit-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,12 @@ window.wp = window.wp || {};
if ( !$(':input[name="post_author"] option[value="' + $('.post_author', rowData).text() + '"]', editRow).val() ) {

// The post author no longer has edit capabilities, so we need to add them to the list of authors.
$(':input[name="post_author"]', editRow).prepend('<option value="' + $('.post_author', rowData).text() + '">' + $('#post-' + id + ' .author').text() + '</option>');
$(':input[name="post_author"]', editRow).prepend(
new Option(
$('#post-' + id + ' .author').text(),
$('.post_author', rowData).text()
)
);
}
if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
$('label.inline-edit-author', editRow).hide();
Expand Down
2 changes: 1 addition & 1 deletion wp/wp-admin/js/inline-edit-post.min.js

Large diffs are not rendered by default.

60 changes: 28 additions & 32 deletions wp/wp-content/plugins/sqlite-database-integration/activate.php
Original file line number Diff line number Diff line change
@@ -1,60 +1,56 @@
<?php
/**
* Handle the SQLite activation.
*
* @since 1.0.0
* @package wp-sqlite-integration
*/

/**
* Redirect to the plugin's admin screen on activation.
*
* @since 1.0.0
*
* @param string $plugin The plugin basename.
*/
function sqlite_plugin_activation_redirect( $plugin ) {
if ( plugin_basename( SQLITE_MAIN_FILE ) === $plugin ) {
if ( wp_safe_redirect( admin_url( 'options-general.php?page=sqlite-integration' ) ) ) {
exit;
}
if (
plugin_basename( SQLITE_MAIN_FILE ) !== $plugin
|| ! current_user_can( sqlite_plugin_get_manage_capability() )
) {
return;
}

if ( wp_safe_redirect( sqlite_plugin_get_admin_page_url() ) ) {
exit;
}
}
add_action( 'activated_plugin', 'sqlite_plugin_activation_redirect' );

/**
* Check the URL to ensure we're on the plugin page,
* the user has clicked the button to install SQLite,
* and the nonce is valid.
* the user has permission to manage the database drop-in, and the nonce is valid.
* If the above conditions are met, run the sqlite_plugin_copy_db_file() function,
* and redirect to the install screen.
*
* @since 1.0.0
*/
function sqlite_activation() {
global $current_screen;
if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) {
if (
! isset( $_GET['page'], $_GET['confirm-install'] )
|| 'sqlite-integration' !== $_GET['page']
) {
return;
}
if ( isset( $_GET['confirm-install'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'sqlite-install' ) ) {

// Handle upgrading from the performance-lab plugin.
if ( isset( $_GET['upgrade-from-pl'] ) ) {
global $wp_filesystem;
require_once ABSPATH . '/wp-admin/includes/file.php';
// Delete the previous db.php file.
$wp_filesystem->delete( WP_CONTENT_DIR . '/db.php' );
// Deactivate the performance-lab SQLite module.
$pl_option_name = defined( 'PERFLAB_MODULES_SETTING' ) ? PERFLAB_MODULES_SETTING : 'perflab_modules_settings';
$pl_option = get_option( $pl_option_name, array() );
unset( $pl_option['database/sqlite'] );
update_option( $pl_option_name, $pl_option );
}
sqlite_plugin_copy_db_file();
// WordPress will automatically redirect to the install screen here.
wp_redirect( admin_url() );
exit;
if ( ! current_user_can( sqlite_plugin_get_manage_capability() ) ) {
wp_die(
esc_html__( 'Sorry, you are not allowed to install the SQLite database drop-in.', 'sqlite-database-integration' ),
403
);
}

check_admin_referer( 'sqlite-install' );

sqlite_plugin_copy_db_file();

// WordPress will automatically redirect to the install screen here.
wp_redirect( admin_url() );
exit;
}
add_action( 'admin_init', 'sqlite_activation' );

Expand All @@ -75,7 +71,7 @@ function ( $result ) {
* When the plugin gets merged in wp-core, this is not to be ported.
*/
function sqlite_plugin_copy_db_file() {
// Bail early if the PDO SQLite extension is not loaded.
// Bail early if the pdo_sqlite extension is not loaded.
if ( ! extension_loaded( 'pdo_sqlite' ) ) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php
/**
* Functions to add admin notices if necessary.
*
* @since 1.0.0
* @package wp-sqlite-integration
*/

/**
Expand All @@ -12,18 +9,21 @@
* When the plugin gets merged in wp-core, this is not to be ported.
*/
function sqlite_plugin_admin_notice() {
if ( ! current_user_can( sqlite_plugin_get_manage_capability() ) ) {
return;
}

// Don't print notices in the plugin's admin screen.
global $current_screen;
if ( isset( $current_screen->base ) && 'settings_page_sqlite-integration' === $current_screen->base ) {
return;
}

// If PDO SQLite is not loaded, bail early.
// Bail early if the pdo_sqlite extension is not loaded.
if ( ! extension_loaded( 'pdo_sqlite' ) ) {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'The SQLite Integration plugin is active, but the PDO SQLite extension is missing from your server. Please make sure that PDO SQLite is enabled in your PHP installation.', 'sqlite-database-integration' )
esc_html__( 'The SQLite Integration plugin is active, but the pdo_sqlite extension is missing from your server. Please make sure that pdo_sqlite is enabled in your PHP installation.', 'sqlite-database-integration' )
);
return;
}
Expand Down Expand Up @@ -66,11 +66,8 @@ function sqlite_plugin_admin_notice() {
/* translators: 1: db.php drop-in path, 2: Admin URL to deactivate the module */
__( 'The SQLite Integration plugin is active, but the %1$s file is missing. Please <a href="%2$s">deactivate the plugin</a> and re-activate it to try again.', 'sqlite-database-integration' ),
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>',
esc_url( admin_url( 'plugins.php' ) )
esc_url( self_admin_url( 'plugins.php' ) )
)
);
}
add_action( 'admin_notices', 'sqlite_plugin_admin_notice' ); // Add the admin notices.

// Remove the PL-plugin admin notices for SQLite.
remove_action( 'admin_notices', 'perflab_sqlite_plugin_admin_notice' );
add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', 'sqlite_plugin_admin_notice' ); // Add the admin notices.
80 changes: 39 additions & 41 deletions wp/wp-content/plugins/sqlite-database-integration/admin-page.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
<?php
/**
* Functions for the admin page of the plugin.
*
* @since 1.0.0
* @package wp-sqlite-integration
*/

/**
* Add an admin menu page.
*
* @since 1.0.0
*/
function sqlite_add_admin_menu() {
add_options_page(
$parent_slug = is_multisite() ? 'settings.php' : 'options-general.php';

add_submenu_page(
$parent_slug,
__( 'SQLite integration', 'sqlite-database-integration' ),
__( 'SQLite integration', 'sqlite-database-integration' ),
'manage_options',
sqlite_plugin_get_manage_capability(),
'sqlite-integration',
'sqlite_integration_admin_screen'
);
}
add_action( 'admin_menu', 'sqlite_add_admin_menu' );
add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', 'sqlite_add_admin_menu' );

/**
* The admin page contents.
*/
function sqlite_integration_admin_screen() {
if ( ! current_user_can( sqlite_plugin_get_manage_capability() ) ) {
wp_die(
esc_html__( 'Sorry, you are not allowed to access the SQLite integration settings.', 'sqlite-database-integration' ),
403
);
}

$db_dropin_path = WP_CONTENT_DIR . '/db.php';

/*
Expand Down Expand Up @@ -56,7 +61,7 @@ function sqlite_integration_admin_screen() {
printf(
/* translators: 1: Admin URL to deactivate the module, 2: db.php drop-in path, */
__( 'The SQLite drop-in is enabled. To disable it and get back to your previous, MySQL database, you can <a href="%1$s">deactivate the plugin</a>. Alternatively, you can manually delete the %2$s file from your server.', 'sqlite-database-integration' ),
esc_url( admin_url( 'plugins.php' ) ),
esc_url( self_admin_url( 'plugins.php' ) ),
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
);
?>
Expand All @@ -66,40 +71,17 @@ function sqlite_integration_admin_screen() {
<p><?php esc_html_e( 'We detected that the PDO SQLite driver is missing from your server (the pdo_sqlite extension is not loaded). Please make sure that SQLite is enabled in your PHP installation before proceeding.', 'sqlite-database-integration' ); ?></p>
</div>
<?php elseif ( file_exists( $db_dropin_path ) && ! defined( 'SQLITE_DB_DROPIN_VERSION' ) && ! $override_db_dropin ) : ?>
<?php if ( defined( 'PERFLAB_SQLITE_DB_DROPIN_VERSION' ) ) : ?>
<div class="notice notice-warning">
<p>
<?php
printf(
/* translators: %s: db.php drop-in path */
esc_html__( 'An older %s file was detected. Please click the button below to update the file.', 'sqlite-database-integration' ),
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
);
?>
</p>
</div>
<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=sqlite-integration&confirm-install&upgrade-from-pl' ), 'sqlite-install' ) ); ?>">
<div class="notice notice-error">
<p>
<?php
printf(
/* translators: %s: db.php drop-in path */
esc_html__( 'Update %s file', 'sqlite-database-integration' ),
esc_html__( 'The SQLite plugin cannot be activated because a different %s drop-in already exists.', 'sqlite-database-integration' ),
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
);
?>
</a>
<?php else : ?>
<div class="notice notice-error">
<p>
<?php
printf(
/* translators: %s: db.php drop-in path */
esc_html__( 'The SQLite plugin cannot be activated because a different %s drop-in already exists.', 'sqlite-database-integration' ),
'<code>' . esc_html( basename( WP_CONTENT_DIR ) ) . '/db.php</code>'
);
?>
</p>
</div>
<?php endif; ?>
</p>
</div>
<?php elseif ( ! is_writable( WP_CONTENT_DIR ) ) : ?>
<div class="notice notice-error">
<p>
Expand Down Expand Up @@ -136,7 +118,7 @@ function sqlite_integration_admin_screen() {

<p><?php esc_html_e( 'By clicking the button below, you will be redirected to the WordPress installation screen to setup your new database', 'sqlite-database-integration' ); ?></p>

<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=sqlite-integration&confirm-install' ), 'sqlite-install' ) ); ?>"><?php esc_html_e( 'Install SQLite database', 'sqlite-database-integration' ); ?></a>
<a class="button button-primary" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'confirm-install', '1', sqlite_plugin_get_admin_page_url() ), 'sqlite-install' ) ); ?>"><?php esc_html_e( 'Install SQLite database', 'sqlite-database-integration' ); ?></a>
<?php endif; ?>
</div>
<?php
Expand All @@ -145,13 +127,15 @@ function sqlite_integration_admin_screen() {
/**
* Adds a link to the admin bar.
*
* @since n.e.x.t
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param WP_Admin_Bar $admin_bar The admin bar object.
*/
function sqlite_plugin_adminbar_item( $admin_bar ) {
if ( ! current_user_can( sqlite_plugin_get_manage_capability() ) ) {
return;
}

global $wpdb;

if ( defined( 'SQLITE_DB_DROPIN_VERSION' ) && defined( 'DB_ENGINE' ) && 'sqlite' === DB_ENGINE ) {
Expand All @@ -166,9 +150,23 @@ function sqlite_plugin_adminbar_item( $admin_bar ) {
'id' => 'sqlite-db-integration',
'parent' => 'top-secondary',
'title' => $title,
'href' => esc_url( admin_url( 'options-general.php?page=sqlite-integration' ) ),
'href' => esc_url( sqlite_plugin_get_admin_page_url() ),
'meta' => false,
);
$admin_bar->add_node( $args );
}
add_action( 'admin_bar_menu', 'sqlite_plugin_adminbar_item', 999 );

/**
* Get the SQLite integration admin page URL.
*
* @access private
*
* @return string Admin page URL.
*/
function sqlite_plugin_get_admin_page_url() {
if ( is_multisite() ) {
return network_admin_url( 'settings.php?page=sqlite-integration' );
}
return admin_url( 'options-general.php?page=sqlite-integration' );
}
Loading