rendered paste body<?php
/*------------------------------------------+
| Video Manager for PHP-Fusion
| Version 0.1 beta
| By SoBeNoFear (www.gamingenergy.com)
+-------------------------------------------+
| Upload Utility (Encoding + Live Uploader)
| Version 0.0.1 alpha
+------------------------------------------*/
header('Content-type: text/html; charset=UTF-8');
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');
require_once "maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
require_once INCLUDES."videos/functions.php";
require_once (file_exists(LOCALESET."videos.php") ? LOCALESET."videos.php" : LOCALE."English/videos.php");
if(iMEMBER){
if(isset($_REQUEST['tmp_sid']) && strlen($_REQUEST['tmp_sid']) == 32){
require_once BASEDIR."uu_conlib.php";
$THIS_VERSION = "4.0";
$temp_dir = $_REQUEST['temp_dir'];
$_POST_DATA = getPostData($temp_dir, $_REQUEST['tmp_sid']);
foreach($_POST_DATA as $post_key => $post_value){
if(preg_match("/^upfile_/i", $post_key)){
$uploaded_file_name = $post_value;
$uploaded_file_path = $_POST_DATA['upload_dir'] . $uploaded_file_name;
if(is_file($uploaded_file_path)){
$file_size = @filesize($uploaded_file_path);
} //end if(is_file...
} //end if(preg_match...
if($post_key == "vid"){
$videoID = $post_value;
}
} //end foreach($_POST_DATA...
echo $uploaded_file_name."<br />".$uploaded_file_path;
function converttoflv( $in, $out ){
@unlink( $out );
$cmd = "ffmpeg -v 0 -i $in -ar 11025 $out 2>&1";
$fh = popen( $cmd, "r" );
while( fgets( $fh ) ) { }
pclose( $fh );
}
function getthumbnail( $in, $out ){
@unlink( $out );
$cmd = "ffmpeg -i $in -pix_fmt rgb24 -vframes 1 -s 320x480 $out 2>&1";
$fh = popen( $cmd, "r" );
while( fgets( $fh ) ) { }
pclose( $fh );
}
function flv_import( $upfile, $fname ){
$fname = preg_replace( '/\..*$/', '', basename( $fname ) );
$flvpath = "$fname.flv";
$thumbpath = "$fname.gif";
converttoflv( $upfile, "uploads/".$flvpath );
getthumbnail( $upfile, "uploads/".$thumbpath );
}
flv_import( $uploaded_file_path, $videoID );
$result = dbquery("UPDATE ".$db_prefix."videos SET video_activated='1' WHERE video_id='$videoID'");
} elseif(isset($_POST['goStep2'])){
$error = "";
$title = addslashes(stripinput($_POST['title']));
$description = addslashes(stripinput($_POST['description']));
$tags = addslashes(stripinput($_POST['tags']));
$cat_id = (isNum($_POST['cat_id']) ? $_POST['cat_id'] : "1");
$comments = (isNum($_POST['allow_comments']) ? $_POST['allow_comments'] : "1");
$ratings = (isNum($_POST['allow_ratings']) ? $_POST['allow_ratings'] : "1");
if($title == ""){ $error .= $locale['error100']."<br />\n"; }
if($description == ""){ $error .= $locale['error101']."<br />\n"; }
if($tags == ""){ $error .= $locale['error102']."<br />\n"; }
if($error == ""){
$videoID = randomKey(8);
$result = dbquery("INSERT INTO ".$db_prefix."videos (cat_id, video_id, video_title, video_description, video_tags, video_file, video_thumb, video_owner, video_timestamp, video_views, video_activated, video_comments, video_ratings) VALUES('$cat_id', '$videoID', '$title', '$description', '$tags', '".$videoID.".flv', '".$videoID.".gif', '".$userdata['user_id']."', '".time()."', '0', '0', '$comments', '$ratings')");
/* UberUpload Script */
require_once BASEDIR."uu_conlib.php";
$THIS_VERSION = "2.3";
$tmp_sid = md5(uniqid(mt_rand(), true));
$config_file = $default_config_file;
$path_to_upload_script .= '?tmp_sid=' . $tmp_sid;
$path_to_ini_status_script .= '?tmp_sid=' . $tmp_sid;
?>
<style>
.info {font:18px Arial;}
.data {background-color:#b3b3b3; border:1px solid #898989; width:40%;}
.data tr td {background-color:#dddddd; font:13px Arial; width:35%;}
.bar1 {background-color:#b3b3b3; position:relative; text-align:left; height:20px; width:<? print $progress_bar_width; ?>px; border:1px solid #505050;}
.bar2 {background-color:#000099; position:relative; text-align:left; height:20px; width:0%;}
</style>
<script language="javascript" type="text/javascript" src="uu_file_upload.js"></script>
<script language="javascript" type="text/javascript">
var path_to_ini_status_script = "<? print $path_to_ini_status_script; ?>";
var check_file_name_format = <? print $check_file_name_format; ?>;
var check_disallow_extensions = <? print $check_disallow_extensions; ?>;
<? if($check_disallow_extensions){ print "var disallow_extensions = $disallow_extensions;\n"; } ?>
var check_allow_extensions = <? print $check_allow_extensions; ?>;
<? if($check_allow_extensions){ print "var allow_extensions = $allow_extensions;\n"; } ?>
var check_null_file_count = <? print $check_null_file_count; ?>;
var check_duplicate_file_count = <? print $check_duplicate_file_count; ?>;
var max_upload_slots = <? print $max_upload_slots; ?>;
var cedric_progress_bar = <? print $cedric_progress_bar; ?>;
var progress_bar_width = <? print $progress_bar_width; ?>;
</script>
<? print "<!-- TMP_SID: $tmp_sid -->\n"; ?>
<div align="center">
<br>
<!-- Start Progress Bar -->
<div class="info" id="progress_info"></div>
<div id="progress_bar" style="display:none">
<div class="bar1" id="upload_status_wrap" align="center">
<div class="bar2" id="upload_status"></div>
</div>
<br>
<table class="data" cellpadding='3' cellspacing='1'>
<tr>
<td align="left"><b>Percent Complete:</b></td>
<td align="center"><span id="percent">0%</span></td>
</tr>
<tr>
<td><b>Files Uploaded:</b></td>
<td align="center"><span id="uploaded_files">0</span> of <span id="total_uploads"></span></td>
</tr>
<tr>
<td align="left"><b>Current Position:</b></td>
<td align="center"><span id="current">0</span> / <span id="total_kbytes"></span> KBytes</td>
</tr>
<tr>
<td align="left"><b>Elapsed time:</b></td>
<td align="center"><span id="time">0</span></td>
</tr>
<tr>
<td align="left"><b>Est Time Left:</b></td>
<td align="center"><span id="remain">0</span></td>
</tr>
<tr>
<td align="left"><b>Est Speed:</b></td>
<td align="center"><span id="speed">0</span> KB/s.</td>
</tr>
</table>
</div>
<!-- End Progress Bar -->
<? if($embedded_upload_results){ ?>
<!-- Embedded Upload Results -->
<div id="upload_div" style="display:none; width:805; height:205; overflow:auto;"><iframe name="upload_iframe" frameborder=0 width="800" height="200"></iframe></div>
<? } ?>
<br>
<!-- Start Upload Form -->
<form name="form_upload" <? if($embedded_upload_results){ ?>target="upload_iframe"<? } ?> method="post" enctype="multipart/form-data" action="<? print $path_to_upload_script; ?>" style="margin: 0px; padding: 0px;">
<? if($embedded_upload_results){ ?><input type="hidden" name="embedded_upload_results" value="1"><? } ?>
<input type="hidden" name="vid" value="<? echo $videoID; ?>" />
<noscript><input type="hidden" name="no_script" value="1"></noscript>
<!-- Include extra values you want passed to the upload script here. -->
<!-- eg. <input type="text" name="employee_num" value="5"> -->
<!-- Access the value in the cgi with $query->param('employee_num'); -->
<!-- Access the value in the php finished page with $_POST_DATA['employee_num']; -->
<!-- DO NOT USE "upfile_" for any of your values. -->
<div id="upload_slots">
<input type="file" name="upfile_0" size="90" <? /*if($multi_upload_slots){ ?>onChange="addUploadSlot(1)"<? }*/ ?> onkeypress="return handleKey(event)" value="">
</div>
<noscript><br><input type="reset" name="no_script_reset" value="Reset"> <input type="submit" name="no_script_submit" value="Upload"></noscript>
</form>
<!-- End Upload Form -->
<br>
<script language="javascript" type="text/javascript">
<!--
document.writeln('<input type="button" name="reset_button" value="Reset" onClick="resetForm();"> <input type="button" id="upload_button" name="upload_button" value="Upload" onClick="uploadFiles();">');
//-->
</script>
</div>
<?php
} else {
opentable($locale['upload100']);
echo "<div align='center'>".$error."<br />
<a href='".FUSION_SELF."'>".$locale['error103']."</a>
</div>";
closetable();
} // end if($error = ""...
} else {
opentable($locale['upload100']);
$cat_list = "";
$result = dbquery("SELECT * FROM ".$db_prefix."video_cats ORDER BY cat_title");
while($data = dbarray($result)){
$cat_list .= "<option value='".$data['cat_id']."'>".$data['cat_title']."</option>\n";
}
echo "<form name='uploadForm' action='".FUSION_SELF."' method='POST'>
<table width='375' cellspacing='1' cellpadding='1' class='tbl-border' align='center'>
<tr>
<td class='tbl2' colspan='2' align='center'>
<span style='font-weight:bold;'>[".$locale['upload110']."]</span>
</td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; width:36%; font-weight:bold;'>".$locale['upload101']."</td>
<td class='tbl1'><input type='text' name='title' class='textbox' style='width:150px;'></td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; font-weight:bold;'>".$locale['upload102']."</td>
<td class='tbl1'><textarea name='description' class='textbox' style='width:150px;'></textarea></td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; font-weight:bold;'>".$locale['upload103']."</td>
<td class='tbl1'><input type='text' name='tags' class='textbox' style='width:150px;'><br />
<span style='font-size:9px; font-weight:bold;'>".$locale['upload104']."</span></td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; font-weight:bold;'>".$locale['upload105']."</td>
<td class='tbl1'><select name='cat_id' class='textbox' style='width:150px;'>\n$cat_list</select></td>
</tr>
<tr>
<td class='tbl2' colspan='2' align='center'>
<span style='font-weight:bold;'>[".$locale['upload106']."]</span>
</td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; font-weight:bold;'>".$locale['upload107']."</td>
<td class='tbl1'><input type='checkbox' name='allow_comments' value='1' CHECKED></td>
</tr>
<tr>
<td class='tbl1' style='text-align:right; font-weight:bold;'>".$locale['upload108']."</td>
<td class='tbl1'><input type='checkbox' name='allow_rating' value='1' CHECKED></td>
</tr>
<tr>
<td class='tbl2' colspan='2' align='center'>
<input type='submit' name='goStep2' class='button' value='".$locale['upload109']."'>
</td>
</tr>
</table>
</form>";
closetable();
} // end if(isset($_REQUEST['tmp_sid']...
} else {
opentable("Members-Only");
echo "Sorry, only members past this point";
closetable();
} //end if(iMEMBER...
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>