/** * Helper function if an unsupported operation is passed into this files main loop. * * @param array $post (Optional) The post variables that accompanied the operation, if available. * @return void */ function unsupportedOperation($_POST) { $message = 'ERROR An unsupported operation has been called - post variables received ' . print_r($_POST, true); if (loggingEnabled()) { logMessage($message, 'error'); } print $message; }
$nextUrl = null; $httpClient = getAuthSubHttpClient(); $youTubeService = new Zend_Gdata_YouTube($httpClient); $newVideoEntry = new Zend_Gdata_YouTube_VideoEntry(); $newVideoEntry->setVideoTitle($videoTitle); $newVideoEntry->setVideoDescription($videoDescription); //make sure first character in category is capitalized $videoCategory = strtoupper(substr($videoCategory, 0, 1)) . substr($videoCategory, 1); $newVideoEntry->setVideoCategory($videoCategory); // convert videoTags from whitespace separated into comma separated $videoTagsArray = explode(' ', trim($videoTags)); $newVideoEntry->setVideoTags(implode(', ', $videoTagsArray)); $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken'; try { $tokenArray = $youTubeService->getFormUploadToken($newVideoEntry, $tokenHandlerUrl); if (loggingEnabled()) { logMessage($httpClient->getLastRequest(), 'request'); logMessage($httpClient->getLastResponse()->getBody(), 'response'); } } catch (Zend_Gdata_App_HttpException $httpException) { print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />'; return; } catch (Zend_Gdata_App_Exception $e) { print 'ERROR - Could not retrieve token for syndicated upload. ' . $e->getMessage() . '<br /><a href="session_details.php">' . 'click here to view details of last request</a><br />'; return; } $tokenValue = $tokenArray['token']; $postUrl = $tokenArray['url']; // place to redirect user after upload if (!$nextUrl) { $nextUrl = $_SESSION['homeUrl'];