コード例 #1
0
ファイル: uploads.php プロジェクト: rkern21/videoeditor
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function uploadConfirmWarp()
	{
		global $Itemid;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();

		$video_id 		    = JRequest::getVar( 'videoGuid', '' );

		$title 				= hwd_vs_tools::generatePostTitle();
		$description 		= hwd_vs_tools::generatePostDescription();
		$tags 				= hwd_vs_tools::generatePostTags();
		$category_id 		= JRequest::getInt("category_id", 0);
		$public_private 	= JRequest::getWord("public_private", "");
		$allow_comments 	= JRequest::getInt("allow_comments", 0);
		$allow_embedding 	= JRequest::getInt("allow_embedding", 0);
		$allow_ratings 		= JRequest::getInt("allow_ratings", 0);

		$checkform = hwd_vs_tools::checkFormComplete($title, $description, $category_id, $tags, $public_private, $allow_comments, $allow_embedding, $allow_ratings);
		if (!$checkform) { return; }

		require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'libraries'.DS.'warp'.DS.'infin-lib.php');
		$accountKey = $c->warpAccountKey;
		$secretKey = $c->warpSecretKey;

		// update warp hd
		$infinVideo = new InfinovationVideo($accountKey, $secretKey);
		$infinVideo->updateVideo($video_id, $title, $description, $tags, $my->id, "");

		$row = new hwdvids_video($db);

		$_POST['approved']          = "yes";
		$_POST['video_type'] 		= "warphd";
		$_POST['video_id'] 		    = $video_id;

		$password = Jrequest::getVar( 'hwdvspassword', '' );
		if (!empty($password))
		{
			$_POST['password'] 		= $password;
		}

		$_POST['title'] 			= $title;
		$_POST['description'] 		= $description;
		$_POST['category_id'] 		= $category_id;
		$_POST['tags'] 				= $tags;
		$_POST['public_private'] 	= $public_private;
		$_POST['allow_comments'] 	= $allow_comments;
		$_POST['allow_embedding'] 	= $allow_embedding;
		$_POST['allow_ratings'] 	= $allow_ratings;
		$_POST['date_uploaded'] 	= date('Y-m-d H:i:s');
		$_POST['user_id'] 			= $my->id;
		$_POST['published'] 		= "1";

		if(empty($_POST['video_id']))
		{
			hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0);
			return;
		}

		// bind it to the table
		if (!$row->bind($_POST))
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}

		// store it in the db
		if (!$row->store())
		{
			echo "<script type=\"text/javascript\">alert('".$row->getError()."');window.history.go(-1);</script>\n";
			exit();
		}


		include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'helpers'.DS.'events.php');

		$params->title = $title;
		$params->id = $row->id;
		$params->category_id = $row->category_id;
		$params->type = $row->video_type;
		$params->user_id = $row->user_id;

		hwdvsEvent::onAfterVideoUpload($params);

		hwd_vs_html::uploadConfirm($title, $row);
	}