1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
| <?php
header("POST /accounts/ClientLogin HTTP/1.0");
header("Content-type: application/x-www-form-urlencoded");
header("accountType=GOOGLE&Email=<>&Passwd=<>69&service=youtube&source=<>");
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* PHP sample code for the YouTube data API. Utilizes the Zend Framework
* Zend_Gdata component to communicate with the YouTube data API.
*
* Requires the Zend Framework Zend_Gdata component and PHP >= 5.1.4
* This sample is run from within a web browser. These files are required:
* session_details.php - a script to view log output and session variables
* operations.php - the main logic, which interfaces with the YouTube API
* index.php - the HTML to represent the web UI, contains some PHP
* video_app.css - the CSS to define the interface style
* video_app.js - the JavaScript used to provide the video list AJAX interface
*
* NOTE: If using in production, some additional precautions with regards
* to filtering the input data should be used. This code is designed only
* for demonstration purposes.
*/
session_start();
$_SESSION['sessionToken'] = $_POST['Auth'];
/**
* Set your developer key here.
*
* NOTE: In a production application you may want to store this information in
* an external file.
*/
$_SESSION['developerKey'] = 'AI39si5n38AyOAAL34cW7JmctHk0EnIkhL0gclpUbp7sfZz31_CohBG2QfGeRhwd8ayx-skvnkOAcjQNvPgy9NoCPNU64np4yg';
/**
* Convert HTTP status into normal text.
*
* @param number $status HTTP status received after posting syndicated upload
* @param string $code Alphanumeric description of error
* @param string $videoId (optional) Video id received back to which the status
* code refers to
*/
function uploadStatus($status, $code = null, $videoId = null)
{
switch ($status) {
case $status < 400:
echo 'Téléchargement reussis ! (id: '. $videoId .
') <a href="#" onclick=" ytVideoApp.checkUploadDetails(\''.
$videoId .'\'); ">(details)</a>';
break;
default:
echo "Il sembles qu'il y ai eu une erreur: ". $code .
'<a href="#" onclick=" ytVideoApp.checkUploadDetails(\''.
$videoId . '\'); ">(check details)</a>';
}
}
/**
* Helper function to check whether a session token has been set
*
* @return boolean Returns true if a session token has been set
*/
function authenticated()
{
if (isset($_SESSION['sessionToken'])) {
return true;
}
}
/**
* Helper function to print a list of authenticated actions for a user.
*/
function printAuthenticatedActions()
{
print <<<END
<div id="actions"><h3>Authenticated Actions</h3>
<ul>
<li><a href="#" onclick="ytVideoApp.listVideos('search_owner', '', 1);
return false;">retrouver mes videos</a></li>
<li><a href="#" onclick="ytVideoApp.prepareUploadForm();
return false;">telecharger une video</a><br />
<div id="syndicatedUploadDiv"></div><div id="syndicatedUploadStatusDiv">
</div></li>
<li><a href="#" onclick="ytVideoApp.retrievePlaylists();
return false;">gérer mes playlists</a><br /></li>
</ul></div>
END;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//FR"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="google-site-verification" content="IjZBF9BzdXwuk-jwXjcLX5O2WqwfMugpzkXTRegly6o" />
<title></title>
<link href="video_app.css" type="text/css" rel="stylesheet" />
<script src="video_app.js" type="text/javascript"></script>
</head>
<body>
<div id="main">
<div id="titleBar">
<h1><center>Handi - Tube</center></h1>
<div id="searchBox">
<form id="searchForm" onsubmit="ytVideoApp.listVideos(this.queryType.value, this.searchTerm.value, 1); return false;" action="javascript:void();" >
<div id="searchBoxTop"><select name="queryType" onchange="ytVideoApp.queryTypeChanged(this.value, this.form.searchTerm);" >
<option value="search_all" selected="selected">Toutes les Vidéos</option>
<option value="search_top_rated">Top Vidéos</option>
<option value="search_most_viewed">Vidéos les plus regardées</option>
<option value="search_recently_featured">Vidéos les plus récentes</option>
<option value="search_username">Vidéos d'un utilisateur spécifique</option>
<?php
if (authenticated()) {
echo '<option value="search_owner">Afficher mes vidéos</option>';
}
?>
</select></div>
<div><input name="searchTerm" type="text" value="Sur YouTube" />
<input type="submit" value="Go" /></div>
</form>
</div>
<br />
</div>
<br />
<!-- Authentication status -->
<div id="authStatus">
<?php
if (authenticated()) {
print <<<END
<br />
END;
} else {
print <<<END
<div id="generateAuthSubLink">
<form action="https://www.google.com/youtube/accounts/ClientLogin" method="post">
<input name="Email" type="hidden" value="<>" />
<input name="Passwd" type="hidden" value="<>" />
<input name="service" type="hidden" value="youtube" />
<input name="source" type="hidden" value="<>" />
<input name="nextUrl" type="hidden" value="http://www.handivision.net" />
<input type="submit" value="Go" /></div>
</form>
</div>
END;
}
//old line150 => onclick="ytVideoApp.presentAuthLink();return false;"
?>
</div>
<!-- end Authentication status -->
<br clear="all" />
<?php
// if $_GET['status'] is populated then we have a response
// about a syndicated upload from YouTube's servers
if (isset($_GET['status'])) {
(isset($_GET['code']) ? $code = $_GET['code'] : $code = null);
(isset($_GET['id']) ? $id = $_GET['id'] : $id = null);
print '<div id="generalStatus">' .
uploadStatus($_GET['status'], $code, $id) .
'<div id="detailedUploadStatus"></div></div>';
}
?>
<!-- General status -->
<?php
if (authenticated()) {
printAuthenticatedActions();
}
?>
<!-- end General status -->
<br clear="all" />
<div id="searchResults">
<div id="searchResultsListColumn">
<div id="searchResultsVideoList"></div>
<div id="searchResultsNavigation">
<form id="navigationForm" action="javascript:void();">
<input type="button" id="previousPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.previousPage);" value="Back" style="display: none;" />
<input type="button" id="nextPageButton" onclick="ytVideoApp.listVideos(ytVideoApp.previousQueryType, ytVideoApp.previousSearchTerm, ytVideoApp.nextPage);" value="Next" style="display: none;" />
</form>
</div>
</div>
<div id="searchResultsVideoColumn">
<div id="videoPlayer"></div>
</div>
</div>
</div>
</body>
</html> |
Partager