Dave McHale
Forum Replies Created
-
Hey again! Now that I’m back in the States, was just curious if you’d had a chance to review this ?? Let me know if you have any questions/feedback on what I did there!
Sorry, not trying to seem impatient – since I didn’t hear from you before now, and I’m leaving w/o net access for a few days, I thought I’d just post the updates here.
This is from the beginning of the render_tab5() function on line 502, through the end of the file, including the closing class bracket. This encapsulates everything that I changed/added.
function render_tab5() { global $aio_wp_security; if(isset($_POST['aiowps_import_settings']))//Do form submission tasks { $nonce=$_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'aiowpsec-import-settings-nonce')) { $aio_wp_security->debug_logger->log_debug("Nonce check failed on import AIOWPS settings!",4); die("Nonce check failed on import AIOWPS settings!"); } if (empty($_POST['aiowps_import_settings_file']) && empty($_POST['aiowps_import_settings_text'])) { $this->show_msg_error(__('Please choose a file to import your settings from.', 'aiowpsecurity')); } else { if (empty($_POST['aiowps_import_settings_file'])) { $import_from = "text"; } else { $import_from = "file"; } if ($import_from == "file") { //Let's get the uploaded import file path $submitted_import_file_path = trim($_POST['aiowps_import_settings_file']); $attachment_id = AIOWPSecurity_Utility_File::get_attachment_id_from_url($submitted_import_file_path); //we'll need this later for deleting //Verify that file chosen has valid AIOWPS settings contents $aiowps_settings_file_contents = $this->check_if_valid_aiowps_settings_file($submitted_import_file_path); } else { //Get the string right from the textarea. Still confirm it's in the expected format. $aiowps_settings_file_contents = $this->check_if_valid_aiowps_settings_text($_POST['aiowps_import_settings_text']); } if ($aiowps_settings_file_contents != -1) { //Apply the settings and delete the file (if applicable) $settings_array = json_decode($aiowps_settings_file_contents, true); $aiowps_settings_applied = update_option('aio_wp_security_configs', $settings_array); if (!$aiowps_settings_applied) { //Failed to import settings $aio_wp_security->debug_logger->log_debug("Import AIOWPS settings from " . $import_from . " operation failed!",4); $this->show_msg_error(__('Import AIOWPS settings from ' . $import_from . ' operation failed!','aiowpsecurity')); if ($import_from == "file") { //Delete the uploaded settings file for security purposes wp_delete_attachment( $attachment_id, true ); if ( false === wp_delete_attachment( $attachment_id, true ) ){ $this->show_msg_error(__('The deletion of the import file failed. Please delete this file manually via the media menu for security purposes.', 'aiowpsecurity')); }else{ $this->show_msg_updated(__('The file you uploaded was also deleted for security purposes because it contains security settings details.', 'aiowpsecurity')); } } } else { if ($import_from == "file") { //Delete the uploaded settings file for security purposes wp_delete_attachment( $attachment_id, true ); if ( false === wp_delete_attachment( $attachment_id, true ) ){ $this->show_msg_updated(__('Your AIOWPS settings were successfully imported via file input.', 'aiowpsecurity')); $this->show_msg_error(__('The deletion of the import file failed. Please delete this file manually via the media menu for security purposes because it contains security settings details.', 'aiowpsecurity')); }else{ $this->show_msg_updated(__('Your AIOWPS settings were successfully imported. The file you uploaded was also deleted for security purposes because it contains security settings details.', 'aiowpsecurity')); } } else { $this->show_msg_updated(__('Your AIOWPS settings were successfully imported via text entry.', 'aiowpsecurity')); } } } else { //Invalid settings file $aio_wp_security->debug_logger->log_debug("The contents of your settings file appear invalid!",4); $this->show_msg_error(__('The contents of your settings file appear invalid. Please check the contents of the file you are trying to import settings from.','aiowpsecurity')); if ($import_from == "file") { //Let's also delete the uploaded settings file for security purposes wp_delete_attachment( $attachment_id, true ); if ( false === wp_delete_attachment( $attachment_id, true ) ){ $this->show_msg_error(__('The deletion of the import file failed. Please delete this file manually via the media menu for security purposes.', 'aiowpsecurity')); }else{ $this->show_msg_updated(__('The file you uploaded was also deleted for security purposes because it contains security settings details.', 'aiowpsecurity')); } } } } } ?> <h2><?php _e('Export or Import Your AIOWPS Settings', 'aiowpsecurity')?></h2> <div class="aio_blue_box"> <?php echo '<p>'.__('This section allows you to export or import your All In One WP Security & Firewall settings.', 'aiowpsecurity'); echo '<br />'.__('This can be handy if you wanted to save time by applying the settings from one site to another site.', 'aiowpsecurity').' <br />'.__('NOTE: Before importing, it is your responsibility to know what settings you are trying to import. Importing settings blindly can cause you to be locked out of your site.', 'aiowpsecurity').' <br />'.__('For Example: If a settings item rely on the domain URL then it may not work correctly when imported into a different domain.','aiowpsecurity').' </p>'; ?> </div> <div class="postbox"> <h3><label for="title"><?php _e('Export AIOWPS Settings', 'aiowpsecurity'); ?></label></h3> <div class="inside"> <form action="" method="POST"> <?php wp_nonce_field('aiowpsec-export-settings-nonce'); ?> <table class="form-table"> <tr valign="top"> <span class="description"><?php _e('To export your All In One WP Security & Firewall settings click the button below.', 'aiowpsecurity'); ?></span> </tr> </table> <input type="submit" name="aiowps_export_settings" value="<?php _e('Export AIOWPS Settings', 'aiowpsecurity')?>" class="button-primary" /> </form> </div></div> <div class="postbox"> <h3><label for="title"><?php _e('Import AIOWPS Settings', 'aiowpsecurity'); ?></label></h3> <div class="inside"> <form action="" method="POST"> <?php wp_nonce_field('aiowpsec-import-settings-nonce'); ?> <table class="form-table"> <tr valign="top"> <span class="description"><?php _e('Use this section to import your All In One WP Security & Firewall settings from a file. Alternatively, copy/paste the contents of your import file into the textarea below.', 'aiowpsecurity'); ?></span> <th scope="row"><?php _e('Import File', 'aiowpsecurity')?>:</th> <td> <input type="button" id="aiowps_import_settings_file_button" name="aiowps_import_settings_file_button" class="button rbutton" value="Select Your Import Settings File" /> <input name="aiowps_import_settings_file" type="text" id="aiowps_import_settings_file" value="" size="80" /> <p class="description"> <?php _e('After selecting your file, click the button below to apply the settings to your site.', 'aiowpsecurity'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Copy/Paste Import Data', 'aiowpsecurity')?>:</th> <td> <textarea name="aiowps_import_settings_text" id="aiowps_import_settings_text" style="width:80%;height:140px;"></textarea> </td> </tr> </table> <input type="submit" name="aiowps_import_settings" value="<?php _e('Import AIOWPS Settings', 'aiowpsecurity')?>" class="button-primary" /> </form> </div></div> <?php } function check_if_wp_config_contents($wp_file) { $is_wp_config = false; $file_contents = file($wp_file); if ($file_contents == '' || $file_contents == NULL || $file_contents == false) { return -1; } foreach ($file_contents as $line) { if ((strpos($line, "define('DB_NAME'") !== false)) { $is_wp_config = true; //It appears that we have some sort of wp-config.php file break; } else { //see if we're at the end of the section $is_wp_config = false; } } if ($is_wp_config) { return 1; } else { return -1; } } function check_if_valid_aiowps_settings_text($strText) { if ($this->check_is_aiopws_settings($strText)) { return stripcslashes($strText); } else { return -1; } } function check_is_aiopws_settings($strText) { if(strpos($strText, 'aiowps_enable_login_lockdown') === FALSE){ return false; } else { return true; } } //Checks if valid aiowps settings file and returns contents as string function check_if_valid_aiowps_settings_file($wp_file) { $is_aiopws_settings = false; $file_contents = file_get_contents($wp_file); if ($file_contents == '' || $file_contents == NULL || $file_contents == false) { return -1; } //Check a known aiowps config strings to see if it is contained within this file $is_aiopws_settings = $this->check_is_aiopws_settings($file_contents); if ($is_aiopws_settings) { return $file_contents; } else { return -1; } } } //end class
Forum: Fixing WordPress
In reply to: 404 Errors on back end pagesNope. Go to /wp-admin/options-permalink.php (which you can get to under Settings -> Permalinks inside your admin area) and re-save that page.
Forum: Fixing WordPress
In reply to: 404 Errors on back end pages404’s on all pages other than the homepage usually indicates a problem with your Permalinks. If you go to the settings page in your admin area and simply re-save the page with your permalink settings (it will probably already look like everything is set properly, but re-save the form anyway), your Permalinks will likely start working again and you should be able to browse your website normally.
I don’t have an answer on *why* this gets corrupted, I just know that this works to fix it when it happens ?? Good luck!
Forum: Fixing WordPress
In reply to: My site is tiny!I think Andrew meant are you zoomed out in your browser. Try holding down the left Control key on your keyboard and scrolling your mousewheel up or down. Chances are, you accidentally set your browser zoom on yourself. Both sites look fine on this end ??
Forum: Fixing WordPress
In reply to: WP won't save page after a certain point near the end of the articleIn doing a little more testing on my end this morning, I was able to generate some strange issues with long contents. If you try to save a post with too much content, it actually was erasing ALL of the content on me when I would hit save. Not sure if this is a WP core issue, TinyMCE issue, or…?
Hoping someone else can chime in and either corroborate what we’re seeing, or have an answer as to why that’s happening.
Forum: Fixing WordPress
In reply to: WP won't save page after a certain point near the end of the articleWould be news to me too, but like I said the cutoff point just seemed very suspicious. Especially with well-formed HTML to close the final P tag.
You’re CERTAIN that your content is all being pasted into the editor before you hit submit? Maybe your clipboard isn’t pasting everything in before you save?
dmchale(at)gmail.com
Thanks!
Forum: Fixing WordPress
In reply to: WP won't save page after a certain point near the end of the articleWish I knew, sorry. Though I’m highly suspect of the content itself… if you copy/paste from the opening P tag through the closing P tag of your incomplete sentence, it is 5001 characters. Perhaps something is cutting you off after 5000 legitimate characters and slapping the closing P tag on it for you automatically?
Do you have any other plugins installed that may be messing with things? Replacement WYSIWYG editor, perhaps? I looked through the TwentyFourteen theme files just in case, but didn’t see anything in the template that would be doing it to you.
Wish I had a real answer, but with luck maybe one of those questions helps lead you to finding what’s causing it. Good luck!
Forum: Fixing WordPress
In reply to: WP won't save page after a certain point near the end of the articleI think you’ll have to undo some protection you have going on – all I see when I go to the link is “Crescent City Cleaning Services
is getting an Extreme Makeover!We’ll be back with an entire new website very soon” ??
Forum: Fixing WordPress
In reply to: Running 3.9 How do I update to 3.9.2?You can disable *automatic* core updates via the WP_AUTO_UPDATE_CORE constant, but I don’t know of anything that disables updates outright. And if you’re running 3.9, at least you’re fairly recent.
What buttons do you see just below the line that tells you when it last checked? You SHOULD see “An updated version of WordPress is available. You can update to WordPress 3.9.2 automatically or download the package and install it manually:” with two buttons – “Update Now” or “Download 3.9.2”.
You could also try directly accessing /wp-admin/update-core.php?action=do-core-upgrade and see if that gets you what you want (though, looking at the code, it may fail the referer check). That’s the destination of the form post if you do click on the “update now” button.
Of course, you always have that option to manually update but I would do everything in my power to avoid having to do that.
Forum: Fixing WordPress
In reply to: enable htmlA plugin that messed with your editor was going to be my next pick ??
Truthfully, we’ve stopped using Ultimate TinyMCE on our sites because of the updates that core has been making to improve the default editor that comes with WP. Haven’t had any issues or “wants” with the default editor lately, and we don’t run into any issues like what you just saw.
Glad you got it fixed!
Forum: Fixing WordPress
In reply to: Exporting a WP db from a shared MySQL db instanceAh. Too bad, that was the easy way ?? lol
This seems like it has what you want. https://www.tomauger.com/2011/tips-and-tricks/mysqldump-one-liner-to-export-wordpress-tables-in-a-shared-database
MySQL apparently does not support wildcard selectors (news to me, though I haven’t done anything command-line in mySQL in a while) but this solution is a cute workaround. It combines the “export all explicitly specified tables” command with “replace the explicit table names with a sql query that gets me only the table names I want by querying the schema directly”.
I hope it works for you!
Forum: Fixing WordPress
In reply to: enable htmlAssuming you are running WP 3.9.2 (or most latest versions), you should be able to find the HTML contents of your page/post under the “Text” tab in the upper right of the WYSIWYG editor.
Forum: Fixing WordPress
In reply to: Running 3.9 How do I update to 3.9.2?Hi alanfinn. What do you see on this screen? /wp-admin/update-core.php
You should see when the last time was that WP checked for a new version, and have the option to download updates here.
Do you know what role your user has inside WordPress? Is it possible you do not have sufficient permissions to upgrade it manually yourself?