2013-10-07 12:17:06 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
**************************************************************
|
|
|
|
|
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
|
|
|
|
|
| @ Author : ArslanHassan
|
|
|
|
|
| @ Software : ClipBucket , <EFBFBD> PHPBucket.com
|
|
|
|
|
**************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once '../includes/admin_config.php';
|
2016-06-24 12:17:56 +05:00
|
|
|
|
require_once(dirname(dirname(__FILE__))."/includes/classes/sLog.php");
|
2013-10-07 12:17:06 +00:00
|
|
|
|
$userquery->admin_login_check();
|
|
|
|
|
$pages->page_redir();
|
2016-06-29 15:08:06 +05:00
|
|
|
|
global $Cbucket;
|
2016-09-17 12:42:01 +05:00
|
|
|
|
$delMassUpload = config('delete_mass_upload');
|
2014-01-27 11:30:36 +00:00
|
|
|
|
/* Assigning page and subpage */
|
|
|
|
|
if(!defined('MAIN_PAGE')){
|
|
|
|
|
define('MAIN_PAGE', 'Videos');
|
|
|
|
|
}
|
|
|
|
|
if(!defined('SUB_PAGE')){
|
2014-02-20 14:15:02 +00:00
|
|
|
|
define('SUB_PAGE', 'Mass Upload Videos');
|
2014-01-27 11:30:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-09 06:17:22 -08:00
|
|
|
|
global $cbvid;
|
|
|
|
|
$cats = $cbvid->get_categories();
|
|
|
|
|
$total_cats = count($cats);
|
2016-06-29 15:08:06 +05:00
|
|
|
|
$category_names = array();
|
|
|
|
|
for ($i=0; $i < $total_cats ; $i++) {
|
|
|
|
|
$category_values = $cats[$i]['category_id'];
|
|
|
|
|
$category_names[$category_values] = $cats[$i]['category_name'];
|
|
|
|
|
}
|
|
|
|
|
//pr($category_names,true);
|
|
|
|
|
assign("cats",$cats);
|
|
|
|
|
assign("cat_values",$category_values);
|
2016-03-09 06:17:22 -08:00
|
|
|
|
assign("total_cats",$total_cats);
|
2016-06-29 15:08:06 +05:00
|
|
|
|
|
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
|
if(isset($_POST['mass_upload_video']))
|
|
|
|
|
{
|
|
|
|
|
$files = $cbmass->get_video_files();
|
2014-12-04 14:14:19 +00:00
|
|
|
|
$vtitle=$_POST['title'];
|
2013-10-07 12:17:06 +00:00
|
|
|
|
$total = count($_POST['mass_up']);
|
|
|
|
|
for($i=0;$i<$total;$i++)
|
|
|
|
|
{
|
|
|
|
|
$file_key = time().RandomString(5);
|
|
|
|
|
$file_arr = $files[$i];
|
2016-06-29 15:08:06 +05:00
|
|
|
|
$file_path = $files[$i]['path'];
|
|
|
|
|
$file_orgname = $files[$i]['file'];
|
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
|
if($cbmass->is_mass_file($file_arr))
|
|
|
|
|
{
|
|
|
|
|
$code = $i+1;
|
|
|
|
|
//Inserting Video Data...
|
|
|
|
|
$array = array
|
|
|
|
|
(
|
|
|
|
|
'title' => $_POST['title'][$i],
|
|
|
|
|
'description' => $_POST['description'][$i],
|
|
|
|
|
'tags' => $_POST['tags'][$i],
|
|
|
|
|
'category' => $_POST['category'.$code],
|
|
|
|
|
'file_name' => $file_key,
|
|
|
|
|
);
|
|
|
|
|
$vid = $Upload->submit_upload($array);
|
|
|
|
|
}else{
|
|
|
|
|
e("\"".$file_arr['title']."\" is not available");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(error())
|
|
|
|
|
{
|
|
|
|
|
$error_lists[] = "Unable to upload \"".$file_arr['title']."\"";
|
|
|
|
|
$errors = error();
|
|
|
|
|
foreach($errors as $e)
|
|
|
|
|
$error_lists[] = $e;
|
|
|
|
|
|
|
|
|
|
$eh->flush_error();
|
|
|
|
|
}else{
|
|
|
|
|
e("\"".$file_arr['title']."\" Has been uploaded successfully","m");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($vid)
|
|
|
|
|
{
|
2014-12-04 14:14:19 +00:00
|
|
|
|
$dosleep=0;
|
2013-10-07 12:17:06 +00:00
|
|
|
|
//Moving file to temp dir and Inserting in conversion queue..
|
2016-06-24 12:17:56 +05:00
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
|
$file_name = $cbmass->move_to_temp($file_arr,$file_key);
|
2016-06-24 12:17:56 +05:00
|
|
|
|
$file_directory = createDataFolders();
|
|
|
|
|
createDataFolders(LOGS_DIR);
|
|
|
|
|
$logFile = LOGS_DIR.'/'.$file_directory.'/'.$file_key.'.log';
|
|
|
|
|
//pex($logFile,true);
|
|
|
|
|
$log = new SLog($logFile);
|
2014-12-04 14:14:19 +00:00
|
|
|
|
$results=$Upload->add_conversion_queue($file_name);
|
|
|
|
|
$str = "/".date("Y")."/".date("m")."/".date("d")."/";
|
|
|
|
|
$str1 = date("Y")."/".date("m")."/".date("d");
|
2016-06-29 00:52:30 -07:00
|
|
|
|
mkdir(FILES_DIR.'/videos'.$str);
|
2014-12-04 14:14:19 +00:00
|
|
|
|
$tbl=tbl("video");
|
|
|
|
|
$fields['file_directory']=$str1;
|
|
|
|
|
$fname=explode('.', $file_name);
|
|
|
|
|
$cond='file_name='.'\''.$fname[0].'\'';
|
|
|
|
|
$result=db_update($tbl, $fields, $cond);
|
2016-06-24 12:17:56 +05:00
|
|
|
|
$result=exec(php_path()." -q ".BASEDIR."/actions/video_convert.php {$file_name} {$file_key} {$file_directory} {$logFile} > /dev/null &");
|
2014-12-04 14:14:19 +00:00
|
|
|
|
if(file_exists(CON_DIR.'/'.$file_name))
|
|
|
|
|
{
|
|
|
|
|
unlink(CON_DIR.'/'.$file_name);
|
|
|
|
|
foreach ($vtitle as &$title)
|
|
|
|
|
{
|
2016-06-29 00:52:30 -07:00
|
|
|
|
$resul1=glob(FILES_DIR.'/videos/'.$title.".*");
|
2014-12-04 14:14:19 +00:00
|
|
|
|
unlink($resul1[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2016-09-17 12:42:01 +05:00
|
|
|
|
/*if($delMassUpload != 'no') {
|
|
|
|
|
if(!file_exists($file_path.'processedmass')){
|
2016-06-29 15:08:06 +05:00
|
|
|
|
$oldmask = umask(0);
|
|
|
|
|
mkdir($file_path.'processed', 0777);
|
|
|
|
|
umask($oldmask);
|
|
|
|
|
}
|
|
|
|
|
rename($file_path.$file_orgname, $file_path.'processed/'.$file_orgname);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
unlink($file_path.$file_orgname);
|
2016-09-17 12:42:01 +05:00
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
if ($delMassUpload != 'no') {
|
|
|
|
|
unlink($file_path.$file_orgname);
|
2016-06-29 15:08:06 +05:00
|
|
|
|
}
|
2013-10-07 12:17:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count($error_lists)>0)
|
|
|
|
|
{
|
|
|
|
|
foreach($error_lists as $e)
|
|
|
|
|
e($e);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-20 14:15:02 +00:00
|
|
|
|
//Collecting Data for Pagination
|
2014-12-04 07:46:40 +00:00
|
|
|
|
$limit = config('comments_per_page');
|
2014-02-20 14:15:02 +00:00
|
|
|
|
$total_rows=count($cbmass->get_video_files());
|
|
|
|
|
$total_pages = $total_rows/$limit;
|
|
|
|
|
$total_pages = round($total_pages+0.49,0);
|
|
|
|
|
$pages->paginate($total_pages,$page);
|
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
|
subtitle("Mass Uploader");
|
2014-02-20 14:15:02 +00:00
|
|
|
|
|
2013-10-07 12:17:06 +00:00
|
|
|
|
template_files("mass_uploader.html");
|
|
|
|
|
display_it();
|
|
|
|
|
?>
|