PowerPress Podcasting plugin by Blubrry - Version 0.9.8

Version Description

  • Released on 9/02/2009
  • When we release 1.0 of PowerPress, new features will be added separately so bugs introduced by new features do not effect the existing plugin.
  • Fixed bug introduced in 0.9.6, caused by the array_unshift() function. Its behavior was not consistent and has been removed. Bug caused a chain reaction of bugs, its fix resolves the following: Play in new Window error: Unable to retrieve media information, Episodes randomly not appearing in post pages, Previous PodPress created episodes no longer appearing.
  • Fixed bug with publishing a new post with media file warning messages for curl_setopt() function
  • Fixed bug for PodPress data that is wrongly serialized in database. WP 2.8+ get_meta_data() function was returning false rather than the damaged serialized string.
  • PodPress Import improved, some cases PodPress data in the database is double serialized, new code resolves this complexity with help with bug fix above.
  • Select Media screen, better message printed to user when they are not a media hosting customer.
  • Fixed bug with RSS language tag for Custom Podcast Category feeds.
  • Cleaned up code for jQuery/Thickbox screens.
  • Added extra security checks and additional Nonces checks to ajax methods added by PowerPress.
  • Added option for Blubrry Services users to be able to delete uploaded media
Download this release

Release Info

Developer amandato
Plugin Icon 128x128 PowerPress Podcasting plugin by Blubrry
Version 0.9.8
Comparing to
See all releases

Code changes from version 0.9.7 to 0.9.8

