get_option( 'manage_capability', 'manage_options') ); if( current_user_can( $manage_cap ) ) { $type = $_GET['type']; if( $type == 'odt' || $type == 'html' ) { $filepath = $WP_Statistics->plugin_dir . '/manual'; $filename = ''; $ext = '.' . $type; // open this directory $dir = opendir( $filepath ); // get each entry while( $entry = readdir( $dir ) ) { if( substr( $entry, -strlen( $ext ) ) == $ext ) { $filename = $entry; } } // close directory closedir( $dir ); if( $filename != '' ) { header('Content-Type: application/octet-stream;'); header('Content-Disposition: attachment; filename="' . $filename . '"'); readfile( $filepath . '/' . $filename ); } } } } ?>