function post_edit($post_id) { global $post, $pagenow; if ($this->justposted) { return; } $blog_charset = get_bloginfo('charset'); // this condition make sure that the podpress settings of a post or page will be saved only via this admin pages and not "quick edit" if ("post.php" === $pagenow or "page.php" === $pagenow or "post-new.php" === $pagenow or "page-new.php" === $pagenow) { // patch for compat with post revisions (WP 2.6+) if (isset($_POST['post_ID']) && (int) $_POST['post_ID']) { $post_id = (int) $_POST['post_ID']; } $this->justposted = true; if ($this->checkWritableTempFileDir()) { if (!empty($this->tempfilesystempath)) { $dh = opendir($this->tempfilesystempath); while (false !== ($filename = readdir($dh))) { if (substr($filename, 0, 10) == 'feedcache_' && is_file($this->tempfilesystempath . '/' . $filename)) { unlink($this->tempfilesystempath . '/' . $filename); } } } } if (isset($_POST['podPressMedia'])) { $i = 0; foreach ($_POST['podPressMedia'] as $mediafiledata) { if (!empty($mediafiledata['URI'])) { foreach ($mediafiledata as $key => $value) { switch ($key) { case 'URI': if (isset($mediafiledata['podPressMedia_' . $i . '_cleanURI']) and 'yes' === $mediafiledata['podPressMedia_' . $i . '_cleanURI']) { $verifiedMedia[$i][$key] = clean_url($value, array('http', 'https'), 'db'); } else { $verifiedMedia[$i][$key] = trim($value); } break; case 'title': $verifiedMedia[$i][$key] = htmlspecialchars(strip_tags(trim($value)), ENT_QUOTES, $blog_charset); break; case 'size': case 'dimensionW': case 'dimensionH': $value = strip_tags(trim($value)); $verifiedMedia[$i][$key] = intval(preg_replace('/[^0-9]/', '', $value)); break; case 'duration': $value = strip_tags(trim($value)); $result = preg_match('/(^([0-9]{1,3})(:([0-5][0-9])){0,1}(:([0-5][0-9])$))/', $value, $b); if (!empty($b) and 0 < $result) { $verifiedMedia[$i][$key] = $value; } else { $verifiedMedia[$i][$key] = ''; } break; default: $verifiedMedia[$i][$key] = $value; break; } } } $i++; } delete_post_meta($post_id, '_podPressMedia'); if (!empty($verifiedMedia)) { if ($this->settings['enablePodangoIntegration']) { foreach ($verifiedMedia as $key => $val) { if (substr($val['URI'], 0, strlen('Podango:')) == 'Podango:') { $fileNameParts = explode(':', $val['URI']); $podPressPostSpecific['PodangoPodcastID'] = $fileNameParts[1]; $podPressPostSpecific['PodangoMediaFileID'] = $fileNameParts[2]; $podPressPostSpecific['PodangoEpisodeID'] = $fileNameParts[3]; if (empty($podPressPostSpecific['PodangoMediaFileID'])) { // need to add the mediafileID lookup } if (empty($podPressPostSpecific['PodangoEpisodeID'])) { if ($this->settings['podangoDefaultPodcast'] == '##ALL##') { $podangoPodcastID = (int) $_POST['podPressPodangoPodcastID']; } else { $podangoPodcastID = $this->settings['podangoDefaultPodcast']; } $podPressPostSpecific['PodangoEpisodeID'] = $this->podangoapi->CreateEpisode($podangoPodcastID, $_POST['post_title'], $_POST['content'], '', $podPressPostSpecific['PodangoMediaFileID']); } else { $this->podangoapi->UpdateEpisode($podPressPostSpecific['PodangoEpisodeID'], $_POST['post_title'], $_POST['content'], '', $podPressPostSpecific['PodangoMediaFileID']); } $val['URI'] = $this->podangoapi->mediaTrackerURL . '555/' . $podPressPostSpecific['PodangoEpisodeID'] . '/' . $fileNameParts[4]; $verifiedMedia[$key] = $val; unset($fileNameParts); } } } podPress_add_post_meta($post_id, '_podPressMedia', $verifiedMedia, true); } } if (isset($_POST['iTunesSubtitleChoice']) and $_POST['iTunesSummaryChoice'] and $_POST['iTunesKeywordsChoice'] and $_POST['iTunesAuthorChoice'] and $_POST['iTunesExplicit'] and $_POST['iTunesBlock']) { if ($_POST['iTunesSubtitleChoice'] == 'Custom' && !empty($_POST['iTunesSubtitle'])) { $podPressPostSpecific['itunes:subtitle'] = htmlspecialchars(strip_tags(trim($_POST['iTunesSubtitle'])), ENT_QUOTES, $blog_charset); } else { $podPressPostSpecific['itunes:subtitle'] = '##PostExcerpt##'; } if ($_POST['iTunesSummaryChoice'] == 'Custom' && !empty($_POST['iTunesSummary'])) { $podPressPostSpecific['itunes:summary'] = htmlspecialchars(strip_tags(trim($_POST['iTunesSummary'])), ENT_QUOTES, $blog_charset); } elseif ($_POST['iTunesSummaryChoice'] == 'Global') { $podPressPostSpecific['itunes:summary'] = '##Global##'; } elseif ($_POST['iTunesSummaryChoice'] == 'PostContentShortened') { $podPressPostSpecific['itunes:summary'] = '##PostContentShortened##'; } else { $podPressPostSpecific['itunes:summary'] = '##PostExcerpt##'; } if ($_POST['iTunesKeywordsChoice'] == 'Custom' && !empty($_POST['iTunesKeywords'])) { $podPressPostSpecific['itunes:keywords'] = $this->cleanup_itunes_keywords($_POST['iTunesKeywords']); } elseif ($_POST['iTunesKeywordsChoice'] == 'Global') { $podPressPostSpecific['itunes:keywords'] = '##Global##'; } elseif ($_POST['iTunesKeywordsChoice'] == 'post_tags') { $podPressPostSpecific['itunes:keywords'] = '##post_tags##'; } else { $podPressPostSpecific['itunes:keywords'] = '##WordPressCats##'; } if ($_POST['iTunesAuthorChoice'] == 'Custom' && !empty($_POST['iTunesAuthor'])) { $podPressPostSpecific['itunes:author'] = htmlspecialchars(strip_tags(trim($_POST['iTunesAuthor'])), ENT_QUOTES, $blog_charset); } else { $podPressPostSpecific['itunes:author'] = '##Global##'; } if ($_POST['iTunesExplicit']) { $podPressPostSpecific['itunes:explicit'] = $_POST['iTunesExplicit']; } else { $podPressPostSpecific['itunes:explicit'] = 'No'; } if ($_POST['iTunesBlock']) { $podPressPostSpecific['itunes:block'] = $_POST['iTunesBlock']; } else { $podPressPostSpecific['itunes:block'] = 'No'; } delete_post_meta($post_id, '_podPressPostSpecific'); podPress_add_post_meta($post_id, '_podPressPostSpecific', $podPressPostSpecific, true); } if (FALSE === is_object($post) or TRUE === empty($post)) { $post = new stdClass(); } $post->podPressPostSpecific = $podPressPostSpecific; /* if(class_exists(snoopy)) { if(!empty($this->settings['iTunes']['FeedID'])) { $client = new Snoopy(); $client->_fp_timeout = 10; $x = $client->fetch('https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?id='.$this->settings['iTunes']['FeedID']); } elseif(!empty($this->settings['iTunes']['feedURL'])) { $client = new Snoopy(); $client->_fp_timeout = 10; $x = $client->fetch('https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?feedURL='.$this->settings['iTunes']['feedURL']); } } */ } else { return; } }
function do_legacy_upgrades($current) { global $wpdb; while (TRUE == version_compare(PODPRESS_VERSION, $current, '>=') and TRUE == version_compare('8.8', $current, '>=')) { settype($current, 'string'); switch ($current) { case '0': $current = PODPRESS_VERSION; break; case '1.4': $posts_that_need_upgrades = array(); $posts = $wpdb->get_results("SELECT ID, post_content FROM " . $wpdb->posts); if ($posts) { foreach ($posts as $post) { if (preg_match($this->podcasttag_regexp, $post->post_content, $matches)) { $podcastTagFileName = $matches[1]; } else { $podcastTagFileName = false; } if ($podcastTagFileName) { $posts_that_need_upgrades[$post->ID] = $post->post_content; } } reset($posts_that_need_upgrades); foreach ($posts_that_need_upgrades as $key => $value) { $wpdb->query("UPDATE " . $wpdb->posts . " SET post_content = '" . preg_replace($this->podcasttag_regexp, '', $value) . "' WHERE ID=" . $key); if (preg_match($this->podcasttag_regexp, $content, $matches)) { $podcastTagFileName = $matches[1]; } else { $podcastTagFileName = false; } delete_post_meta($key, 'podPress_podcastStandardAudio'); add_post_meta($key, 'podPress_podcastStandardAudio', $podcastTagFileName, true); } } break; case '3.8': $this->settings['audioWebPath'] = get_option('podPress_audioWebPath'); $this->settings['audioFilePath'] = get_option('podPress_audioFilePath'); if ($this->settings['audioWebPath'] == '') { add_option('podPress_mediaWebPath', $this->settings['audioWebPath'], "Web path to Podcast media files", true); $this->settings['audioWebPath'] = $this->settings['audioWebPath']; delete_option('podPress_audioWebPath'); } if ($this->settings['audioFilePath'] == '') { add_option('podPress_mediaFilePath', $this->settings['audioFilePath'], "File path to Podcast media files", true); $this->settings['mediaFilePath'] = $this->settings['audioFilePath']; delete_option('podPress_audioFilePath'); } $posts = $wpdb->get_results("SELECT ID FROM " . $wpdb->prefix . "posts"); if ($posts) { foreach ($posts as $post) { $sql = "SELECT meta_key, meta_value\n\t\t\t\t\t\t\t\t FROM " . $wpdb->prefix . "postmeta \n\t\t\t\t\t\t\t\t\tWHERE meta_key IN(\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudio', \n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudioSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudioDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudio',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudioSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudioDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideo',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoDimension',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideo',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoDimension',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEbook',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEbookSize',\n\t\t\t\t\t\t\t\t\t\t'itunes:duration',\n\t\t\t\t\t\t\t\t\t\t'enclosure'\n\t\t\t\t\t\t\t\t\t) AND post_id = " . $post->ID; $metadata = $wpdb->get_results($sql); if ($metadata) { $posts2convert = array(); foreach ($metadata as $stat) { $posts2convert[$post->ID][$stat->meta_key] = $stat->meta_value; } $rssaddedyet = false; $podPressMedia = array(); foreach ($posts2convert as $key => $val) { if (isset($val['enclosure'])) { $encParts = split("\n", $val['enclosure']); $data = $this->upgrade_convert39to40mediaFile(trim(htmlspecialchars($encParts[0])), trim(htmlspecialchars($encParts[1]))); if (!$rssaddedyet) { $rssaddedyet = true; $data['rss'] = 'on'; } $podPressMedia[] = $data; } if (isset($val['podPress_podcastStandardAudio'])) { $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastStandardAudio'], $val['podPress_podcastStandardAudioSize'], $val['podPress_podcastStandardAudioDuration']); if (!$rssaddedyet) { $rssaddedyet = true; $data['rss'] = 'on'; } $podPressMedia[] = $data; } if (isset($val['podPress_podcastEnhancedAudio'])) { $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastEnhancedAudio'], $val['podPress_podcastEnhancedAudioSize'], $val['podPress_podcastEnhancedAudioDuration']); if (!$rssaddedyet) { $rssaddedyet = true; $data['rss'] = 'on'; } $podPressMedia[] = $data; } if (isset($val['podPress_podcastVideo'])) { $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastVideo'], $val['podPress_podcastVideoSize'], $val['podPress_podcastVideoDuration'], $val['podPress_podcastVideoDimension']); if (!$rssaddedyet) { $rssaddedyet = true; $data['rss'] = 'on'; } $podPressMedia[] = $data; } if (isset($val['podPress_webVideo'])) { $data = $this->upgrade_convert39to40mediaFile($val['podPress_webVideo'], $val['podPress_webVideoSize'], $val['podPress_webVideoDuration'], $val['podPress_webVideoDimension']); $podPressMedia[] = $data; } if (isset($val['podPress_podcastEbook'])) { $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastEbook'], $val['podPress_podcastEbookSize']); if (!$rssaddedyet) { $rssaddedyet = true; $data['rss'] = 'on'; } $podPressMedia[] = $data; } } if (is_array($podPressMedia)) { delete_post_meta($post->ID, 'podPressMedia'); podPress_add_post_meta($post->ID, 'podPressMedia', $podPressMedia, true); } } } } $sql = "UPDATE " . $wpdb->prefix . "postmeta SET meta_key='enclosure_hold' WHERE meta_key='enclosure'"; $wpdb->query($sql); break; case '4.2': $playerOptions['bg'] = str_replace('0x', '#', get_option('podPress_player_bgcolor')); delete_option('podPress_player_bgcolor'); $playerOptions['text'] = str_replace('0x', '#', get_option('podPress_player_textcolor')); delete_option('podPress_player_textcolor'); $playerOptions['leftbg'] = str_replace('0x', '#', get_option('podPress_player_leftbgcolor')); delete_option('podPress_player_leftbgcolor'); $playerOptions['lefticon'] = str_replace('0x', '#', get_option('podPress_player_lefticoncolor')); delete_option('podPress_player_lefticoncolor'); $playerOptions['rightbg'] = str_replace('0x', '#', get_option('podPress_player_rightbgcolor')); delete_option('podPress_player_rightbgcolor'); $playerOptions['rightbghover'] = str_replace('0x', '#', get_option('podPress_player_rightbghovercolor')); delete_option('podPress_player_rightbghovercolor'); $playerOptions['righticon'] = str_replace('0x', '#', get_option('podPress_player_righticoncolor')); delete_option('podPress_player_righticoncolor'); $playerOptions['righticonhover'] = str_replace('0x', '#', get_option('podPress_player_righticonhovercolor')); delete_option('podPress_player_righticonhovercolor'); $playerOptions['slider'] = str_replace('0x', '#', get_option('podPress_player_slidercolor')); delete_option('podPress_player_slidercolor'); $playerOptions['track'] = str_replace('0x', '#', get_option('podPress_player_trackcolor')); delete_option('podPress_player_trackcolor'); $playerOptions['loader'] = str_replace('0x', '#', get_option('podPress_player_loadercolor')); delete_option('podPress_player_loadercolor'); $playerOptions['border'] = str_replace('0x', '#', get_option('podPress_player_bordercolor')); delete_option('podPress_player_bordercolor'); podPress_update_option('podPress_playerOptions', $playerOptions); break; case '4.4': if (!is_array($this->settings['iTunes'])) { $this->settings['iTunes'] = array(); } $x = stripslashes(get_option('itunesAdminName')); delete_option('itunesAdminName'); if (!empty($x)) { $this->settings['iTunes']['author'] = $x; } $this->settings['iTunes']['block'] = 'No'; $this->settings['iTunes']['category'] = array(); $cat1 = get_option('itunesCategory1'); $cat2 = get_option('itunesCategory2'); $cat3 = get_option('itunesCategory3'); if (!empty($cat1)) { $this->settings['iTunes']['category'][] = $cat1; } if (!empty($cat2)) { $this->settings['iTunes']['category'][] = $cat2; } if (!empty($cat3)) { $this->settings['iTunes']['category'][] = $cat3; } $x = stripslashes(get_option('itunesImageBig')); delete_option('itunesImageBig'); if (!empty($x)) { $this->settings['iTunes']['image'] = $x; } $x = stripslashes(get_option('itunesDefaultExplicit')); delete_option('itunesDefaultExplicit'); if (!empty($x)) { $this->settings['iTunes']['explicit'] = $x; } $x = stripslashes(get_option('itunesFeedKeywords')); delete_option('itunesFeedKeywords'); if (!empty($x)) { $this->settings['iTunes']['keywords'] = $x; } $x = stripslashes(get_option('podcastdescription')); delete_option('podcastdescription'); if (!empty($x)) { $this->settings['iTunes']['summary'] = $x; } $x = stripslashes(get_option('itunesFeedID')); delete_option('itunesFeedID'); if (!empty($x)) { $this->settings['iTunes']['FeedID'] = $x; } delete_option('itunesUseKeyword'); delete_option('itunesFeedURL'); $x = stripslashes(get_option('itunesImageSmall')); delete_option('itunesImageSmall'); if (!empty($x)) { add_option('rss_image', $x); } $x = stripslashes(get_option('itunesTTL')); delete_option('itunesTTL'); if (!empty($x)) { add_option('rss_ttl', $x); } $x = stripslashes(get_option('downloadLinksInRSS')); delete_option('downloadLinksInRSS'); if (!empty($x)) { add_option('podPress_rss_showlinks', $x); } $x = stripslashes(get_option('channelCat')); delete_option('channelCat'); if (!empty($x)) { add_option('podPress_rss_category', $x); } delete_option('podPress_iTunes'); podPress_add_option('podPress_iTunes', $this->settings['iTunes']); $x = podPress_get_option('podPress_playerOptions'); delete_option('podPress_playerOptions'); if (!empty($x)) { podPress_add_option('podPress_playerSettings', $x); } $x = stripslashes(get_option('podPress_BeforeMore')); delete_option('podPress_BeforeMore'); if (!empty($x)) { add_option('podPress_contentBeforeMore', $x); } $sql = "SELECT media, \n\t\t\t\t\t\t method, \n\t\t\t\t\t\t COUNT(media) as cnt_total, \n\t\t\t\t\t\t COUNT(CASE WHEN method = 'feed' THEN 1 END) as cnt_feed ,\n\t\t\t\t\t\t COUNT(CASE WHEN method = 'web' THEN 1 END) as cnt_web ,\n\t\t\t\t\t\t COUNT(CASE WHEN method = 'play' THEN 1 END) as cnt_play \n\t\t\t\t\t\t FROM " . $wpdb->prefix . "podpress_stats \n\t\t\t\t\t\t GROUP BY media \n\t\t\t\t\t\t ORDER BY cnt_total DESC"; $stats = $wpdb->get_results($sql); if ($stats) { $i = 0; foreach ($stats as $stat) { ++$i; $sqlI = "INSERT INTO " . $wpdb->prefix . "podpress_statcounts (media, total, feed, web, play) VALUES ('" . $stat->media . "', " . $stat->cnt_total . ", " . $stat->cnt_feed . ", " . $stat->cnt_web . ", " . $stat->cnt_play . ")"; $wpdb->query($sqlI); } } break; case '4.5': $x = stripslashes(get_option('channelCat')); delete_option('channelCat'); if (!empty($x)) { add_option('podPress_rss_category', $x); } break; case '5.3': $posts = $wpdb->get_results("SELECT ID FROM " . $wpdb->prefix . "posts"); if ($posts) { foreach ($posts as $post) { $x['itunes:subtitle'] = get_post_meta($post->ID, 'itunes:subtitle', true); delete_post_meta($post->ID, 'itunes:subtitle'); if (!isset($x['itunes:subtitle'])) { unset($x['itunes:subtitle']); } $x['itunes:summary'] = get_post_meta($post->ID, 'itunes:summary', true); delete_post_meta($post->ID, 'itunes:summary'); if (!isset($x['itunes:summary'])) { unset($x['itunes:summary']); } $x['itunes:keywords'] = get_post_meta($post->ID, 'itunes:keywords', true); delete_post_meta($post->ID, 'itunes:keywords'); if (!isset($x['itunes:keywords'])) { unset($x['itunes:keywords']); } $x['itunes:author'] = get_post_meta($post->ID, 'itunes:author', true); delete_post_meta($post->ID, 'itunes:author'); if (!isset($x['itunes:author'])) { unset($x['itunes:author']); } $x['itunes:explicit'] = get_post_meta($post->ID, 'itunes:explicit', true); delete_post_meta($post->ID, 'itunes:explicit'); if (!isset($x['itunes:explicit'])) { unset($x['itunes:explicit']); } $x['itunes:block'] = get_post_meta($post->ID, 'itunes:block', true); delete_post_meta($post->ID, 'itunes:block'); if (!isset($x['itunes:block'])) { unset($x['itunes:block']); } if (!empty($x)) { podPress_add_post_meta($post->ID, 'podPressPostSpecific', $x, true); } } } break; case '5.6': $x = podPress_get_option('podPress_config'); $y = true; if ($y) { $newSettings = array(); $newSettings['enableStats'] = get_option('podPress_enableStats'); $newSettings['statMethod'] = get_option('podPress_statMethod'); $newSettings['statLogging'] = get_option('podPress_statLogging'); $newSettings['enablePodTracStats'] = get_option('podPress_enablePodTracStats'); $newSettings['enablePremiumContent'] = get_option('podPress_enablePremiumContent'); $newSettings['enableTorrentCasting'] = get_option('podPress_enableTorrentCasting'); $newSettings['mediaWebPath'] = get_option('podPress_mediaWebPath'); $newSettings['mediaFilePath'] = get_option('podPress_mediaFilePath'); $newSettings['contentBeforeMore'] = get_option('podPress_contentBeforeMore'); $newSettings['contentLocation'] = get_option('podPress_contentLocation'); $newSettings['contentImage'] = get_option('podPress_contentImage'); $newSettings['contentPlayer'] = get_option('podPress_contentPlayer'); $newSettings['contentDownload'] = get_option('podPress_contentDownload'); $newSettings['contentDownloadText'] = get_option('podPress_contentDownloadText'); $newSettings['contentDownloadStats'] = get_option('podPress_contentDownloadStats'); $newSettings['contentDuration'] = get_option('podPress_contentDuration'); $newSettings['rss_showlinks'] = get_option('podPress_rss_showlinks'); $newSettings['rss_category'] = get_option('podPress_rss_category'); $newSettings['enableFooter'] = get_option('podPress_enableFooter'); $newSettings['player'] = podPress_get_option('podPress_playerSettings'); $newSettings['iTunes'] = podPress_get_option('podPress_iTunes'); delete_option('podPress_config'); add_option('podPress_config', $newSettings, "podPress Configuration", true); } break; case '5.7': // in the next release I will clean up old crap data that is still laying around delete_option('podPress_enableStats'); delete_option('podPress_statMethod'); delete_option('podPress_statLogging'); delete_option('podPress_enablePodTracStats'); delete_option('podPress_enablePremiumContent'); delete_option('podPress_enableTorrentCasting'); delete_option('podPress_mediaWebPath'); delete_option('podPress_mediaFilePath'); delete_option('podPress_contentBeforeMore'); delete_option('podPress_contentLocation'); delete_option('podPress_contentImage'); delete_option('podPress_contentPlayer'); delete_option('podPress_contentDownload'); delete_option('podPress_contentDownloadText'); delete_option('podPress_contentDownloadStats'); delete_option('podPress_contentDuration'); delete_option('podPress_rss_showlinks'); delete_option('podPress_rss_category'); delete_option('podPress_enableFooter'); delete_option('podPress_iTunes'); delete_option('podPress_playerSettings'); delete_option('podPress_enableLogging'); delete_option('podPress_downloadLinksInRSS'); delete_option('podPress_categoryCasting'); delete_option('podPress_beforeMore'); $sql = "DELETE FROM " . $wpdb->prefix . "postmeta WHERE meta_key='podPressiTunesPostSpecific'"; $wpdb->query($sql); break; case '6.3': $x = podPress_get_option('podPress_config'); $x['iTunes']['category'][0] = podPress_upgradeCategory($x['iTunes']['category'][0]); if (isset($x['iTunes']['category'][1])) { $x['iTunes']['category'][1] = podPress_upgradeCategory($x['iTunes']['category'][1]); } if (isset($x['iTunes']['category'][2])) { $x['iTunes']['category'][2] = podPress_upgradeCategory($x['iTunes']['category'][2]); } podPress_update_option('podPress_config', $x); break; case '6.7': $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_statcounts ADD COLUMN postID int(11) NOT NULL DEFAULT 0 FIRST;"; podPress_maybe_add_column($wpdb->prefix . 'podpress_statcounts', 'postID', $create_table); $sql = 'ALTER TABLE ' . $wpdb->prefix . 'podpress_statcounts ADD PRIMARY KEY (media(255),postID), DROP PRIMARY KEY;'; $wpdb->get_results($sql); $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_stats ADD COLUMN postID int(11) NOT NULL DEFAULT 0 AFTER id;"; podPress_maybe_add_column($wpdb->prefix . 'podpress_stats', 'postID', $create_table); $mappings = array(); $sql = "SELECT * FROM " . $wpdb->prefix . "postmeta WHERE meta_key = 'podPressMedia' ORDER BY meta_id;"; $posts = $wpdb->get_results($sql); if ($posts) { foreach ($posts as $post) { $mediaFiles = unserialize($post->meta_value); if (is_array($mediaFiles)) { foreach ($mediaFiles as $mediaFile) { if (!isset($mappings[$mediaFile['URI']])) { $filename = podPress_getFileName($mediaFile['URI']); $mappings[$filename] = $post->post_id; } } } } reset($mappings); foreach ($mappings as $key => $val) { $wpdb->query('UPDATE ' . $wpdb->prefix . "podpress_statcounts SET postID = '" . $val . "' WHERE media='" . $key . "'"); $wpdb->query('UPDATE ' . $wpdb->prefix . "podpress_stats SET postID = '" . $val . "' WHERE media='" . $key . "'"); } } case '7.9': $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_stats ADD COLUMN completed TINYINT(1) UNSIGNED DEFAULT 0;"; podPress_maybe_add_column($wpdb->prefix . 'podpress_stats', 'completed', $create_table); break; case '8.3': if ($this->settings['enablePodTracStats']) { $this->settings['enable3rdPartyStats'] = 'PodTrac'; } break; default: // do nothing break; } if (function_exists('wp_cache_flush')) { wp_cache_flush(); } if (version_compare(PODPRESS_VERSION, $current, '>=')) { update_option('podPress_version', $current); } $current = $current + 0.1; } }
function xmlrpc_post_addMedia($input) { $postdata = $input['postdata']; $content_struct = $input['content_struct']; if (isset($content_struct['enclosure']) && !empty($content_struct['enclosure']['url'])) { $media[0]['URI'] = $content_struct['enclosure']['url']; $media[0]['authorized'] = true; if (!empty($content_struct['enclosure']['type'])) { $media[0]['type'] = $content_struct['enclosure']['type']; } else { $media[0]['type'] = podPress_mimetypes(podPress_getFileExt($content_struct['enclosure']['url'])); } if ($media[0]['type'] == 'video/x-ms-wmv') { $media[0]['type'] = 'video/wmv'; } elseif ($media[0]['type'] == 'video/x-flv') { $media[0]['type'] = 'video/flv'; } $media[0]['type'] = str_replace('/', '_', $media[0]['type']); if (!empty($content_struct['enclosure']['duration'])) { $media[0]['duration'] = $content_struct['enclosure']['duration']; } else { $media[0]['duration'] = 0; } if (!empty($content_struct['enclosure']['size'])) { $media[0]['size'] = $content_struct['enclosure']['size']; } else { $media[0]['size'] = 0; } if (!empty($content_struct['enclosure']['title'])) { $media[0]['title'] = $content_struct['enclosure']['title']; } if (!empty($content_struct['enclosure']['previewImage'])) { $media[0]['previewImage'] = $content_struct['enclosure']['previewImage']; } if (!empty($content_struct['enclosure']['rss'])) { $media[0]['rss'] = $content_struct['enclosure']['rss']; } else { $media[0]['rss'] = true; } delete_post_meta($postdata['ID'], '_podPressMedia'); podPress_add_post_meta($postdata['ID'], '_podPressMedia', $media, true); } return true; }