mp3info.class.php CHANGED
@@ -219,7 +219,7 @@
219
  {
220
  $curl = curl_init();
221
  // First, get the content-length...
222
- curl_setopt($cUrl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
223
  curl_setopt($curl, CURLOPT_URL, $url);
224
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
225
  curl_setopt($curl, CURLOPT_HEADER, true); // header will be at output
@@ -272,7 +272,7 @@
272
  $fp = fopen($TempFile, 'w+b');
273
  // Next get the first chunk of the file...
274
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
275
- curl_setopt($cUrl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
276
  curl_setopt($curl, CURLOPT_FILE, $fp);
277
  curl_setopt($curl, CURLOPT_URL, $url);
278
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
219
  {
220
  $curl = curl_init();
221
  // First, get the content-length...
222
+ curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
223
  curl_setopt($curl, CURLOPT_URL, $url);
224
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
225
  curl_setopt($curl, CURLOPT_HEADER, true); // header will be at output
272
  $fp = fopen($TempFile, 'w+b');
273
  // Next get the first chunk of the file...
274
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
275
+ curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
276
  curl_setopt($curl, CURLOPT_FILE, $fp);
277
  curl_setopt($curl, CURLOPT_URL, $url);
278
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
powerpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
- Version: 0.9.7
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
@@ -28,8 +28,12 @@ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
28
  This project uses source that is GPL licensed.
29
  */
30
 
 
 
 
 
31
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
32
- define('POWERPRESS_VERSION', '0.9.7' );
33
 
34
  /////////////////////////////////////////////////////
35
  // The following define options should be placed in your
@@ -100,12 +104,19 @@ function powerpress_content($content)
100
 
101
  // PowerPress settings:
102
  $GeneralSettings = get_option('powerpress_general');
103
- // Lets make the default feed the top most feed listed:
104
- if( isset($GeneralSettings['custom_feeds']['podcast']) )
105
- unset($GeneralSettings['custom_feeds']['podcast']);
106
- else
107
- $GeneralSettings['custom_feeds'] = array();
108
- array_unshift($GeneralSettings['custom_feeds'], array('podcast'=>'Podcast Feed') ); // Fixes scenario where the user never configured the custom default podcast feed.
 
 
 
 
 
 
 
109
 
110
  if( !isset($GeneralSettings['display_player']) )
111
  $GeneralSettings['display_player'] = 1;
@@ -151,9 +162,7 @@ function powerpress_content($content)
151
  }
152
  }
153
 
154
-
155
-
156
- // TODO: START LOOP HERE TO DISPLAY EACH MEDIA TYPE
157
  $new_content = '';
158
  while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
159
  {
@@ -170,8 +179,9 @@ function powerpress_content($content)
170
  {
171
  if( $GeneralSettings['process_podpress'] && $feed_slug == 'podcast' )
172
  {
173
- //$Settings = get_option('powerpress_general');
174
- $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
 
175
  if( $podPressMedia )
176
  {
177
  if( !is_array($podPressMedia) )
@@ -595,8 +605,9 @@ function powerpress_rss2_item()
595
  $EnclosureURL = '';
596
  if( $powerpress_feed['process_podpress'] )
597
  {
598
- //$Settings = get_option('powerpress_general');
599
- $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
 
600
  if( !is_array($podPressMedia) )
601
  {
602
  // Sometimes the stored data gets messed up, we can fix it here:
@@ -863,7 +874,6 @@ function powerpress_rss_language($value)
863
  if( powerpress_is_custom_podcast_feed() )
864
  {
865
  global $powerpress_feed;
866
- return print_r($powerpress_feed, true);
867
  if( $powerpress_feed && isset($powerpress_feed['rss_language']) && $powerpress_feed['rss_language'] != '' )
868
  $value = $powerpress_feed['rss_language'];
869
  }
@@ -1970,12 +1980,51 @@ function powerpress_repair_serialize($string)
1970
  {
1971
  if( @unserialize($string) )
1972
  return $string; // Nothing to repair...
1973
- return preg_replace_callback('/(s:(\d+):"([^"]*)")/',
1974
  create_function(
1975
  '$matches',
1976
  'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s"\', strlen($matches[3]), $matches[3]);'
1977
  ),
1978
  $string);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1979
  }
1980
 
1981
  function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
+ Version: 0.9.8
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
28
  This project uses source that is GPL licensed.
29
  */
30
 
31
+
32
+ if( !function_exists('add_action') )
33
+ die("access denied.");
34
+
35
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
36
+ define('POWERPRESS_VERSION', '0.9.8' );
37
 
38
  /////////////////////////////////////////////////////
39
  // The following define options should be placed in your
104
 
105
  // PowerPress settings:
106
  $GeneralSettings = get_option('powerpress_general');
107
+ if( !isset($GeneralSettings['custom_feeds']) )
108
+ $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
109
+
110
+ // Re-order so the default podcast episode is the top most...
111
+ $Temp = $GeneralSettings['custom_feeds'];
112
+ $GeneralSettings['custom_feeds'] = array();
113
+ $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
114
+ while( list($feed_slug, $feed_title) = each($Temp) )
115
+ {
116
+ if( $feed_slug == 'podcast' )
117
+ continue;
118
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
119
+ }
120
 
121
  if( !isset($GeneralSettings['display_player']) )
122
  $GeneralSettings['display_player'] = 1;
162
  }
163
  }
164
 
165
+ // LOOP HERE TO DISPLAY EACH MEDIA TYPE
 
 
166
  $new_content = '';
167
  while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
168
  {
179
  {
180
  if( $GeneralSettings['process_podpress'] && $feed_slug == 'podcast' )
181
  {
182
+ //$podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
183
+ $podPressMedia = powerpress_get_post_meta($post->ID, 'podPressMedia');
184
+
185
  if( $podPressMedia )
186
  {
187
  if( !is_array($podPressMedia) )
605
  $EnclosureURL = '';
606
  if( $powerpress_feed['process_podpress'] )
607
  {
608
+ //$podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
609
+ $podPressMedia = powerpress_get_post_meta($post->ID, 'podPressMedia');
610
+
611
  if( !is_array($podPressMedia) )
612
  {
613
  // Sometimes the stored data gets messed up, we can fix it here:
874
  if( powerpress_is_custom_podcast_feed() )
875
  {
876
  global $powerpress_feed;
 
877
  if( $powerpress_feed && isset($powerpress_feed['rss_language']) && $powerpress_feed['rss_language'] != '' )
878
  $value = $powerpress_feed['rss_language'];
879
  }
1980
  {
1981
  if( @unserialize($string) )
1982
  return $string; // Nothing to repair...
1983
+ $string = preg_replace_callback('/(s:(\d+):"([^"]*)")/',
1984
  create_function(
1985
  '$matches',
1986
  'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s"\', strlen($matches[3]), $matches[3]);'
1987
  ),
1988
  $string);
1989
+
1990
+ if( substr($string, 0, 2) == 's:' ) // Sometimes the serialized data is double serialized, so we need to re-serialize the outside string
1991
+ {
1992
+ $string = preg_replace_callback('/(s:(\d+):"(.*)";)$/',
1993
+ create_function(
1994
+ '$matches',
1995
+ 'if( strlen($matches[3]) == $matches[2] ) return $matches[0]; return sprintf(\'s:%d:"%s";\', strlen($matches[3]), $matches[3]);'
1996
+ ),
1997
+ $string);
1998
+ }
1999
+
2000
+ return $string;
2001
+ }
2002
+
2003
+ /*
2004
+ powerpress_get_post_meta()
2005
+ Safe function to retrieve corrupted PodPress data from the database
2006
+ @post_id - post id to retrieve post meta for
2007
+ @key - key to retrieve post meta for
2008
+ */
2009
+ function powerpress_get_post_meta($post_id, $key)
2010
+ {
2011
+ $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
2012
+ if ( !$pp_meta_cache ) {
2013
+ update_postmeta_cache($post_id);
2014
+ $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
2015
+ }
2016
+
2017
+ $meta = false;
2018
+ if ( isset($pp_meta_cache[$key]) )
2019
+ $meta = $pp_meta_cache[$key][0];
2020
+
2021
+ if ( is_serialized( $meta ) ) // Logic used up but not including WordPress 2.8, new logic doesn't make sure if unserialized failed or not
2022
+ {
2023
+ if ( false !== ( $gm = @unserialize( $meta ) ) )
2024
+ return $meta;
2025
+ }
2026
+
2027
+ return $meta;
2028
  }
2029
 
2030
  function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
powerpressadmin-appearance.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- // powerpressadmin-presentation.php
3
 
4
  function powerpressadmin_appearance()
5
  {
1
  <?php
2
+ // powerpressadmin-appearance.php
3
 
4
  function powerpressadmin_appearance()
5
  {
powerpressadmin-basic.php CHANGED
@@ -43,6 +43,7 @@ function SelectEntryBox(mode)
43
  document.getElementById('episode_box_keywords').disabled = (mode!=2);
44
  document.getElementById('episode_box_subtitle').disabled = (mode!=2);
45
  document.getElementById('episode_box_summary').disabled = (mode!=2);
 
46
  document.getElementById('episode_box_mode_adv').style.display = (mode==2?'block':'none');
47
  }
48
 
@@ -353,7 +354,7 @@ while( list($value,$desc) = each($options) )
353
  <?php _e("Blubrry Services"); ?>
354
  </th>
355
  <td>
356
- <p style="margin-top: 5px;"><span id="service_mode"><?php echo $ModeDesc; ?></span> (<strong><a href="<?php echo admin_url(); ?>?action=powerpress-jquery-account&KeepThis=true&TB_iframe=true&width=500&height=400&modal=true" target="_blank" class="thickbox" style="color: #3D517E;" title="Blubrry Services Integration">Click here to configure Blubrry Services</a></strong>)</p>
357
  </td>
358
  </tr>
359
 
43
  document.getElementById('episode_box_keywords').disabled = (mode!=2);
44
  document.getElementById('episode_box_subtitle').disabled = (mode!=2);
45
  document.getElementById('episode_box_summary').disabled = (mode!=2);
46
+ document.getElementById('episode_box_explicit').disabled = (mode!=2);
47
  document.getElementById('episode_box_mode_adv').style.display = (mode==2?'block':'none');
48
  }
49
 
354
  <?php _e("Blubrry Services"); ?>
355
  </th>
356
  <td>
357
+ <p style="margin-top: 5px;"><span id="service_mode"><?php echo $ModeDesc; ?></span> (<strong><a href="<?php echo admin_url(); echo wp_nonce_url("admin.php?action=powerpress-jquery-account", 'powerpress-jquery-account'); ?>&KeepThis=true&TB_iframe=true&width=500&height=400&modal=true" target="_blank" class="thickbox" style="color: #3D517E;" title="Blubrry Services Integration">Click here to configure Blubrry Services</a></strong>)</p>
358
  </td>
359
  </tr>
360
 
powerpressadmin-categoryfeeds.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
 
4
  function powerpress_admin_customfeeds_columns($data=array())
5
  {
1
  <?php
2
 
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
 
6
  function powerpress_admin_customfeeds_columns($data=array())
7
  {
powerpressadmin-customfeeds.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
 
4
  function powerpress_admin_customfeeds_columns($data=array())
5
  {
1
  <?php
2
 
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
 
6
  function powerpress_admin_customfeeds_columns($data=array())
7
  {
powerpressadmin-dashboard.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function powerpress_dashboard_head()
4
  {
5
  ?>
1
  <?php
2
 
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
+
6
  function powerpress_dashboard_head()
7
  {
8
  ?>
powerpressadmin-editfeed.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function powerpress_languages()
4
  {
5
  // List copied from PodPress:
1
  <?php
2
 
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
+
6
  function powerpress_languages()
7
  {
8
  // List copied from PodPress:
powerpressadmin-jquery.php CHANGED
@@ -45,46 +45,110 @@ function powerpress_admin_jquery_init()
45
  $action = (isset($_GET['action'])?$_GET['action']: (isset($_POST['action'])?$_POST['action']:false) );
46
  if( !$action )
47
  return;
48
-
 
49
  switch($action)
50
  {
51
  case 'powerpress-jquery-stats': {
52
 
53
  // Make sure users have permission to access this
54
  if( @$Settings['use_caps'] && !current_user_can('view_podcast_stats') )
55
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  $StatsCached = get_option('powerpress_stats');
58
 
59
- powerpress_admin_jquery_header('Blubrry Media Statistics');
60
  ?>
61
- <h2>Blubrry Media Statistics</h2>
62
  <?php
63
  echo $StatsCached['content'];
64
  powerpress_admin_jquery_footer();
65
  exit;
66
  }; break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  case 'powerpress-jquery-media': {
68
 
69
- if( $Settings['blubrry_auth'] == '' )
 
 
 
 
 
 
 
 
 
 
 
 
70
  {
71
- powerpress_admin_jquery_header('Select Media');
72
  ?>
73
- <p>Wait a sec! This feature is only available to Blubrry Podcast Community members. Join our community to get free podcast statistics and access to other valuable <a href="http://www.blubrry.com/powerpress_services/" target="_blank">services</a>.</p>
 
 
 
 
 
74
  <p>Our <a href="http://www.blubrry.com/powerpress_services/" target="_blank">podcast-hosting integrated</a> PowerPress makes podcast publishing simple. Check out the <a href="http://www.blubrry.com/powerpress_services/" target="_blank">video</a> on our exciting three-step publishing system!</p>
 
75
  <?php
76
  powerpress_admin_jquery_footer();
77
  exit;
78
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  $api_url = sprintf('%s/media/%s/index.json?quota=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
82
  $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
83
  $results = powerpress_json_decode($json_data);
84
- // print_r($files);
85
 
86
  $FeedSlug = $_GET['podcast-feed'];
87
- powerpress_admin_jquery_header('Select Media');
88
  ?>
89
  <script language="JavaScript" type="text/javascript">
90
 
@@ -95,14 +159,21 @@ function SelectMedia(File)
95
  self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly='true';
96
  self.parent.tb_remove();
97
  }
 
 
 
 
98
  </script>
99
  <p style="text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding:0;"><a href="#" onclick="self.parent.tb_remove();" title="Cancel"><img src="<?php echo admin_url(); ?>/images/no.png" /></a></p>
100
  <div id="media-header">
101
- <h2>Select Media</h2>
102
- <div class="media-upload-link"><a href="<?php echo admin_url(); ?>?action=powerpress-jquery-upload&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=true" class="thickbox" title="Upload Media File">Upload Media File</a></div>
 
 
 
 
103
  <p>Select from media files uploaded to blubrry.com:</p>
104
  </div>
105
- <!-- <ul class="media"> -->
106
  <div id="media-items-container">
107
  <div id="media-items">
108
  <?php
@@ -120,24 +191,15 @@ function SelectMedia(File)
120
  $QuotaData = $data;
121
  continue;
122
  }
123
- // old way:
124
- /*
125
- ?>
126
-
127
- <li>
128
- <a href="#" onclick="self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value='<?php echo $data['name']; ?>'; self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='1'; self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly='true'; self.parent.tb_remove(); return false;"><?php echo $data['name']; ?></a>
129
- <cite><?php echo powerpress_byte_size($data['length']); ?></cite>
130
- </li>
131
- <?php
132
- */
133
- // new way:
134
  ?>
135
  <div class="media-item">
136
  <strong class="media-name"><?php echo $data['name']; ?></strong>
137
  <cite><?php echo powerpress_byte_size($data['length']); ?></cite>
138
-
139
  <div class="media-item-links">
140
- <a href="#" onclick="self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value='<?php echo $data['name']; ?>'; self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='1'; self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly='true'; self.parent.tb_remove(); return false;">Select</a>
 
 
141
  </div>
142
  </div>
143
  <?php
@@ -147,7 +209,7 @@ function SelectMedia(File)
147
  </div>
148
  </div>
149
  <div id="media-footer">
150
- <div class="media-upload-link"><a href="<?php echo admin_url(); ?>?action=powerpress-jquery-upload&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=true" class="thickbox" title="Upload Media File">Upload Media File</a></div>
151
  <?php
152
  if( $QuotaData ) {
153
  $NextDate = strtotime( $QuotaData['published']['next_date']);
@@ -156,14 +218,23 @@ function SelectMedia(File)
156
  <p>You are hosting <em><?php echo powerpress_byte_size($QuotaData['published']['available']); ?></em> of your <em><?php echo powerpress_byte_size($QuotaData['published']['total']); ?></em>/month limit.</p>
157
  <p>Your limit will adjust on <?php echo date('m/d/Y', $NextDate); ?> to <em><?php echo powerpress_byte_size($QuotaData['published']['next_available']); ?></em>.</p>
158
  <?php } ?>
 
159
  </div>
160
- <!-- </ul> -->
161
 
162
  <?php
163
- powerpress_admin_jquery_footer();
164
  exit;
165
  }; break;
166
  case 'powerpress-jquery-account-save': {
 
 
 
 
 
 
 
 
 
167
 
168
  check_admin_referer('powerpress-jquery-account');
169
 
@@ -174,13 +245,7 @@ function SelectMedia(File)
174
 
175
  $Save = false;
176
  $Close = false;
177
-
178
- /*
179
- $Settings['blubrry_hosting'] = 0;
180
- if( $_POST['Services'] == 'stats_hosting')
181
- $Settings['blubrry_hosting'] = 1;
182
- */
183
-
184
 
185
  if( $_POST['Remove'] )
186
  {
@@ -250,6 +315,7 @@ function SelectMedia(File)
250
  $Error = 'Please select your podcast program to continue.';
251
  $Step = 2;
252
  $Settings['blubrry_username'] = $SaveSettings['blubrry_username'];
 
253
  }
254
  }
255
  else
@@ -288,6 +354,17 @@ function SelectMedia(File)
288
  } // no break here, let the next case catch it...
289
  case 'powerpress-jquery-account':
290
  {
 
 
 
 
 
 
 
 
 
 
 
291
  if( !$Settings )
292
  $Settings = get_option('powerpress_general');
293
 
@@ -351,6 +428,17 @@ while( list($value,$desc) = each($Programs) )
351
  }; break;
352
  case 'powerpress-jquery-upload': {
353
 
 
 
 
 
 
 
 
 
 
 
 
354
  $RedirectURL = false;
355
  $Error = false;
356
  if( $Settings['blubrry_hosting'] == 0 )
@@ -362,15 +450,21 @@ while( list($value,$desc) = each($Programs) )
362
  {
363
  $api_url = sprintf('%s/media/%s/upload_session.json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
364
  $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
 
365
  $results = powerpress_json_decode($json_data);
 
366
  // We need to obtain an upload session for this user...
367
- if( isset($results['error']) )
368
  {
369
  $Error = $results['error'];
370
  if( strstr($Error, 'currently not available') )
371
  $Error = 'Unable to find podcasts for this account.';
372
  }
373
- else if( !is_array($results) )
 
 
 
 
374
  {
375
  $Error = $json_data;
376
  }
@@ -385,7 +479,6 @@ while( list($value,$desc) = each($Programs) )
385
  {
386
  header("Location: $RedirectURL");
387
  exit;
388
- $Error = '<a href="'.$RedirectURL.'&amp;nocookie=true&amp;ReturnURL='. urlencode( admin_url() . '?action=powerpress-jquery-upload-complete') .'">Session initialized, click here to upload.</a>';
389
  }
390
  else if( $Error == false )
391
  {
@@ -393,26 +486,44 @@ while( list($value,$desc) = each($Programs) )
393
  }
394
 
395
  powerpress_admin_jquery_header('Uploader');
396
- echo '<h2>Coming Soon</h2>';
397
  echo '<p>';
398
  echo $Error;
399
  echo '</p>';
400
- echo '<p><a href="#" onclick="self.parent.tb_remove();">close</a></p>';
 
 
401
  powerpress_admin_jquery_footer();
402
  exit;
403
  }; break;
404
  case 'powerpress-jquery-upload-complete': {
 
 
 
 
 
 
 
 
 
 
405
  $File = $_GET['File'];
406
  $Message = $_GET['Message'];
407
 
408
  powerpress_admin_jquery_header('Upload Complete');
409
- echo '<h2>Coming Soon</h2>';
410
- echo '<p>File: ';
411
- echo $File;
412
- echo ' - ';
 
 
 
 
413
  echo $Message;
414
  echo '</p>';
415
- echo '<p><a href="#" onclick="self.parent.tb_remove();">close</a></p>';
 
 
416
 
417
  if( $Message == '' )
418
  {
@@ -431,9 +542,10 @@ self.parent.tb_remove();
431
 
432
  }
433
 
434
- function powerpress_admin_jquery_header($title, $other = false)
435
  {
436
- add_thickbox(); // we use the thckbox for some settings
 
437
  ?>
438
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
439
  <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
@@ -445,7 +557,8 @@ function powerpress_admin_jquery_header($title, $other = false)
445
 
446
  wp_admin_css( 'css/global' );
447
  wp_admin_css();
448
- wp_enqueue_script('utils');
 
449
 
450
  do_action('admin_print_styles');
451
  do_action('admin_print_scripts');
@@ -463,9 +576,10 @@ echo '<!-- done adding extra stuff -->';
463
  }
464
 
465
 
466
- function powerpress_admin_jquery_footer()
467
  {
468
- do_action('admin_print_footer_scripts');
 
469
 
470
  ?>
471
  </div><!-- end container -->
@@ -473,7 +587,6 @@ function powerpress_admin_jquery_footer()
473
  </html>
474
  <?php
475
  }
476
-
477
 
478
 
479
  ?>
45
  $action = (isset($_GET['action'])?$_GET['action']: (isset($_POST['action'])?$_POST['action']:false) );
46
  if( !$action )
47
  return;
48
+
49
+ $DeleteFile = false;
50
  switch($action)
51
  {
52
  case 'powerpress-jquery-stats': {
53
 
54
  // Make sure users have permission to access this
55
  if( @$Settings['use_caps'] && !current_user_can('view_podcast_stats') )
56
+ {
57
+ powerpress_admin_jquery_header( __('Blubrry Media Statistics') );
58
+ ?>
59
+ <h2><?php echo __('Blubrry Media Statistics'); ?></h2>
60
+ <p><?php echo __('You do not have sufficient permission to manage options.'); ?></p>
61
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
62
+ <?php
63
+ powerpress_admin_jquery_footer();
64
+ exit;
65
+ }
66
+ else if( !current_user_can('edit_posts') )
67
+ {
68
+ powerpress_admin_jquery_header('Blubrry Media Statistics');
69
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to view media statistics.') );
70
+ powerpress_page_message_print();
71
+ powerpress_admin_jquery_footer();
72
+ exit;
73
+ }
74
 
75
  $StatsCached = get_option('powerpress_stats');
76
 
77
+ powerpress_admin_jquery_header( __('Blubrry Media Statistics') );
78
  ?>
79
+ <h2><?php echo __('Blubrry Media Statistics'); ?></h2>
80
  <?php
81
  echo $StatsCached['content'];
82
  powerpress_admin_jquery_footer();
83
  exit;
84
  }; break;
85
+ case 'powerpress-jquery-media-delete': {
86
+
87
+ if( !current_user_can('edit_posts') )
88
+ {
89
+ powerpress_admin_jquery_header('Uploader');
90
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.') );
91
+ powerpress_page_message_print();
92
+ powerpress_admin_jquery_footer();
93
+ exit;
94
+ }
95
+
96
+ check_admin_referer('powerpress-jquery-media-delete');
97
+ $DeleteFile = $_GET['delete'];
98
+
99
+ }; // No break here, let this fall thru..
100
  case 'powerpress-jquery-media': {
101
 
102
+ if( !current_user_can('edit_posts') )
103
+ {
104
+ powerpress_admin_jquery_header( __('Select Media') );
105
+ ?>
106
+ <h2><?php echo __('Select Media'); ?></h2>
107
+ <p><?php echo __('You do not have sufficient permission to manage options.'); ?></p>
108
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
109
+ <?php
110
+ powerpress_admin_jquery_footer();
111
+ exit;
112
+ }
113
+
114
+ if( !isset($Settings['blubrry_auth']) || $Settings['blubrry_auth'] == '' || !isset($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] == 0 )
115
  {
116
+ powerpress_admin_jquery_header( __('Select Media') );
117
  ?>
118
+ <h2><?php echo __('Select Media'); ?></h2>
119
+ <p><?php echo __('Wait a sec! This feature is only available to Blubrry Podcast paid hosting members.');
120
+ if( !isset($Settings['blubrry_auth']) || $Settings['blubrry_auth'] == '' )
121
+ echo ' '. __('Join our community to get free podcast statistics and access to other valuable').' <a href="http://www.blubrry.com/powerpress_services/" target="_blank">'. __('services') . '</a>.';
122
+ ?>
123
+ </p>
124
  <p>Our <a href="http://www.blubrry.com/powerpress_services/" target="_blank">podcast-hosting integrated</a> PowerPress makes podcast publishing simple. Check out the <a href="http://www.blubrry.com/powerpress_services/" target="_blank">video</a> on our exciting three-step publishing system!</p>
125
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
126
  <?php
127
  powerpress_admin_jquery_footer();
128
  exit;
129
+ }
130
+
131
+ $Msg = false;
132
+ if( $DeleteFile )
133
+ {
134
+ $api_url = sprintf('%s/media/%s/%s?format=json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'], $DeleteFile );
135
+ $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth'], array(), 10, 'DELETE');
136
+ $results = powerpress_json_decode($json_data);
137
+
138
+ if( isset($results['text']) )
139
+ $Msg = $results['text'];
140
+ else if( isset($results['error']) )
141
+ $Msg = $results['error'];
142
+ else
143
+ $Msg = __('An unknown error occurred deleting media file.');
144
  }
145
 
146
  $api_url = sprintf('%s/media/%s/index.json?quota=true', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
147
  $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
148
  $results = powerpress_json_decode($json_data);
 
149
 
150
  $FeedSlug = $_GET['podcast-feed'];
151
+ powerpress_admin_jquery_header( __('Select Media'), true );
152
  ?>
153
  <script language="JavaScript" type="text/javascript">
154
 
159
  self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly='true';
160
  self.parent.tb_remove();
161
  }
162
+ function DeleteMedia(File)
163
+ {
164
+ return confirm('Delete '+File+', are you sure?');
165
+ }
166
  </script>
167
  <p style="text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding:0;"><a href="#" onclick="self.parent.tb_remove();" title="Cancel"><img src="<?php echo admin_url(); ?>/images/no.png" /></a></p>
168
  <div id="media-header">
169
+ <h2><?php echo __('Select Media'); ?></h2>
170
+ <?php
171
+ if( $Msg )
172
+ echo '<p>'. $Msg . '</p>';
173
+ ?>
174
+ <div class="media-upload-link"><a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=true" class="thickbox" title="Upload Media File">Upload Media File</a></div>
175
  <p>Select from media files uploaded to blubrry.com:</p>
176
  </div>
 
177
  <div id="media-items-container">
178
  <div id="media-items">
179
  <?php
191
  $QuotaData = $data;
192
  continue;
193
  }
194
+
 
 
 
 
 
 
 
 
 
 
195
  ?>
196
  <div class="media-item">
197
  <strong class="media-name"><?php echo $data['name']; ?></strong>
198
  <cite><?php echo powerpress_byte_size($data['length']); ?></cite>
 
199
  <div class="media-item-links">
200
+ <?php if (function_exists('curl_init')) { ?>
201
+ <a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-media-delete", 'powerpress-jquery-media-delete'); ?>&amp;podcast-feed=<?php echo $FeedSlug; ?>&amp;delete=<?php echo urlencode($data['name']); ?>" onclick="return DeleteMedia('<?php echo $data['name']; ?>');">Delete</a> | <?php } ?>
202
+ <a href="#" onclick="SelectMedia('<?php echo $data['name']; ?>'); return false;">Select</a>
203
  </div>
204
  </div>
205
  <?php
209
  </div>
210
  </div>
211
  <div id="media-footer">
212
+ <div class="media-upload-link"><a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=true" class="thickbox" title="Upload Media File">Upload Media File</a></div>
213
  <?php
214
  if( $QuotaData ) {
215
  $NextDate = strtotime( $QuotaData['published']['next_date']);
218
  <p>You are hosting <em><?php echo powerpress_byte_size($QuotaData['published']['available']); ?></em> of your <em><?php echo powerpress_byte_size($QuotaData['published']['total']); ?></em>/month limit.</p>
219
  <p>Your limit will adjust on <?php echo date('m/d/Y', $NextDate); ?> to <em><?php echo powerpress_byte_size($QuotaData['published']['next_available']); ?></em>.</p>
220
  <?php } ?>
221
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
222
  </div>
 
223
 
224
  <?php
225
+ powerpress_admin_jquery_footer(true);
226
  exit;
227
  }; break;
228
  case 'powerpress-jquery-account-save': {
229
+
230
+ if( !current_user_can('manage_options') )
231
+ {
232
+ powerpress_admin_jquery_header('Blubrry Services Integration');
233
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.') );
234
+ powerpress_page_message_print();
235
+ powerpress_admin_jquery_footer();
236
+ exit;
237
+ }
238
 
239
  check_admin_referer('powerpress-jquery-account');
240
 
245
 
246
  $Save = false;
247
  $Close = false;
248
+
 
 
 
 
 
 
249
 
250
  if( $_POST['Remove'] )
251
  {
315
  $Error = 'Please select your podcast program to continue.';
316
  $Step = 2;
317
  $Settings['blubrry_username'] = $SaveSettings['blubrry_username'];
318
+ $Settings['blubrry_hosting'] = $SaveSettings['blubrry_hosting'];
319
  }
320
  }
321
  else
354
  } // no break here, let the next case catch it...
355
  case 'powerpress-jquery-account':
356
  {
357
+ if( !current_user_can('manage_options') )
358
+ {
359
+ powerpress_admin_jquery_header('Blubrry Services Integration');
360
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.') );
361
+ powerpress_page_message_print();
362
+ powerpress_admin_jquery_footer();
363
+ exit;
364
+ }
365
+
366
+ check_admin_referer('powerpress-jquery-account');
367
+
368
  if( !$Settings )
369
  $Settings = get_option('powerpress_general');
370
 
428
  }; break;
429
  case 'powerpress-jquery-upload': {
430
 
431
+ if( !current_user_can('edit_posts') )
432
+ {
433
+ powerpress_admin_jquery_header('Uploader');
434
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.') );
435
+ powerpress_page_message_print();
436
+ powerpress_admin_jquery_footer();
437
+ exit;
438
+ }
439
+
440
+ check_admin_referer('powerpress-jquery-upload');
441
+
442
  $RedirectURL = false;
443
  $Error = false;
444
  if( $Settings['blubrry_hosting'] == 0 )
450
  {
451
  $api_url = sprintf('%s/media/%s/upload_session.json', rtrim(POWERPRESS_BLUBRRY_API_URL, '/'), $Settings['blubrry_program_keyword'] );
452
  $json_data = powerpress_remote_fopen($api_url, $Settings['blubrry_auth']);
453
+
454
  $results = powerpress_json_decode($json_data);
455
+
456
  // We need to obtain an upload session for this user...
457
+ if( isset($results['error']) && strlen($results['error']) > 1 )
458
  {
459
  $Error = $results['error'];
460
  if( strstr($Error, 'currently not available') )
461
  $Error = 'Unable to find podcasts for this account.';
462
  }
463
+ else if( $results === $json_data )
464
+ {
465
+ $Error = $json_data;
466
+ }
467
+ else if( !is_array($results) || $results == false )
468
  {
469
  $Error = $json_data;
470
  }
479
  {
480
  header("Location: $RedirectURL");
481
  exit;
 
482
  }
483
  else if( $Error == false )
484
  {
486
  }
487
 
488
  powerpress_admin_jquery_header('Uploader');
489
+ echo '<h2>'. __('Uploader') .'</h2>';
490
  echo '<p>';
491
  echo $Error;
492
  echo '</p>';
493
+ ?>
494
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
495
+ <?php
496
  powerpress_admin_jquery_footer();
497
  exit;
498
  }; break;
499
  case 'powerpress-jquery-upload-complete': {
500
+
501
+ if( !current_user_can('edit_posts') )
502
+ {
503
+ powerpress_admin_jquery_header('Uploader');
504
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.') );
505
+ powerpress_page_message_print();
506
+ powerpress_admin_jquery_footer();
507
+ exit;
508
+ }
509
+
510
  $File = $_GET['File'];
511
  $Message = $_GET['Message'];
512
 
513
  powerpress_admin_jquery_header('Upload Complete');
514
+ echo '<h2>'. __('Uploader') .'</h2>';
515
+ echo '<p>';
516
+ if( $File )
517
+ {
518
+ echo 'File: ';
519
+ echo $File;
520
+ echo ' - ';
521
+ }
522
  echo $Message;
523
  echo '</p>';
524
+ ?>
525
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Close'); ?>"><?php echo __('Close'); ?></a></p>
526
+ <?php
527
 
528
  if( $Message == '' )
529
  {
542
 
543
  }
544
 
545
+ function powerpress_admin_jquery_header($title, $jquery = false)
546
  {
547
+ if( $jquery )
548
+ add_thickbox(); // we use the thckbox for some settings
549
  ?>
550
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
551
  <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
557
 
558
  wp_admin_css( 'css/global' );
559
  wp_admin_css();
560
+ if( $jquery )
561
+ wp_enqueue_script('utils');
562
 
563
  do_action('admin_print_styles');
564
  do_action('admin_print_scripts');
576
  }
577
 
578
 
579
+ function powerpress_admin_jquery_footer($jquery = false)
580
  {
581
+ if( $jquery )
582
+ do_action('admin_print_footer_scripts');
583
 
584
  ?>
585
  </div><!-- end container -->
587
  </html>
588
  <?php
589
  }
 
590
 
591
 
592
  ?>
powerpressadmin-mt.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
2
  // powerpressadmin-mt.php
3
 
 
 
 
4
  function powerpress_get_mt_episodes()
5
  {
6
  global $wpdb;
1
  <?php
2
  // powerpressadmin-mt.php
3
 
4
+ if( !function_exists('add_action') )
5
+ die("access denied.");
6
+
7
  function powerpress_get_mt_episodes()
8
  {
9
  global $wpdb;
powerpressadmin-podpress.php CHANGED
@@ -1,7 +1,10 @@
1
  <?php
2
  // powerpressadmin-podpress.php
 
 
 
3
 
4
- function powerpress_get_podpress_episodes()
5
  {
6
  global $wpdb;
7
 
@@ -33,12 +36,32 @@
33
  $podpress_data = unserialize($row['meta_value']);
34
  if( !$podpress_data )
35
  {
36
- $podpress_data_serialized = powerpress_repair_serialize($row['meta_value']);
37
  $podpress_data = @unserialize($podpress_data_serialized);
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
39
 
40
  if( $podpress_data )
41
  {
 
 
 
 
 
 
 
 
42
  $clean_data = array();
43
  while( list($episode_index,$episode_data) = each($podpress_data) )
44
  {
@@ -63,7 +86,9 @@
63
 
64
 
65
  if( $return['feeds_required'] < count( $clean_data ) )
 
66
  $return['feeds_required'] = count( $clean_data );
 
67
  $return[ $row['ID'] ] = array();
68
  $return[ $row['ID'] ]['podpress_data'] = $clean_data;
69
  $return[ $row['ID'] ]['post_title'] = $row['post_title'];
@@ -79,11 +104,15 @@
79
 
80
  while( list($episode_index_temp,$episode_data_temp) = each($clean_data) )
81
  {
82
- if( $EnclosureURL == $episode_data_temp['url'] )
83
  {
84
  $Included = true;
85
  break; // We found the media already.
86
  }
 
 
 
 
87
  }
88
  reset($clean_data);
89
 
@@ -142,7 +171,7 @@
142
  function powerpressadmin_podpress_do_import()
143
  {
144
  $Import = $_POST['Import'];
145
- $PodPressData = powerpress_get_podpress_episodes();
146
 
147
  while( list($post_id, $podpress_episode_feeds) = each($Import) )
148
  {
@@ -226,7 +255,7 @@
226
 
227
  function powerpress_admin_podpress()
228
  {
229
- $results = powerpress_get_podpress_episodes();
230
  $Settings = powerpress_get_settings('powerpress_general', false);
231
  if( !isset($Settings['custom_feeds']['podcast']) )
232
  $Settings['custom_feeds']['podcast'] = 'Podcast Feed (default)';
@@ -239,7 +268,6 @@
239
  if( $results['feeds_required'] > count($Settings['custom_feeds']) )
240
  {
241
  powerpress_page_message_add_error( sprintf(__('We found blog posts that have %d media files. You will need to create %d more Custom Feed%s in order to continue.'), $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds']), (( ( $results['feeds_required'] - count($Settings['custom_feeds']) ) > 1 )?'s':'') ) );
242
- powerpress_page_message_print();
243
  }
244
  else
245
  {
@@ -247,6 +275,8 @@
247
  }
248
  }
249
 
 
 
250
  powerpressadmin_podpress_import_print_log();
251
 
252
  ?>
1
  <?php
2
  // powerpressadmin-podpress.php
3
+
4
+ if( !function_exists('add_action') )
5
+ die("access denied.");
6
 
7
+ function powerpress_get_podpress_episodes($hide_errors=true)
8
  {
9
  global $wpdb;
10
 
36
  $podpress_data = unserialize($row['meta_value']);
37
  if( !$podpress_data )
38
  {
39
+ $podpress_data_serialized = powerpress_repair_serialize( $row['meta_value'] );
40
  $podpress_data = @unserialize($podpress_data_serialized);
41
+ if( !is_array($podpress_data) && is_string($podpress_data) )
42
+ {
43
+ $podpress_data_two = @unserialize($podpress_data);
44
+ if( !is_array($podpress_data_two) )
45
+ {
46
+ $podpress_data_serialized = powerpress_repair_serialize($podpress_data);
47
+ $podpress_data_two = @unserialize($podPressMedia);
48
+ }
49
+
50
+ if( is_array($podpress_data_two) )
51
+ $podpress_data = $podpress_data_two;
52
+ }
53
  }
54
 
55
  if( $podpress_data )
56
  {
57
+ if( !is_array($podpress_data) )
58
+ {
59
+ // display a warning here...
60
+ if( $hide_errors == false )
61
+ powerpress_page_message_add_error( sprintf('Error decoding PodPress data for post "%s"', $row['post_title']) );
62
+ continue;
63
+ }
64
+
65
  $clean_data = array();
66
  while( list($episode_index,$episode_data) = each($podpress_data) )
67
  {
86
 
87
 
88
  if( $return['feeds_required'] < count( $clean_data ) )
89
+ {
90
  $return['feeds_required'] = count( $clean_data );
91
+ }
92
  $return[ $row['ID'] ] = array();
93
  $return[ $row['ID'] ]['podpress_data'] = $clean_data;
94
  $return[ $row['ID'] ]['post_title'] = $row['post_title'];
104
 
105
  while( list($episode_index_temp,$episode_data_temp) = each($clean_data) )
106
  {
107
+ if( trim($EnclosureURL) == trim($episode_data_temp['url']) )
108
  {
109
  $Included = true;
110
  break; // We found the media already.
111
  }
112
+ else if( trim($episode_data_temp['url']) == '' )
113
+ {
114
+ unset($clean_data[$episode_index_temp]); // Empty URL, lets remove it so we don't accidently use it
115
+ }
116
  }
117
  reset($clean_data);
118
 
171
  function powerpressadmin_podpress_do_import()
172
  {
173
  $Import = $_POST['Import'];
174
+ $PodPressData = powerpress_get_podpress_episodes(true);
175
 
176
  while( list($post_id, $podpress_episode_feeds) = each($Import) )
177
  {
255
 
256
  function powerpress_admin_podpress()
257
  {
258
+ $results = powerpress_get_podpress_episodes(false);
259
  $Settings = powerpress_get_settings('powerpress_general', false);
260
  if( !isset($Settings['custom_feeds']['podcast']) )
261
  $Settings['custom_feeds']['podcast'] = 'Podcast Feed (default)';
268
  if( $results['feeds_required'] > count($Settings['custom_feeds']) )
269
  {
270
  powerpress_page_message_add_error( sprintf(__('We found blog posts that have %d media files. You will need to create %d more Custom Feed%s in order to continue.'), $results['feeds_required'], $results['feeds_required'] - count($Settings['custom_feeds']), (( ( $results['feeds_required'] - count($Settings['custom_feeds']) ) > 1 )?'s':'') ) );
 
271
  }
272
  else
273
  {
275
  }
276
  }
277
 
278
+ powerpress_page_message_print();
279
+
280
  powerpressadmin_podpress_import_print_log();
281
 
282
  ?>
powerpressadmin.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  function powerpress_page_message_add_error($msg)
4
  {
5
  global $g_powerpress_page_message;
@@ -1103,7 +1106,7 @@ function powerpress_check_url(url)
1103
  else
1104
  {
1105
  // Print this line for debugging when loooking for other pages to include header data for
1106
- echo "<!-- WP Page Name: $page_name; Hook Suffix: $hook_suffix -->\n";
1107
  }
1108
  }
1109
 
@@ -1410,7 +1413,7 @@ function powerpress_ping_itunes_log($Data, $post_id = 0)
1410
  }
1411
  }
1412
 
1413
- function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array(), $timeout = 10 )
1414
  {
1415
  if( function_exists( 'curl_init' ) ) // Preferred method of connecting
1416
  {
@@ -1424,6 +1427,7 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
1424
  curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
1425
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
1426
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
 
1427
  if( strtolower(substr($url, 0, 5)) == 'https' )
1428
  {
1429
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
@@ -1449,6 +1453,10 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
1449
  curl_setopt($curl, CURLOPT_POST, 1);
1450
  curl_setopt($curl, CURLOPT_POSTFIELDS, $post_query);
1451
  }
 
 
 
 
1452
 
1453
  $content = curl_exec($curl);
1454
  $error = curl_errno($curl);
1
  <?php
2
 
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
+
6
  function powerpress_page_message_add_error($msg)
7
  {
8
  global $g_powerpress_page_message;
1106
  else
1107
  {
1108
  // Print this line for debugging when loooking for other pages to include header data for
1109
+ //echo "<!-- WP Page Name: $page_name; Hook Suffix: $hook_suffix -->\n";
1110
  }
1111
  }
1112
 
1413
  }
1414
  }
1415
 
1416
+ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array(), $timeout = 10, $custom_request = false )
1417
  {
1418
  if( function_exists( 'curl_init' ) ) // Preferred method of connecting
1419
  {
1427
  curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2 ); // Connect time out
1428
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
1429
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
1430
+ curl_setopt($curl, CURLOPT_FAILONERROR, true);
1431
  if( strtolower(substr($url, 0, 5)) == 'https' )
1432
  {
1433
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
1453
  curl_setopt($curl, CURLOPT_POST, 1);
1454
  curl_setopt($curl, CURLOPT_POSTFIELDS, $post_query);
1455
  }
1456
+ else if( $custom_request )
1457
+ {
1458
+ curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $custom_request);
1459
+ }
1460
 
1461
  $content = curl_exec($curl);
1462
  $error = curl_errno($curl);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Angelo Mandato, Blubrry.com
3
  Tags: podcast, podcasting, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry
4
  Requires at least: 2.6.0
5
  Tested up to: 2.8.4
6
- Stable tag: 0.9.7
7
 
8
  Add podcasting support to your blog.
9
 
@@ -85,12 +85,27 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  = 0.9.7 =
89
  * Released on 8/31/2009
90
  * Fixed array_unshift() for users in simple mode, bug created in 0.9.6 release.
91
  * Fixed link to change from simple/advanced modes, bug created in 0.9.6 release.
92
  * Fixed bug with changing Blubrry Services account email address.
93
 
 
94
  = 0.9.6 =
95
  * Released on 8/31/2009
96
  * Added Auto Add Media option, auto adds first/last media link found in post content. (default is off)
@@ -105,7 +120,7 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
105
  * Display error message when PowerPress cannot detect media file size and duration information.
106
  * Display error message when PowerPress encounters an error with Blubrry Services.
107
  * Stream lined code for loading PowerPress general and feed settings.
108
- * Added more agressive code to prevent WordPress from deleting enclosures when scheduling blog posts.
109
  * Improved the look of the AJAX windows for selecting media/configuring services.
110
  * Fixed bug where 'more' link for statistics would fail if user was not a blog admin.
111
  * Added code to admin_head() function so css/js only included on appropriate pages (Thanks @Frumph!).
3
  Tags: podcast, podcasting, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry
4
  Requires at least: 2.6.0
5
  Tested up to: 2.8.4
6
+ Stable tag: 0.9.8
7
 
8
  Add podcasting support to your blog.
9
 
85
 
86
  == Changelog ==
87
 
88
+ = 0.9.8 =
89
+ * Released on 9/02/2009
90
+ * When we release 1.0 of PowerPress, new features will be added separately so bugs introduced by new features do not effect the existing plugin.
91
+ * Fixed bug introduced in 0.9.6, caused by the array_unshift() function. Its behavior was not consistent and has been removed. Bug caused a chain reaction of bugs, its fix resolves the following: Play in new Window error: Unable to retrieve media information, Episodes randomly not appearing in post pages, Previous PodPress created episodes no longer appearing.
92
+ * Fixed bug with publishing a new post with media file warning messages for curl_setopt() function
93
+ * Fixed bug for PodPress data that is wrongly serialized in database. WP 2.8+ get_meta_data() function was returning false rather than the damaged serialized string.
94
+ * PodPress Import improved, some cases PodPress data in the database is double serialized, new code resolves this complexity with help with bug fix above.
95
+ * Select Media screen, better message printed to user when they are not a media hosting customer.
96
+ * Fixed bug with RSS language tag for Custom Podcast Category feeds.
97
+ * Cleaned up code for jQuery/Thickbox screens.
98
+ * Added extra security checks and additional Nonces checks to ajax methods added by PowerPress.
99
+ * Added option for Blubrry Services users to be able to delete uploaded media
100
+
101
+
102
  = 0.9.7 =
103
  * Released on 8/31/2009
104
  * Fixed array_unshift() for users in simple mode, bug created in 0.9.6 release.
105
  * Fixed link to change from simple/advanced modes, bug created in 0.9.6 release.
106
  * Fixed bug with changing Blubrry Services account email address.
107
 
108
+
109
  = 0.9.6 =
110
  * Released on 8/31/2009
111
  * Added Auto Add Media option, auto adds first/last media link found in post content. (default is off)
120
  * Display error message when PowerPress cannot detect media file size and duration information.
121
  * Display error message when PowerPress encounters an error with Blubrry Services.
122
  * Stream lined code for loading PowerPress general and feed settings.
123
+ * Added more aggressive code to prevent WordPress from deleting enclosures when scheduling blog posts.
124
  * Improved the look of the AJAX windows for selecting media/configuring services.
125
  * Fixed bug where 'more' link for statistics would fail if user was not a blog admin.
126
  * Added code to admin_head() function so css/js only included on appropriate pages (Thanks @Frumph!).