r58260 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58259‎ | r58260 | r58261 >
Date:15:25, 28 October 2009
Author:travis
Status:deferred
Tags:
Comment:
dealing with the error The request's content type is not multipart.
Modified paths:
  • /trunk/extensions/YouTubeAuthSub/YouTubeAuthSub_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/YouTubeAuthSub/YouTubeAuthSub_body.php
@@ -17,7 +17,7 @@
1818 function execute( $par ) {
1919 global $wgRequest, $wgTitle, $wgOut, $wgMemc, $wgUser;
2020 global $wgYTAS_User, $wgYTAS_Password, $wgYTAS_DeveloperId;
21 - global $wgYTAS_DefaultCategory, $wgYTAS_UseClientLogin, $wgYTAS_EnableLogging, $wgYTAS_UseNamespace;
 21+ global $wgYTAS_DefaultCategory, $wgYTAS_UseClientLogin, $wgYTAS_EnableLogging, $wgYTAS_UseNamespace, $wgYTAS_ClientId;
2222
2323 wfLoadExtensionMessages( 'YouTubeAuthSub' );
2424
@@ -123,7 +123,7 @@
124124
125125 if ($wgRequest->wasPosted()) {
126126 $url = "http://uploads.gdata.youtube.com/feeds/api/users/{$wgYTAS_User}/uploads";
127 -
 127+ $url = "http://gdata.youtube.com/action/GetUploadToken";
128128 $data = "<?xml version='1.0'?>
129129 <entry xmlns='http://www.w3.org/2005/Atom'
130130 xmlns:media='http://search.yahoo.com/mrss/'
@@ -138,6 +138,8 @@
139139 </entry>
140140 ";
141141 $headers = array (
 142+ "GData-Version: 2",
 143+ "X-GData-Client: key={$wgYTAS_ClientId}",
142144 "X-GData-Key: key={$wgYTAS_DeveloperId}",
143145 "Content-Type: application/atom+xml; charset=UTF-8",
144146 "Content-Length: " . strlen($data),
@@ -149,10 +151,8 @@
150152
151153 $results = wfSpecialYouTubePost($url, $data, $headers);
152154
153 - preg_match("/<yt:token>.*<\/yt:token>/", $results, $matches);
154 - $token = strip_tags($matches[0]);
155 - preg_match("/'edit-media'[^>]*href='[^']*'>/", $results, $matches);
156 - $url = preg_replace("/.*href='([^']*)'>/", "$1", $matches[0]);
 155+ $url = preg_replace("@.*<url>(.*)</url>.*@", "$1", $results);
 156+ $token = preg_replace("@.*<token>(.*)</token>.*@", "$1", $results);
157157
158158 if ($url == "") {
159159 $wgOut->addHTML("Unable to extract URL, results where <pre>{$results}</pre>");

Status & tagging log