Example #1
0
//   $_POST_DATA['client_id']; or $_POST_DATA['check_box_1_'] etc
/////////////////////////////////////////////////////////////////////////////////////////////////
// NOTE: You can now access all file (slot, name, size, type) info below this comment. eg.
//   $_FILE_DATA[0]->name  or  $_FILE_DATA[0]->getFileInfo('name')
/////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create thumnail example  (must uncomment line 34)
// if( $_FILE_DATA[0]->type  == 'image/jpeg'){ $success = createThumbFile($_CONFIG_DATA['upload_dir'],  $_FILE_DATA[0]->name, $_CONFIG_DATA['upload_dir'],  120,  100);  }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//Create file upload table
$_FILE_DATA_TABLE = getFileDataTable($_FILE_DATA, $_CONFIG_DATA);

// Create and send email
if($_CONFIG_DATA['send_email_on_upload']){ emailUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA); }

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Uber-Uploader - Free File Upload Progress Bar</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="-1">
    <meta name="robots" content="none">
  </head>
  <?php if($_CONFIG_DATA['embedded_upload_results'] == 1){ ?>
  <script language="javascript" type="text/javascript">
Example #2
0
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	Create Thumnail Example
//
//	createThumbFile(source_file_path, source_file_name, thumb_file_path, thumb_file_name, thumb_file_width, thumb_file_height)
//
//	EXAMPLE
//	$file_extension = getFileExtension($_FILE_DATA['upfile_1241018436628']->name);
//
//	if($file_extension == 'jpg' || $file_extension == 'jpeg' || $file_extension == 'png'){ $success = createThumbFile($_CONFIG_DATA['upload_dir'], $_FILE_DATA['upfile_1241018436628']->name, $_CONFIG_DATA['upload_dir'], 'thumb_' . $_FILE_DATA['upfile_1241018436628']->name, 120, 100); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Format upload results
$_FORMATTED_UPLOAD_RESULTS = getFormattedUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA);
// Create and send email
if ($_CONFIG_DATA['send_email_on_upload']) {
    emailUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA);
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Uber-Uploader - Free File Upload Progress Bar</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="-1">
		<meta name="robots" content="none">
		<link rel="stylesheet" type="text/css" href="<?php 
