コード例 #1
0
ファイル: Youtube.php プロジェクト: nlegoff/Phraseanet
 /**
  *
  * @param  string $object
  * @param  string $object_id
  * @return Void
  */
 public function delete_object($object, $object_id)
 {
     switch ($object) {
         case self::ELEMENT_TYPE_VIDEO:
             $this->_api->delete($this->_api->getFullVideoEntry($object_id));
             break;
         case self::CONTAINER_TYPE_PLAYLIST:
             $this->get_PlaylistEntry_from_Id($object_id)->delete();
             break;
         default:
             throw new Bridge_Exception_ObjectUnknown('Unknown object ' . $object);
             break;
     }
     return;
 }
コード例 #2
0
ファイル: zendyoutube.php プロジェクト: hoanglannet/copar
 function delete($username, $password, $source, $videoId)
 {
     $httpClient = $this->clientLogin($username, $password, $source);
     $httpClient->setHeaders('X-GData-Key', "key={$source}");
     $yt = new Zend_Gdata_YouTube($httpClient);
     try {
         $videoEntryToDelete = $yt->getVideoEntry($videoId, null, true);
         $result = $yt->delete($videoEntryToDelete);
         return $result;
     } catch (Zend_Gdata_App_HttpException $httpException) {
         echo $httpException->getRawResponseBody();
     } catch (Zend_Gdata_App_Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #3
0
/**
 * Deletes a Video.
 *
 * @param string $videoId Id of the video to be deleted.
 * @return void
 */
function deleteVideo($videoId)
{
    $httpClient = getAuthSubHttpClient();
    $youTubeService = new Zend_Gdata_YouTube($httpClient);
    $feed = $youTubeService->getVideoFeed('http://gdata.youtube.com/feeds/users/default/uploads');
    $videoEntryToDelete = null;
    foreach ($feed as $entry) {
        if ($entry->getVideoId() == $videoId) {
            $videoEntryToDelete = $entry;
            break;
        }
    }
    // check if videoEntryToUpdate was found
    if (!$videoEntryToDelete instanceof Zend_Gdata_YouTube_VideoEntry) {
        print 'ERROR - Could not find a video entry with id ' . $videoId . '<br />';
        return;
    }
    try {
        $httpResponse = $youTubeService->delete($videoEntryToDelete);
        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 delete video: ' . $e->getMessage();
        return;
    }
    print 'Entry deleted succesfully.<br />' . $httpResponse->getBody() . '<br /><a href="#" onclick="' . 'ytVideoApp.presentFeed(\'search_owner\', 5, 0, \'none\');"' . '">(refresh your video listing)</a><br />' . printCacheWarning();
}
コード例 #4
0
		function delAction()
		{
			if ($_SESSION['role_id']!=0)
			{
				$this->_redirect($this->view->baseUrl().'/../admin');
			}
			else 
			{
				$video = $this->mVideo->getVideoById($video_id);
				if($this->role == "0" | ($this->user_login == $video['user_upload']))
				{
					$video_id = $this->_request->getParam('video_id');
					$video_link = $video['video_link'];
					$youtube_id = $video['youtube_id'];
					$account = $this->mVideo->getAccountByYoutubeId($youtube_id);
					$user = $account['youtube_username'];
					$pass = $account['password'];
					$this->mVideo->delVideo($video_id);
					if($video_link != null)
					{
						try 
							{
								$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
								Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
								$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
												              $username = $user,
												              $password = $pass,
												              $service 	= 'youtube',
												              $client 	= null,
												              $source 	= 'NIWApp', 
												              $loginToken 	= null,
												              $loginCaptcha = null,
												              $authenticationURL
												           );
											   
								Zend_Loader::loadClass('Zend_Gdata_YouTube');
							 	$yt = new Zend_Gdata_YouTube($httpClient, 'NIW-App-1.0', '661085061264.apps.googleusercontent.com', 'AI39si4UPUxw1FE5hqSi0Z-B-5z3PIVovbBWKmqiMI3cXJ7lhvjJcABV-eqimb2EeSiuedWK8N9OGOdB1namX1CqqYki8jEfSQ');
								
								$video = $yt->getFullVideoEntry($video_link);
				                $yt->delete($video);
						    }
						    catch (Exception $ex) {
						        echo $ex->getMessage();
						        exit;
						    }
					}
					$this->_redirect($this->view->baseUrl().'/../admin/uploadvideo');
				}
				else
				{
					$_SESSION['result']='Bạn không có quyền xóa mục này !';
					$this->_redirect($this->view->baseUrl().'/../admin/uploadvideo');
				}
			}
		}
コード例 #5
0
ファイル: video.php プロジェクト: sauravpratihar/fcms
 /**
  * displayRemoveVideoSubmit 
  * 
  * Remove video doesn't actually physically delete the video from FCMS, it 
  * just sets the video to in-active in the DB, which removes it from view.
  * 
  * We don't want to delete these entries from the db, because the cron importer
  * will just continue to import them.
  * 
  * @return void
  */
 function displayRemoveVideoSubmit()
 {
     if (!isset($_POST['id']) || !isset($_POST['source_id'])) {
         $this->displayHeader();
         echo '<div class="error_alert">' . T_('Can\'t remove video.  Missing video id.') . '</div>';
         $this->displayFooter();
         return;
     }
     $userId = (int) $_GET['u'];
     $id = (int) $_POST['id'];
     $sourceId = $_POST['source_id'];
     $sql = "UPDATE `fcms_video`\n                SET `active` = 0,\n                    `updated` = NOW(),\n                    `updated_id` = ?\n                WHERE `id` = ?";
     if (!$this->fcmsDatabase->update($sql, array($this->fcmsUser->id, $id))) {
         $this->displayFooter();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     if (isset($_POST['delete_youtube'])) {
         $sessionToken = $this->getSessionToken($this->fcmsUser->id);
         $youtubeConfig = getYouTubeConfigData();
         $httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $sessionToken);
         if ($httpClient === false) {
             // Error message was already displayed by getYouTubeAuthSubHttpClient()
             $this->displayFooter();
             return;
         }
         $youTubeService = new Zend_Gdata_YouTube($httpClient);
         $videoEntry = $youTubeService->getVideoEntry($sourceId);
         // Set message
         $_SESSION['message'] = 'delete_video_youtube';
         $youTubeService->delete($videoEntry);
     }
     // Set message
     if (!isset($_SESSION['message'])) {
         $_SESSION['message'] = 'remove_video';
     }
     // Send back to user's video listing
     header("Location: video.php?u={$userId}");
 }