Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter martinburchell

    (@martinburchell)

    Awesome!

    Thanks for the quick turnaround.

    Thread Starter martinburchell

    (@martinburchell)

    We ended up adding filters when the options were loaded and saved, using the example from the mcrypt_encrypt() PHP documentation:

    function decrypt_password( $settings ) {
    	$key = get_encryption_key();
    	$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC );
    
    	if ( isset( $settings['group'] ) && is_array( $settings['group'] ) ) {
    		foreach ( $settings['group'] as $group_id => &$group_settings ) {
    			if ( isset( $group_settings['servers'] ) && is_array( $group_settings['servers'] ) ) {
    				foreach ( $group_settings['servers'] as $server_id => &$server_details ) {
    					$ciphertext = base64_decode( $server_details['password'] );
    					$iv = substr( $ciphertext, 0, $iv_size );
    					$ciphertext = substr( $ciphertext, $iv_size );
    					$padded_password = mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $key,
    													   $ciphertext, MCRYPT_MODE_CBC, $iv );
    					$server_details['password'] = rtrim( $padded_password );
    				}
    			}
    		}
    	}
    
    	return $settings;
    }
    
    add_filter( 'option_so_options', 'decrypt_password' );
    
    function encrypt_password( $settings, $old_settings ) {
    	$key = get_encryption_key();
    	$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC );
    
    	if ( isset( $settings['group'] ) && is_array( $settings['group'] ) ) {
    		foreach ( $settings['group'] as $group_id => &$group_settings ) {
    			if ( isset( $group_settings['servers'] ) && is_array( $group_settings['servers'] ) ) {
    				foreach ( $group_settings['servers'] as $server_id => &$server_details ) {
    					$iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
    					$ciphertext = mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $key,
    												$server_details['password'], MCRYPT_MODE_CBC, $iv );
    					$ciphertext = $iv . $ciphertext;
    					$server_details['password']  = base64_encode( $ciphertext );
    				}
    			}
    		}
    	}
    
    	return $settings;
    }
    
    add_filter( 'pre_update_option_so_options', 'encrypt_password' );

    Thread Starter martinburchell

    (@martinburchell)

    Thanks for your help Nick

    Yes it is XHTML strict. I’m guessing the validator rejects any attributes it doesn’t recognise. In practical terms it probably doesn’t make any difference to the operation of my site, but I like to run a validator on all of the pages to check for more critical things like tags not being properly closed. The less noise the validator produces the better.

    Thread Starter martinburchell

    (@martinburchell)

    2.0.3.1

    I’ll see how much effort it would be to update my theme to use HTML 5.

    Thread Starter martinburchell

    (@martinburchell)

    Hi Nick

    That won’t work because all of the events across several days are contained within the div element with class gce-list-grouped.

    I’ll put in a feature request as you suggest.

Viewing 5 replies - 1 through 5 (of 5 total)