print $_INI['path_to_css_file'];
?>
Example #3
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function uploadConfirmPerl()
	{
	global $database, $my, $acl, $mosConfig_absolute_path, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_live_site, $Itemid, $mosConfig_sitename;

	$c = hwd_vs_Config::get_instance();
	$db = & JFactory::getDBO();
	$my = & JFactory::getUser();
	$acl= & JFactory::getACL();

	// get server configuration data
	require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php');
	$s = hwd_vs_SConfig::get_instance();

	//******************************************************************************************************
	//   ATTENTION: THIS FILE HEADER MUST REMAIN INTACT. DO NOT DELETE OR MODIFY THIS FILE HEADER.
	//
	//   Name: ubr_finished.php
	//   Revision: 1.3
	//   Date: 2/18/2008 5:36:57 PM
	//   Link: http://uber-uploader.sourceforge.net
	//   Initial Developer: Peter Schmandra  http://www.webdice.org
	//   Description: Show successful file uploads.
	//
	//   Licence:
	//   The contents of this file are subject to the Mozilla Public
	//   License Version 1.1 (the "License"); you may not use this file
	//   except in compliance with the License. You may obtain a copy of
	//   the License at http://www.mozilla.org/MPL/
	//
	//   Software distributed under the License is distributed on an "AS
	//   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
	//   implied. See the License for the specific language governing
	//   rights and limitations under the License.
	//
	//***************************************************************************************************************

	//***************************************************************************************************************
	// The following possible query string formats are assumed
	//
	// 1. ?upload_id=upload_id
	// 2. ?about=1
	//****************************************************************************************************************

	$THIS_VERSION = "1.3";                                // Version of this file
	$UPLOAD_ID = '';                                      // Initialize upload id

	require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_ini.php');
	require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_lib.php');
	require_once(JPATH_SITE.DS.'components'.DS.'com_hwdvideoshare'.DS.'assets'.DS.'uploads'.DS.'perl'.DS.'ubr_finished_lib.php');

	if($PHP_ERROR_REPORTING){ error_reporting(E_ALL); }

	header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
	header('Last-Modified: '.date('r'));
	header('Cache-Control: no-store, no-cache, must-revalidate');
	header('Cache-Control: post-check=0, pre-check=0', FALSE);
	header('Pragma: no-cache');

	if(preg_match("/^[a-zA-Z0-9]{32}$/", $_GET['upload_id'])){ $UPLOAD_ID = $_GET['upload_id']; }
	elseif(isset($_GET['about']) && $_GET['about'] == 1){ kak("<u><b>UBER UPLOADER FINISHED PAGE</b></u><br>UBER UPLOADER VERSION =  <b>" . $UBER_VERSION . "</b><br>UBR_FINISHED = <b>" . $THIS_VERSION . "<b><br>\n", 1 , __LINE__); }
	else{ kak("<font color='red'>ERROR</font>: Invalid parameters passed<br>", 1, __LINE__); }

	//Declare local values
	$_XML_DATA = array();                                          // Array of xml data read from the upload_id.redirect file
	$_CONFIG_DATA = array();                                       // Array of config data read from the $_XML_DATA array
	$_POST_DATA = array();                                         // Array of posted data read from the $_XML_DATA array
	$_FILE_DATA = array();                                         // Array of 'FileInfo' objects read from the $_XML_DATA array
	$_FILE_DATA_TABLE = '';                                        // String used to store file info results nested between <tr> tags
	$_FILE_DATA_EMAIL = '';                                        // String used to store file info results

	$xml_parser = new XML_Parser;                                  // XML parser
	$xml_parser->setXMLFile($TEMP_DIR, $_REQUEST['upload_id']);    // Set upload_id.redirect file
	$xml_parser->setXMLFileDelete($DELETE_REDIRECT_FILE);          // Delete upload_id.redirect file when finished parsing
	$xml_parser->parseFeed();                                      // Parse upload_id.redirect file

	// Display message if the XML parser encountered an error
	if($xml_parser->getError()){ kak($xml_parser->getErrorMsg(), 1, __LINE__); }

	$_XML_DATA = $xml_parser->getXMLData();                        // Get xml data from the xml parser
	$_CONFIG_DATA = getConfigData($_XML_DATA);                     // Get config data from the xml data
	$_POST_DATA  = getPostData($_XML_DATA);                        // Get post data from the xml data
	$_FILE_DATA = getFileData($_XML_DATA);                         // Get file data from the xml data

	// Output XML DATA, CONFIG DATA, POST DATA, FILE DATA to screen and exit if DEBUG_ENABLED.
	if($DEBUG_FINISHED){
		debug("<br><u>XML DATA</u>", $_XML_DATA);
		debug("<u>CONFIG DATA</u>", $_CONFIG_DATA);
		debug("<u>POST DATA</u>", $_POST_DATA);
		debug("<u>FILE DATA</u><br>", $_FILE_DATA);
		exit;
	}

	/////////////////////////////////////////////////////////////////////////////////////////////////
	//
	//           *** ATTENTION: ENTER YOUR CODE HERE !!! ***
	//
	// This is a good place to put your post upload code. Like saving the
	// uploaded file information to your DB or doing some image
	// manipulation. etc. Everything you need is in the
	// $XML DATA, $_CONFIG_DATA, $_POST_DATA and $_FILE_DATA arrays.
	//
	/////////////////////////////////////////////////////////////////////////////////////////////////
	// NOTE: You can now access all XML values below this comment. eg.
	//   $_XML_DATA['upload_dir']; or $_XML_DATA['link_to_upload'] etc
	/////////////////////////////////////////////////////////////////////////////////////////////////
	// NOTE: You can now access all config values below this comment. eg.
	//   $_CONFIG_DATA['upload_dir']; or $_CONFIG_DATA['link_to_upload'] etc
	/////////////////////////////////////////////////////////////////////////////////////////////////
	// NOTE: You can now access all post values below this comment. eg.
	//   $_POST_DATA['client_id']; or $_POST_DATA['check_box_1_'] etc
	/////////////////////////////////////////////////////////////////////////////////////////////////
	// NOTE: You can now access all file (slot, name, size, type) info below this comment. eg.
	//   $_FILE_DATA[0]->name  or  $_FILE_DATA[0]->getFileInfo('name')
	/////////////////////////////////////////////////////////////////////////////////////////////////

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Create thumnail example  (must uncomment line 34)
	// if( $_FILE_DATA[0]->type  == 'image/jpeg'){ $success = createThumbFile($_CONFIG_DATA['upload_dir'],  $_FILE_DATA[0]->name, $_CONFIG_DATA['upload_dir'],  120,  100);  }
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	//Create file upload table
	$_FILE_DATA_TABLE = getFileDataTable($_FILE_DATA, $_CONFIG_DATA);

	// Create and send email
	if($_CONFIG_DATA['send_email_on_upload']){ emailUploadResults($_FILE_DATA, $_CONFIG_DATA, $_POST_DATA); }

		$file_name = $_FILE_DATA[0]->name;
		$file_ext = substr($file_name, strrpos($file_name, '.') + 1);
		$file_ext = strtolower($file_ext);
		$file_video_name = $file_name;
		$file_video_id = substr($file_name, 0, -(strlen($file_ext)+1));

		$title 				= hwd_vs_tools::generatePostTitle($_POST_DATA['title']);
		$description 		= hwd_vs_tools::generatePostDescription($_POST_DATA['description']);
		$tags 				= hwd_vs_tools::generatePostTags($_POST_DATA['tags']);
		$category_id 		= intval ($_POST_DATA['category_id']);
		$public_private 	= $_POST_DATA['public_private'];
		$allow_comments 	= intval ($_POST_DATA['allow_comments']);
		$allow_embedding 	= intval ($_POST_DATA['allow_embedding']);
		$allow_ratings 		= intval ($_POST_DATA['allow_ratings']);

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

		// initialise database
		$row = new hwdvids_video($db);

		if ($file_ext == "swf") {
			$_POST['video_type'] 		= "swf";
		} else if ($file_ext == "mp4") {
			$_POST['video_type'] 		= "mp4";
		} else {
			$_POST['video_type'] 		= "local";
		}

		$password = $_POST_DATA['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 ($c->requiredins == 1) {
			$_POST['video_id'] 		= $file_video_name;
			// check if we are reprocessing
			if ($c->reconvertflv == 0) {
				if ($file_ext == "flv") {
					$_POST['approved'] = "queuedforthumbnail";
				} else if ($file_ext == "swf") {
					$_POST['approved'] = "queuedforswf";
				} else if ($file_ext == "mp4") {
					$_POST['approved'] = "queuedformp4";
				} else {
					$_POST['approved'] = "queuedforconversion";
				}
			} else {
				if ($file_ext == "swf") {
					$_POST['approved'] = "queuedforswf";
				} else if ($file_ext == "mp4") {
					$_POST['approved'] = "queuedformp4";
				} else {
					$_POST['approved'] = "queuedforconversion";
				}
			}
		} else if ($c->requiredins == 0) {

			$originals_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS.'originals'.DS;
			$base_Dir = JPATH_SITE.DS.'hwdvideos'.DS.'uploads'.DS;

			if ($file_ext !== "flv" && $file_ext !== "mp4" && $file_ext !== "swf") {
				hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR04, "exclamation.png", 0);
				return;
			}

			if (!copy($originals_Dir.$file_name, $base_Dir.$file_video_id.".".strtolower($file_ext))) {

        		hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0);
				return;

			} else {

				if ($c->deleteoriginal == 1) {
					if (file_exists($base_Dir.$file_name)) {
						@unlink($originals_Dir.$file_name);
					}
				}

				if ($c->aav == 1) {
					$_POST['approved'] = "yes";
				} else {
					$_POST['approved'] = "pending";
				}
			}

			$_POST['video_id'] 		= $file_video_id;

		}

		//check if already exists
		$db->SetQuery( 'SELECT count(*)'
						. ' FROM #__hwdvidsvideos'
						. ' WHERE video_id = "'.$file_video_id.'"'
						);
		$duplicatecount = $db->loadResult();
		if ($duplicatecount > 0) {
        	hwd_vs_tools::infomessage(4, 0, _HWDVIDS_TITLE_UPLDFAIL, _HWDVIDS_ERROR_UPLDERR01, "exclamation.png", 0);
			return;
		}

		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);
	}