feat: Add comprehensive documentation suite and reorganize project structure

- Created complete documentation in docs/ directory
- Added PROJECT_OVERVIEW.md with feature highlights and getting started guide
- Added ARCHITECTURE.md with system design and technical details
- Added SECURITY.md with comprehensive security implementation guide
- Added DEVELOPMENT.md with development workflows and best practices
- Added DEPLOYMENT.md with production deployment instructions
- Added API.md with complete REST API documentation
- Added CONTRIBUTING.md with contribution guidelines
- Added CHANGELOG.md with version history and migration notes
- Reorganized all documentation files into docs/ directory for better organization
- Updated README.md with proper documentation links and quick navigation
- Enhanced project structure with professional documentation standards
This commit is contained in:
SamiAhmed7777
2025-10-21 00:39:45 -07:00
commit 0b7e2d0a5b
6080 changed files with 1332936 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.browse');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('file_counts,file_comments,channel_comments,file_comment_votes,file_promo,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$browse = new VBrowse;
$vfiles = new VFiles;
if ((int) $_GET["p"] >= 0 or (int) $_GET["vm"] >= 0) {
//viewmode changer/loader
$view_mode = isset($_GET["m"]) ? (int) $_GET["m"] : (int) $_GET["vm"];
switch ($view_mode) {
case "1":
case "2":
case "3":
$t = VBrowse::browseType();
$t = $t == 'document' ? 'doc' : $t;
$v = (int) $_GET["p"] == 1 ? 'pvm' : 'vm';
$_SESSION[$t . "_" . $v] = $view_mode;
echo $html = isset($_GET["m"]) ? VBrowse::viewMode_loader($view_mode) : null;
break;
}
}
if (isset($_GET["a"])) {
switch ($_GET["a"]) {
//user menu actions
case "cb-watchadd": //add to watchlist
$cb_action = $cfg["file_watchlist"] == 1 ? VFiles::doActions($_GET["a"]) : null;
break;
}
}
if (!isset($_GET["s"]) and !isset($_GET["do"]) and !isset($_GET["p"]) and !isset($_GET["a"])) {
$section_check = VBrowse::browseInit();
$section = VHref::getKey("browse");
$smarty->assign('c_section', $section);
$display_page = $class_smarty->displayPage('frontend', 'tpl_browse', $error_message, $notice_message);
}

View File

@@ -0,0 +1,137 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class_thumb/ThumbLib.inc.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_settings` WHERE `cfg_name` LIKE '%conversion_%' OR `cfg_name` LIKE '%server_%' OR `cfg_name` LIKE '%thumb%' OR `cfg_name`='log_audio_conversion' OR `cfg_name`='file_approval' OR `cfg_name`='user_subscriptions' OR `cfg_name`='conversion_audio_que' OR `cfg_name`='conversion_source_audio' OR `cfg_name`='conversion_audio_previews';");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2])) {
$file_key = $class_filter->clr_str($_SERVER['argv'][1]);
$user_key = $class_filter->clr_str($_SERVER['argv'][2]);
$file_name = html_entity_decode($class_database->singleFieldValue('db_audiofiles', 'file_name', 'file_key', $file_key), ENT_QUOTES, 'UTF-8');
$src_folder = $cfg["upload_files_dir"] . '/' . $user_key . '/a/';
$dst_folder = $cfg["media_files_dir"] . '/' . $user_key . '/a/';
$src = $src_folder . $file_name;
if (file_exists($src) && is_file($src)) {
$conv = new VAudio();
$conv->log_setup($file_key, ($cfg["log_audio_conversion"] == 1 ? true : false));
if ($conv->load($src)) {
$format = strtolower(substr($file_name, -3));
$conv->log("Loading audio: " . $src . "\n" . $conv->get_data_string() . "\n");
$mp3_full_processed = false;
$mp3_prev_processed = false;
$dst_mp3_full = $dst_folder . gs($file_key) . '.mp3';
$dst_mp3_prev = $dst_folder . $file_key . '.mp3';
$eid = gs($file_key);
$pvl = 30;
$li = "---------------------------------------------";
$ls = "\n\n" . $li . "\n";
$le = "\n" . $li . "\n";
$conv->log($ls . 'Starting MP3 conversion!' . $le);
if ($format == 'mp3' and $cfg['conversion_mp3_redo'] == 1) {
if ($cfg["conversion_audio_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp3($src, $file_key, $user_key, 1)) {
$conv->log($ls . 'Creating preview ' . $src . ' to ' . $dst_mp3_prev . $le);
$mp3_prev_processed = true;
}
$conv->log($ls . 'Copying ' . $src . ' to ' . $dst_mp3_full . $le);
copy($src, $dst_mp3_full);
$mp3_copy = true;
$mp3_full_processed = true;
} else {
if ($cfg["conversion_audio_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp3($src, $file_key, $user_key, 1)) {
$mp3_prev_processed = true;
}
if ($conv->convert_to_mp3($src, $file_key, $user_key)) {
$mp3_full_processed = true;
}
}
if ($mp3_full_processed === true) {
$conv->log($ls . 'Starting AAC conversion!' . $le);
if ($cfg["conversion_audio_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_aac($src, $file_key, $user_key, 1)) {
}
if ($conv->convert_to_aac($src, $file_key, $user_key)) {
}
}
if ($mp3_full_processed === true) {
$is_hd = 0;
$is_mobile = 1;
$is_pv = $mp3_prev_processed ? 1 : 0;
$conv->log($ls . 'Creating large audio thumbnail (640x480)' . $le);
$thumbs = $conv->create_thumbs(0, $file_key, $user_key);
$conv->log($ls . 'Creating small audio thumbnail (320x240)' . $le);
$thumbs = $conv->create_thumbs(1, $file_key, $user_key);
$sql = sprintf("UPDATE `db_audiofiles` SET `has_preview`='%s', `file_mobile`='%s', `file_hd`='%s', `file_duration`='%s' WHERE `file_key`='%s' LIMIT 1;", $is_pv, $is_mobile, $is_hd, (float) $conv->data['duration_seconds'], $file_key);
$conv->log($ls . "Executing update query: " . $sql . $le);
$db->query($sql);
if ($db->affected_rows()) {
$conv->log($ls . 'Database data updated!' . $le);
if ($cfg["conversion_source_audio"] == 0) {
$conv->log($ls . 'Deleting source audio ' . $src . $le);
VFileinfo::doDelete($src);
}
if ($cfg["conversion_audio_que"] == 1) {
$que = sprintf("UPDATE `db_audioque` SET `state`='2', `end_time`='%s' WHERE `file_key`='%s' AND `usr_key`='%s' AND `state`='1' LIMIT 1;", date("Y-m-d H:i:s"), $file_key, $user_key);
$db->query($que);
if ($cfg["file_approval"] == 0) {
$act = sprintf("UPDATE `db_audiofiles` SET `approved`='1' WHERE `file_key`='%s' LIMIT 1;", $file_key);
$db->execute($act);
}
}
/* admin and subscribers notification */
$db_approved = ($cfg["file_approval"] == 1 ? 0 : 1);
$type = 'audio';
$usr_id = $class_database->singleFieldValue('db_' . $type . 'files', 'usr_id', 'file_key', $file_key);
$notify = $db_approved == 1 ? VUpload::notifySubscribers($usr_id, $type, $file_key, '', $user_key) : VUpload::notifySubscribers(0, $type, $file_key, '', $user_key);
$conv->log_clean = true;
} else {
$conv->log($ls . 'Failed to execute audio update query!' . $le);
}
}
} else {
$conv->log($ls . 'Failed to load audio: ' . $src . $le);
}
}
}
function gs($k)
{global $cfg;return md5($cfg["global_salt_key"] . $k);}

View File

@@ -0,0 +1,118 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class_thumb/ThumbLib.inc.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_settings` WHERE `cfg_name` LIKE '%conversion_%' OR `cfg_name` LIKE '%server_%' OR `cfg_name` LIKE '%thumb%' OR `cfg_name`='file_approval' OR `cfg_name`='user_subscriptions' OR `cfg_name`='conversion_document_que' OR `cfg_name`='conversion_source_doc' OR `cfg_name`='conversion_doc_previews';");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2])) {
$doc_id = $class_filter->clr_str($_SERVER['argv'][1]);
$user_key = $class_filter->clr_str($_SERVER['argv'][2]);
$file_name = html_entity_decode($class_database->singleFieldValue('db_docfiles', 'file_name', 'file_key', $doc_id), ENT_QUOTES, 'UTF-8');
$src_folder = $cfg["upload_files_dir"] . '/' . $user_key . '/d/';
$dst_folder = $cfg["media_files_dir"] . '/' . $user_key . '/d/';
$dst_folder_tmb = $cfg["media_files_dir"] . '/' . $user_key . '/t/' . $doc_id . '/';
$src = $src_folder . $file_name;
if (file_exists($src) && is_file($src)) {
$conv = new VDocument();
$conv->log_setup($doc_id, ($cfg["log_doc_conversion"] == 1 ? true : false));
if ($conv->load($src)) {
$conv->log("Loading document: " . $src . "\n");
$db_q = null;
$pdf_processed_full = false;
$pdf_processed_prev = false;
$swf_processed = false;
$eid = gs($doc_id);
$li = "---------------------------------------------";
$ls = "\n\n" . $li . "\n";
$le = "\n" . $li . "\n";
$conv->log($ls . 'Starting PDF conversion!' . $le);
if ($cfg["conversion_doc_previews"] == 1 and $conv->convert_to_pdf($src, $doc_id, $user_key, 1)) {
$pdf_processed_prev = true;
$db_q .= ", `has_preview`='1'";
}
if ($conv->convert_to_pdf($src, $doc_id, $user_key)) {
$pdf_processed_full = true;
$db_q .= ", `file_pdf`='1'";
}
if ($cfg["conversion_pdf2swf_bypass"] == 0) {
$conv->log($ls . 'Starting SWF conversion!' . $le);
if ($conv->convert_to_swf($doc_id, $user_key)) {
$swf_processed = true;
$db_q .= ", `file_swf`='1'";
}
} else {
$conv->log($ls . 'Not converting to SWF. Disabled in admin!' . $le);
}
if ($pdf_processed_full === true) {
$conv->log($ls . 'Creating small document thumbnail (320x240)' . $le);
if ($conv->createThumbs_ffmpeg($dst_folder_tmb, 1, 320, 240, $doc_id, $user_key)) {
$thumbnails = true;
}
$conv->log($ls . 'Creating large document thumbnail (640x480)' . $le);
if ($conv->createThumbs_ffmpeg($dst_folder_tmb, 0, 640, 480, $doc_id, $user_key)) {
$thumbnails = true;
}
}
if ($pdf_processed_full === true and $thumbnails === true) {
$sql = sprintf("UPDATE `db_docfiles` SET `file_mobile`='1', `file_hd`='0' %s WHERE `file_key`='%s' LIMIT 1;", $db_q, $doc_id);
$conv->log($ls . "Executing update query: " . $sql . $le);
$db->query($sql);
if ($cfg["conversion_document_que"] == 1) {
$db->query(sprintf("UPDATE `db_docque` SET `state`='2', `end_time`='%s' WHERE `file_key`='%s' AND `usr_key`='%s' AND `state`='1' LIMIT 1;", date("Y-m-d H:i:s"), $doc_id, $user_key));
if ($cfg["file_approval"] == 0) {
$db->query(sprintf("UPDATE `db_docfiles` SET `approved`='1' WHERE `file_key`='%s' LIMIT 1;", $doc_id));
}
}
/* admin and subscribers notification */
$db_approved = ($cfg["file_approval"] == 1 ? 0 : 1);
$type = 'doc';
$usr_id = $class_database->singleFieldValue('db_' . $type . 'files', 'usr_id', 'file_key', $doc_id);
$notify = $db_approved == 1 ? VUpload::notifySubscribers($usr_id, $type, $doc_id, '', $user_key) : VUpload::notifySubscribers(0, $type, $doc_id, '', $user_key);
}
if ($cfg['conversion_source_doc'] == 0) {
VFileinfo::doDelete($src);
}
}
} else {
exit;
}
}
function gs($k)
{global $cfg;return md5($cfg["global_salt_key"] . $k);}

View File

@@ -0,0 +1,104 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class_thumb/ThumbLib.inc.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_settings` WHERE `cfg_name` LIKE '%conversion_%' OR `cfg_name` LIKE '%server_%' OR `cfg_name` LIKE '%thumb%' OR `cfg_name`='file_approval' OR `cfg_name`='user_subscriptions' OR `cfg_name`='conversion_image_que' OR `cfg_name`='conversion_source_image' OR `cfg_name`='conversion_image_previews';");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2])) {
$image_id = $class_filter->clr_str($_SERVER['argv'][1]);
$user_key = $class_filter->clr_str($_SERVER['argv'][2]);
$file_name = html_entity_decode($class_database->singleFieldValue('db_imagefiles', 'file_name', 'file_key', $image_id), ENT_QUOTES, 'UTF-8');
$src_folder = $cfg["upload_files_dir"] . '/' . $user_key . '/i/';
$dst_folder = $cfg["media_files_dir"] . '/' . $user_key . '/i/';
$dst_folder_tmb = $cfg["media_files_dir"] . '/' . $user_key . '/t/' . $image_id . '/';
$src = $src_folder . $file_name;
$tmp_dir = $cfg["media_files_dir"] . '/' . $user_key . '/t/' . $image_id . '/out/';
if (!is_dir($dst_folder_tmb)) {
@mkdir($dst_folder_tmb);
}
if (!is_dir($tmp_dir)) {
@mkdir($tmp_dir);
}
if (file_exists($src) && is_file($src)) {
$th_large = false;
$th_prev = false;
$conv = new VImage();
$conv->log_setup($image_id, ($cfg["log_image_conversion"] == 1 ? true : false));
list($width, $height) = getimagesize($src);
if ($cfg["conversion_image_type"] == 3) {
$width = $width >= $cfg["conversion_image_from_w"] ? $cfg["conversion_image_to_w"] : $width;
$height = $height >= $cfg["conversion_image_from_h"] ? $cfg["conversion_image_to_h"] : $height;
}
if ($cfg["conversion_image_previews"] == 1) {
$th_prev = true;
if ($conv->createThumbs_ffmpeg($src, $dst_folder, $image_id, 640, 480, $image_id, $user_key)) {
}
}
if ($conv->createThumbs($src, $dst_folder, gs($image_id), $width, $height)) {
$th_large = true;
}
if ($conv->createThumbs_ffmpeg($src, $dst_folder_tmb, 1, 320, 240, $image_id, $user_key)) {
$th_small = true;
}
if ($conv->createThumbs_ffmpeg($src, $dst_folder_tmb, 0, 640, 480, $image_id, $user_key)) {
$th_mid = true;
}
if ($th_large === true) {
$ani = $conv->is_ani($src) ? 1 : 0;
$db->query(sprintf("UPDATE `db_imagefiles` SET %s `file_mobile`='1', `file_hd`='%s' WHERE `file_key`='%s' LIMIT 1;", ($th_prev === true ? "`has_preview`='1'," : null), $ani, $image_id));
if ($cfg["conversion_image_que"] == 1) {
$db->query(sprintf("UPDATE `db_imageque` SET `state`='2', `end_time`='%s' WHERE `file_key`='%s' AND `usr_key`='%s' AND `state`='1' LIMIT 1;", date("Y-m-d H:i:s"), $image_id, $user_key));
if ($cfg["file_approval"] == 0) {
$db->query(sprintf("UPDATE `db_imagefiles` SET `approved`='1' WHERE `file_key`='%s' LIMIT 1;", $image_id));
}
}
/* admin and subscribers notification */
$db_approved = ($cfg["file_approval"] == 1 ? 0 : 1);
$type = 'image';
$usr_id = $class_database->singleFieldValue('db_' . $type . 'files', 'usr_id', 'file_key', $image_id);
$notify = $db_approved == 1 ? VUpload::notifySubscribers($usr_id, $type, $image_id, '', $user_key) : VUpload::notifySubscribers(0, $type, $image_id, '', $user_key);
}
if ($cfg['conversion_source_image'] == 0) {
VFileinfo::doDelete($src);
}
} else {
exit;
}
}
function gs($k)
{global $cfg;return md5($cfg["global_salt_key"] . $k);}

View File

@@ -0,0 +1,177 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once 'f_core/f_classes/class_moovrelocator/moovrelocator.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
$flv_formats = array('flv', 'vp3', 'vp5', 'vp6', 'vp6a', 'vp6f');
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_settings` WHERE
`cfg_name` LIKE '%server_%' OR
`cfg_name` LIKE '%thumb%' OR
`cfg_name`='log_short_conversion' OR
`cfg_name`='file_approval' OR
`cfg_name`='user_subscriptions' OR
`cfg_name`='conversion_short_que' OR
`cfg_name`='conversion_short_previews' OR
`cfg_name`='conversion_source_short';
");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_conversion`;");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2])) {
$video_id = $class_filter->clr_str($_SERVER['argv'][1]);
$user_key = $class_filter->clr_str($_SERVER['argv'][2]);
$file_name = html_entity_decode($class_database->singleFieldValue('db_shortfiles', 'file_name', 'file_key', $video_id), ENT_QUOTES, 'UTF-8');
$src_folder = $cfg["upload_files_dir"] . '/' . $user_key . '/s/';
$dst_folder = $cfg["media_files_dir"] . '/' . $user_key . '/s/';
$src = $src_folder . $file_name;
if (file_exists($src) && is_file($src)) {
$conv = new VVideo();
$conv->log_setup($video_id, ($cfg["log_short_conversion"] == 1 ? true : false));
if ($conv->load($src)) {
$conv->log("Loading video short: " . $src . "\n" . $conv->get_data_string() . "\n");
$flv_360p_processed = false;
$flv_480p_processed = false;
$li = "---------------------------------------------";
$ls = "\n\n" . $li . "\n";
$le = "\n" . $li . "\n";
$mp4_short_full_processed = false;
$mp4_short_prev_processed = false;
$eid = gs($video_id);
$pvl = 7;
$cfg['conversion_mp4_short_active'] = 1;
/* MP4/short */
if ($cfg['conversion_mp4_short_active'] == '1') {
$conv->log($ls . 'Starting MP4/shortvideo conversion!' . $le);
$dst_mp4_nomov_prev = $dst_folder . $video_id . '.short.nomov.mp4';
$dst_mp4_nomov_full = $dst_folder . $eid . '.short.nomov.mp4';
if ($conv->convert_to_mp4_short($src, $dst_mp4_nomov_full, '', 'short')) {
$mp4_short_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to MP4/short (disabled in admin)!' . $le);
}
if ($mp4_short_prev_processed === true) {
$conv->log($ls . 'MP4/shortvideo Preview Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $video_id . '.short.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_prev, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_prev, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_prev);
}
}
if ($mp4_short_full_processed === true) {
$conv->log($ls . 'MP4/shortvideo Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $eid . '.short.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_full, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_full, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_full);
}
}
$conv->log($ls . 'Extracting large thumbnail (360x640)' . $le);
$thumbs = $conv->extract_thumbs_short(array($dst_mp4, 'thumb'), $video_id, $user_key);
$cfg["thumbs_width"] = 180;
$cfg["thumbs_height"] = 320;
$conv->log($ls . 'Extracting smaller thumbnails (' . $cfg["thumbs_width"] . 'x' . $cfg["thumbs_height"] . ')' . $le);
$thumbs = $conv->extract_thumbs_short($dst_mp4, $video_id, $user_key);
$is_hd = 1;
$is_mobile = 1;
if ($mp4_short_full_processed) {
$_sfp = $dst_folder . md5($cfg["global_salt_key"] . $video_id) . '.short.mp4';
$previews = $conv->extract_preview_thumbs_short($_sfp, $video_id, $user_key, 1);
}
$is_fp = $mp4_short_prev_processed ? 1 : 0;
$vpv = file_exists($cfg["media_files_dir"] . "/" . $user_key . "/s/" . md5($video_id . "_preview") . ".mp4");
//upload to another server here
$duration = (float) $conv->data['duration_seconds'];
$duration = $duration > 60 ? 60 : $duration;
$sql = sprintf("UPDATE `db_shortfiles` SET `has_preview`='%s', `thumb_preview`='%s', `file_mobile`='%s', `file_hd`='%s', `file_duration`='%s' WHERE `file_key`='%s' LIMIT 1;", $is_fp, (int) $vpv, $is_mobile, $is_hd, $duration, $video_id);
$conv->log($ls . "Executing update query: " . $sql . $le);
$db->query($sql);
if (!$db->Affected_Rows()) {
require 'f_core/config.database.php';
$db = &ADONewConnection($cfg_dbtype);
if (!$db->Connect($cfg_dbhost, $cfg_dbuser, $cfg_dbpass, $cfg_dbname)) {
$conv->log($ls . 'Failed database connection, reconnecting!' . $le);
}
$db->query($sql);
}
if ($db->Affected_Rows()) {
$conv->log($ls . 'Database data updated!' . $le);
if ($cfg["conversion_source_short"] == 0 and (file_exists($dst_folder . $video_id . '.short.mp4') or file_exists($dst_folder . md5($cfg["global_salt_key"] . $video_id) . '.short.mp4'))) {
$conv->log($ls . 'Deleting source video short ' . $src . $le);
VFileinfo::doDelete($src);
}
if ($cfg["conversion_short_que"] == 1) {
$que = sprintf("UPDATE `db_shortque` SET `state`='2', `end_time`='%s' WHERE `file_key`='%s' AND `usr_key`='%s' AND `state`='1' LIMIT 1;", date("Y-m-d H:i:s"), $video_id, $user_key);
$db->execute($que);
if ($cfg["file_approval"] == 0) {
$act = sprintf("UPDATE `db_shortfiles` SET `approved`='1' WHERE `file_key`='%s' LIMIT 1;", $video_id);
$db->execute($act);
}
}
/* admin and subscribers notification */
$db_approved = ($cfg["file_approval"] == 1 ? 0 : 1);
$type = 'short';
$usr_id = $class_database->singleFieldValue('db_' . $type . 'files', 'usr_id', 'file_key', $video_id);
$notify = $db_approved == 1 ? VUpload::notifySubscribers($usr_id, $type, $video_id, '', $user_key) : VUpload::notifySubscribers(0, $type, $video_id, '', $user_key);
$conv->log_clean = true;
} else {
$conv->log($ls . 'Failed to execute video short update query!' . $le);
}
} else {
$conv->log($ls . 'Failed to load video short: ' . $src . $le);
}
}
}
function gs($k)
{
global $cfg;
return md5($cfg["global_salt_key"] . $k);
}

View File

@@ -0,0 +1,434 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once 'f_core/f_classes/class_moovrelocator/moovrelocator.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
$flv_formats = array('flv', 'vp3', 'vp5', 'vp6', 'vp6a', 'vp6f');
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_settings` WHERE
`cfg_name` LIKE '%server_%' OR
`cfg_name` LIKE '%thumb%' OR
`cfg_name`='log_video_conversion' OR
`cfg_name`='file_approval' OR
`cfg_name`='user_subscriptions' OR
`cfg_name`='conversion_video_que' OR
`cfg_name`='conversion_video_previews' OR
`cfg_name`='conversion_source_video';");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
$rs = $db->execute("SELECT `cfg_name`, `cfg_data` FROM `db_conversion`;");
while (!$rs->EOF) {
$cfg[$rs->fields["cfg_name"]] = $rs->fields["cfg_data"];
@$rs->MoveNext();
}
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2])) {
$video_id = $class_filter->clr_str($_SERVER['argv'][1]);
$user_key = $class_filter->clr_str($_SERVER['argv'][2]);
$file_name = html_entity_decode($class_database->singleFieldValue('db_videofiles', 'file_name', 'file_key', $video_id), ENT_QUOTES, 'UTF-8');
$src_folder = $cfg["upload_files_dir"] . '/' . $user_key . '/v/';
$dst_folder = $cfg["media_files_dir"] . '/' . $user_key . '/v/';
$src = $src_folder . $file_name;
if (file_exists($src) && is_file($src)) {
$conv = new VVideo();
$conv->log_setup($video_id, ($cfg["log_video_conversion"] == 1 ? true : false));
if ($conv->load($src)) {
$conv->log("Loading video: " . $src . "\n" . $conv->get_data_string() . "\n");
$flv_360p_processed = false;
$flv_480p_processed = false;
$li = "---------------------------------------------";
$ls = "\n\n" . $li . "\n";
$le = "\n" . $li . "\n";
$mp4_360p_full_processed = false;
$mp4_360p_prev_processed = false;
$mp4_480p_full_processed = false;
$mp4_480p_prev_processed = false;
$mp4_720p_full_processed = false;
$mp4_720p_prev_processed = false;
$mp4_1080p_full_processed = false;
$mp4_1080p_prev_processed = false;
$eid = gs($video_id);
$pvl = 30;
/* MP4/360p */
if ($cfg['conversion_mp4_360p_active'] == '1') {
$conv->log($ls . 'Starting MP4/360p conversion!' . $le);
$dst_mp4_nomov_prev = $dst_folder . $video_id . '.360p.nomov.mp4';
$dst_mp4_nomov_full = $dst_folder . $eid . '.360p.nomov.mp4';
if ($cfg["conversion_video_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp4($src, $dst_mp4_nomov_prev, true, '360p')) {
$mp4_360p_prev_processed = true;
}
if ($conv->convert_to_mp4($src, $dst_mp4_nomov_full, '', '360p')) {
$mp4_360p_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to MP4/360p (disabled in admin)!' . $le);
}
if ($mp4_360p_prev_processed === true) {
$conv->log($ls . 'MP4/360p Preview Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $video_id . '.360p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_prev, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_prev, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_prev);
}
}
if ($mp4_360p_full_processed === true) {
$conv->log($ls . 'MP4/360p Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $eid . '.360p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_full, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_full, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_full);
}
}
/* MP4/480p */
if ($cfg['conversion_mp4_480p_active'] == '1') {
$conv->log($ls . 'Starting MP4/480p conversion!' . $le);
$dst_mp4_nomov_prev = $dst_folder . $video_id . '.480p.nomov.mp4';
$dst_mp4_nomov_full = $dst_folder . $eid . '.480p.nomov.mp4';
if ($cfg["conversion_video_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp4($src, $dst_mp4_nomov_prev, true, '480p')) {
$mp4_480p_prev_processed = true;
}
if ($conv->convert_to_mp4($src, $dst_mp4_nomov_full, '', '480p')) {
$mp4_480p_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to MP4/480p (disabled in admin)!' . $le);
}
if ($mp4_480p_prev_processed === true) {
$conv->log($ls . 'MP4/480p Preview Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $video_id . '.480p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_prev, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_prev, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_prev);
}
}
if ($mp4_480p_full_processed === true) {
$conv->log($ls . 'MP4/480p Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $eid . '.480p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_full, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_full, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_full);
}
}
/* MP4/720p */
if ($cfg['conversion_mp4_720p_active'] == '1') {
$conv->log($ls . 'Starting MP4/720p conversion!' . $le);
$dst_mp4_nomov_prev = $dst_folder . $video_id . '.720p.nomov.mp4';
$dst_mp4_nomov_full = $dst_folder . $eid . '.720p.nomov.mp4';
if ($cfg["conversion_video_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp4($src, $dst_mp4_nomov_prev, true, '720p')) {
$mp4_720p_prev_processed = true;
}
if ($conv->convert_to_mp4($src, $dst_mp4_nomov_full, '', '720p')) {
$mp4_720p_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to MP4/720p (disabled in admin)!' . $le);
}
if ($mp4_720p_prev_processed === true) {
$conv->log($ls . 'MP4/720p Preview Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $video_id . '.720p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_prev, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_prev, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_prev);
}
}
if ($mp4_720p_full_processed === true) {
$conv->log($ls . 'MP4/720p Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $eid . '.720p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_full, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_full, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_full);
}
}
/* MP4/1080p */
if ($cfg['conversion_mp4_1080p_active'] == '1') {
$conv->log($ls . 'Starting MP4/1080p conversion!' . $le);
$dst_mp4_nomov_prev = $dst_folder . $video_id . '.1080p.nomov.mp4';
$dst_mp4_nomov_full = $dst_folder . $eid . '.1080p.nomov.mp4';
if ($cfg["conversion_video_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mp4($src, $dst_mp4_nomov_prev, true, '1080p')) {
$mp4_1080p_prev_processed = true;
}
if ($conv->convert_to_mp4($src, $dst_mp4_nomov_full, '', '1080p')) {
$mp4_1080p_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to MP4/1080p (disabled in admin)!' . $le);
}
if ($mp4_1080p_prev_processed === true) {
$conv->log($ls . 'MP4/1080p Preview Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $video_id . '.1080p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_prev, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_prev, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_prev);
}
}
if ($mp4_1080p_full_processed === true) {
$conv->log($ls . 'MP4/1080p Processed! Relocating moov atom ...' . $le);
$dst_mp4 = $dst_folder . $eid . '.1080p.mp4';
if (!$conv->fix_moov_atom($dst_mp4_nomov_full, $dst_mp4)) {
$conv->log($ls . 'Failed to relocate moov atom...copying original mp4 file!' . $le);
rename($dst_mp4_nomov_full, $dst_mp4);
VFileinfo::doDelete($dst_mp4_nomov_full);
}
}
/* Mobile MP4 */
$mobile_prev_processed = false;
$mobile_full_processed = false;
if ($cfg['conversion_mp4_ipad_active'] == '1') {
$conv->log($ls . 'Starting mobile/ipad conversion!' . $le);
$dst_mobile_nomob_prev = $dst_folder . $video_id . '.mob.nomob.mp4';
$dst_mobile_nomob_full = $dst_folder . $eid . '.mob.nomob.mp4';
if ($cfg["conversion_video_previews"] == 1 and $conv->data['duration_seconds'] > $pvl and $conv->convert_to_mobile($src, $dst_mobile_nomob_prev, true)) {
$mobile_prev_processed = true;
}
if ($conv->convert_to_mobile($src, $dst_mobile_nomob_full)) {
$mobile_full_processed = true;
}
} else {
$conv->log($ls . 'Not converting to mobile (disabled in admin)!' . $le);
}
if ($mobile_prev_processed === true) {
$conv->log($ls . 'Mobile Processed! Relocating moov atom ...' . $le);
$dst_mobile = $dst_folder . $video_id . '.mob.mp4';
if (!$conv->fix_moov_atom($dst_mobile_nomob_prev, $dst_mobile)) {
$conv->log($ls . 'Failed to relocated moov atom ... copying original mobile file!' . $le);
rename($dst_mobile_nomob_prev, $dst_mobile);
VFileinfo::doDelete($dst_mobile_nomob_prev);
}
}
if ($mobile_full_processed === true) {
$conv->log($ls . 'Mobile Processed! Relocating moov atom ...' . $le);
$dst_mobile = $dst_folder . $eid . '.mob.mp4';
if (!$conv->fix_moov_atom($dst_mobile_nomob_full, $dst_mobile)) {
$conv->log($ls . 'Failed to relocated moov atom ... copying original mobile file!' . $le);
rename($dst_mobile_nomob_full, $dst_mobile);
VFileinfo::doDelete($dst_mobile_nomob_full);
}
}
$vpx_360p_processed = false;
$vpx_480p_processed = false;
$vpx_720p_processed = false;
$vpx_1080p_processed = false;
/* WEBM/360p */
if ($cfg['conversion_vpx_360p_active'] == '1') {
$conv->log($ls . 'Starting WEBM/360p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.360p.webm';
if ($conv->convert_to_vpx($src, $dst_webm, '', '360p')) {
$conv->log($ls . 'WEBM/360p Processed!' . $le);
$vpx_360p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to WEBM/360p (disabled in admin)!' . $le);
}
/* WEBM/480p */
if ($cfg['conversion_vpx_480p_active'] == '1') {
$conv->log($ls . 'Starting WEBM/480p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.480p.webm';
if ($conv->convert_to_vpx($src, $dst_webm, '', '480p')) {
$conv->log($ls . 'WEBM/480p Processed!' . $le);
$vpx_480p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to WEBM/480p (disabled in admin)!' . $le);
}
/* WEBM/720p */
if ($cfg['conversion_vpx_720p_active'] == '1') {
$conv->log($ls . 'Starting WEBM/720p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.720p.webm';
if ($conv->convert_to_vpx($src, $dst_webm, '', '720p')) {
$conv->log($ls . 'WEBM/720p Processed!' . $le);
$vpx_720p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to WEBM/720p (disabled in admin)!' . $le);
}
/* WEBM/1080p */
if ($cfg['conversion_vpx_1080p_active'] == '1') {
$conv->log($ls . 'Starting WEBM/1080p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.1080p.webm';
if ($conv->convert_to_vpx($src, $dst_webm, '', '1080p')) {
$conv->log($ls . 'WEBM/1080p Processed!' . $le);
$vpx_1080p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to WEBM/1080p (disabled in admin)!' . $le);
}
$ogv_360p_processed = false;
$ogv_480p_processed = false;
$ogv_720p_processed = false;
$ogv_1080p_processed = false;
/* OGV/360p */
if ($cfg['conversion_ogv_360p_active'] == '1') {
$conv->log($ls . 'Starting OGV/360p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.360p.ogv';
if ($conv->convert_to_ogv($src, $dst_webm, '', '360p')) {
$conv->log($ls . 'OGV/360p Processed!' . $le);
$ogv_360p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to OGV/360p (disabled in admin)!' . $le);
}
/* OGV/480p */
if ($cfg['conversion_ogv_480p_active'] == '1') {
$conv->log($ls . 'Starting OGV/480p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.480p.ogv';
if ($conv->convert_to_ogv($src, $dst_webm, '', '480p')) {
$conv->log($ls . 'OGV/480p Processed!' . $le);
$ogv_480p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to OGV/480p (disabled in admin)!' . $le);
}
/* OGV/720p */
if ($cfg['conversion_ogv_720p_active'] == '1') {
$conv->log($ls . 'Starting OGV/720p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.720p.ogv';
if ($conv->convert_to_ogv($src, $dst_webm, '', '720p')) {
$conv->log($ls . 'OGV/720p Processed!' . $le);
$ogv_720p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to OGV/720p (disabled in admin)!' . $le);
}
/* OGV/1080p */
if ($cfg['conversion_ogv_1080p_active'] == '1') {
$conv->log($ls . 'Starting OGV/1080p conversion!' . $le);
$dst_webm = $dst_folder . $video_id . '.1080p.ogv';
if ($conv->convert_to_ogv($src, $dst_webm, '', '1080p')) {
$conv->log($ls . 'OGV/1080p Processed!' . $le);
$ogv_1080p_processed = true;
}
} else {
$conv->log($ls . 'Not converting to OGV/1080p (disabled in admin)!' . $le);
}
$conv->log($ls . 'Extracting large thumbnail (640x360)' . $le);
$thumbs = $conv->extract_thumbs(array($src, 'thumb'), $video_id, $user_key);
$cfg["thumbs_width"] = 320;
$cfg["thumbs_height"] = 180;
$conv->log($ls . 'Extracting smaller thumbnails (' . $cfg["thumbs_width"] . 'x' . $cfg["thumbs_height"] . ')' . $le);
$thumbs = $conv->extract_thumbs($src, $video_id, $user_key);
$is_hd = ($mp4_720p_full_processed === true or $mp4_720p_prev_processed === true or $mp4_1080p_full_processed === true or $mp4_1080p_prev_processed === true) ? 1 : 0;
$is_mobile = ($mobile_prev_processed === true or $mobile_full_processed === true) ? 1 : 0;
if ($mp4_360p_prev_processed) {
$_sfp = $dst_folder . $video_id . '.360p.mp4';
$previews = $conv->extract_preview_thumbs($_sfp, $video_id, $user_key);
}
if ($mp4_360p_full_processed) {
$_sfp = $dst_folder . md5($cfg["global_salt_key"] . $video_id) . '.360p.mp4';
$previews = $conv->extract_preview_thumbs($_sfp, $video_id, $user_key, 1);
}
$is_fp = ($mp4_360p_prev_processed or $mp4_480p_prev_processed or $mp4_720p_prev_processed or $mp4_1080p_prev_processed) ? 1 : 0;
$vpv = file_exists($cfg["media_files_dir"] . "/" . $user_key . "/v/" . md5($video_id . "_preview") . ".mp4");
//upload to another server here
$sql = sprintf("UPDATE `db_videofiles` SET `has_preview`='%s', `thumb_preview`='%s', `file_mobile`='%s', `file_hd`='%s', `file_duration`='%s' WHERE `file_key`='%s' LIMIT 1;", $is_fp, (int) $vpv, $is_mobile, $is_hd, (float) $conv->data['duration_seconds'], $video_id);
$conv->log($ls . "Executing update query: " . $sql . $le);
$db->query($sql);
if (!$db->affected_rows()) {
require 'f_core/config.database.php';
$db = &ADONewConnection($cfg_dbtype);
if (!$db->Connect($cfg_dbhost, $cfg_dbuser, $cfg_dbpass, $cfg_dbname)) {
$conv->log($ls . 'Failed database connection, reconnecting!' . $le);
}
$db->query($sql);
}
if ($db->affected_rows()) {
$conv->log($ls . 'Database data updated!' . $le);
if ($cfg["conversion_source_video"] == 0 and (file_exists($dst_folder . $video_id . '.360p.mp4') or file_exists($dst_folder . md5($cfg["global_salt_key"] . $video_id) . '.360p.mp4'))) {
$conv->log($ls . 'Deleting source video ' . $src . $le);
VFileinfo::doDelete($src);
}
if ($cfg["conversion_video_que"] == 1) {
$que = sprintf("UPDATE `db_videoque` SET `state`='2', `end_time`='%s' WHERE `file_key`='%s' AND `usr_key`='%s' AND `state`='1' LIMIT 1;", date("Y-m-d H:i:s"), $video_id, $user_key);
$db->execute($que);
if ($cfg["file_approval"] == 0) {
$act = sprintf("UPDATE `db_videofiles` SET `approved`='1' WHERE `file_key`='%s' LIMIT 1;", $video_id);
$db->execute($act);
}
}
/* admin and subscribers notification */
$db_approved = ($cfg["file_approval"] == 1 ? 0 : 1);
$type = 'video';
$usr_id = $class_database->singleFieldValue('db_' . $type . 'files', 'usr_id', 'file_key', $video_id);
$notify = $db_approved == 1 ? VUpload::notifySubscribers($usr_id, $type, $video_id, '', $user_key) : VUpload::notifySubscribers(0, $type, $video_id, '', $user_key);
$conv->log_clean = true;
} else {
$conv->log($ls . 'Failed to execute video update query!' . $le);
}
} else {
$conv->log($ls . 'Failed to load video: ' . $src . $le);
}
}
}
function gs($k)
{
global $cfg;
return md5($cfg["global_salt_key"] . $k);
}

View File

@@ -0,0 +1,132 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
$p = $class_filter->clr_str($_GET['p']);
$type = $p[0];
$tbl = $type == 'v' ? 'video' : ($type == 'i' ? 'image' : ($type == 'a' ? 'audio' : ($type == 'd' ? 'doc' : ($type == 'l' ? 'live' : null))));
$file_key = strrev(substr($p, -10));
$usr_key = substr($p, 2, 10);
$_file_src = $class_database->singleFieldValue('db_' . $tbl . 'files', 'file_name', 'file_key', $file_key);
switch ($type) {
case "v":
switch ($p[1]) {
case "1":$ext = '.360p.mp4';
break;
case "6":$ext = '.480p.mp4';
break;
case "2":$ext = '.720p.mp4';
break;
case "5":$ext = '.1080p.mp4';
break;
case "3":$ext = '.mob.mp4';
break;
case "4":$ext = '';
break;
}
break;
case "l":
switch ($p[1]) {
case "1":$ext = '.jpg';
break;
case "4":$ext = '';
break;
}
break;
case "i":
switch ($p[1]) {
case "1":$ext = '.jpg';
break;
case "4":$ext = '';
break;
}
break;
case "a":
switch ($p[1]) {
case "1":$ext = '.mp3';
break;
case "4":$ext = '';
break;
}
break;
case "d":
switch ($p[1]) {
case "1":$ext = '.pdf';
break;
case "5":$ext = '.swf';
break;
case "4":$ext = '';
break;
}
break;
}
$cf = $db->execute(sprintf("SELECT
A.`upload_server`,
B.`server_type`, B.`cf_enabled`, B.`cf_signed_url`, B.`cf_signed_expire`, B.`cf_key_pair`, B.`cf_key_file`,
B.`s3_bucketname`, B.`s3_accesskey`, B.`s3_secretkey`, B.`cf_dist_type`
FROM
`db_%sfiles` A, `db_servers` B
WHERE
A.`file_key`='%s' AND
A.`upload_server`>'0' AND
A.`upload_server`=B.`server_id`
LIMIT 1", $tbl, $file_key));
$server_type = $cf->fields["server_type"];
$cf_enabled = $cf->fields["cf_enabled"];
$cf_signed_url = $cf->fields["cf_signed_url"];
$cf_signed_expire = $cf->fields["cf_signed_expire"];
$cf_key_pair = $cf->fields["cf_key_pair"];
$cf_key_file = $cf->fields["cf_key_file"];
$s3_bucket = $cf->fields["s3_bucketname"];
$aws_access_key_id = $cf->fields["s3_accesskey"];
$aws_secret_key = $cf->fields["s3_secretkey"];
$dist_type = $cf->fields["cf_dist_type"];
$a_url = VGenerate::fileURL($tbl, $file_key, 'upload') . '/' . $usr_key . '/' . $type . '/' . $file_key . $ext;
if ($server_type == 's3' and $cf_enabled == 1 and $cf_signed_url == 1) {
$file_path = $usr_key . '/' . $type . '/' . $file_key . $ext;
if ($server_type == 's3' and $dist_type == 'r') {
$a_url = VbeServers::getS3SignedURL($aws_access_key_id, $aws_secret_key, $file_path, $s3_bucket, $cf_signed_expire);
} else {
$a_url = VbeServers::getSignedURL($a_url, $cf_signed_expire, $cf_key_pair, $cf_key_file);
}
}
$_file_name = ($p[1] != '4' ? md5($cfg["global_salt_key"] . $file_key) . $ext : $_file_src);
$_file_loc = ($p[1] != '4' ? $cfg["media_files_dir"] : $cfg["upload_files_dir"]);
$file = $_file_loc . '/' . $usr_key . '/' . $type . '/' . $_file_name;
$_full_name = $_file_name;
$_file_name = sprintf("%s%s", $tbl, $ext);
if ($type == 'l') {
$lq = $db->execute(sprintf("SELECT A.`srv_host`, A.`srv_port`, B.`file_name` FROM `db_liveservers` A, `db_livefiles` B WHERE A.`srv_id`=B.`vod_server` AND B.`file_key`='%s' LIMIT 1", $file_key));
$h = $lq->fields["srv_host"];
$p = $lq->fields["srv_port"];
$n = $lq->fields["file_name"];
$file = sprintf("https://%s:%s/vod/%s.mp4", $h, $p, $n);
$_file_name = $cfg["website_shortname"] . ' livestream';
}
echo '<br><br><a class="dl2" href="' . str_replace($cfg["media_files_dir"], $cfg["media_files_url"], $file) . '" download="' . $_full_name . '" target="_blank">' . $_file_name . '</a>';
exit;

View File

@@ -0,0 +1,195 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.browse');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.email.notif');
include_once $class_language->setLanguageFile('frontend', 'language.messages');
include_once $class_language->setLanguageFile('frontend', 'language.upload');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('live_uploads,blog_uploads,video_player,image_player,audio_player,document_player,paid_memberships,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,file_comment_spam,affiliate_module');
$logged_in = (!isset($_GET["pp"]) and $_GET["a"] != 'cb-watchadd') ? VLogin::checkFrontend(VHref::getKey("files")) : null;
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$files = new VFiles;
switch ($_GET["do"]) {
case "autocomplete":
$autocomplate = VGenerate::processAutoComplete('media_library');
break;
case "video-thumb": //set playlist thumb
case "image-thumb":
case "audio-thumb":
case "doc-thumb":
$pl_thumb = VFiles::plThumb($_GET["a"]);
break;
case "read": //mark as read
$read = VMessages::readMessage();
break;
case "comm-disable": //suspend comment
case "comm-enable": //approve comment
case "comm-delete": //delete comment
$comm_action = VFiles::ownCommentActions($_GET["do"]);
break;
case "resp-disable": //suspend comment
case "resp-enable": //approve comment
case "resp-delete": //delete comment
$resp_action = VFiles::ownResponseActions($_GET["do"]);
break;
case "new-blog": //new blog popup
case "new-broadcast": //new blog popup
$new_blog = VFiles::newBlog();
break;
}
switch ($_GET["a"]) {
case "sort-video": //file type sort menu
case "sort-image": //file type sort menu
case "sort-audio": //file type sort menu
case "sort-doc": //file type sort menu
$sort_action = VFiles::fileTypeMenu($_GET["a"]);
break;
case "cb-renable": //approve selected responses
case "cb-rdisable": //suspend selected responses
case "cb-rdel": //delete selected responses
$resp_action = VFiles::ownResponseActions($_GET["a"]);
break;
case "cb-enable": //approve selected comments
case "cb-disable": //suspend selected comments
case "cb-commdel": //delete selected comments
$comm_action = VFiles::ownCommentActions($_GET["a"]);
break;
case "cb-private": //make private
case "cb-public": //make public
case "cb-personal": //make personal
case "cb-favadd": //add to fav
case "cb-watchadd": //add to watchlist
case "cb-watchclear": //clear from watchlist
case "cb-favclear": //clear from fav
case "cb-likeclear": //clear liked
case "cb-histclear": //clear history
case "cb-delete": //delete files
$cb_action = VFiles::doActions($_GET["a"]);
break;
case "video-thumb": //set playlist thumb
case "short-thumb":
case "image-thumb":
case "audio-thumb":
case "doc-thumb":
$pl_thumb = VFiles::plThumb($_GET["a"]);
break;
case "confirm":
$confirm = VFiles::doConfirm();
break;
case "pl-sort": //reorder playlists
$pl_sort = VFiles::plSort();
break;
case "pl-cfg": //playlist settings
$pl_cfg = VFiles::plCfgTabs();
break;
case "pl-new": //create new playlists
$pl_new = VFiles::plCreateNew();
break;
case "pl-add": //submit new playlists
$pl_add = VFiles::plAddNew();
break;
case "menu": //reload playlists left menus
$pl_menu = VFiles::plReloadMenu();
break;
case "share-pl": //share playlists
$pl_share = VFiles::plShare();
break;
case "embed-pl": //embed playlists
case "email-pl": //email playlists
case "social-pl": //social share playlists
$pl_embed = VFiles::plUpdateEmbed();
break;
case "delete-pl": //delete playlist
$pl_delete = VFiles::plDelete();
break;
case "update-pl": //update playlist info
$pl_update = VFiles::plUpdate();
break;
case "update-order": //update playlist order
$pl_order = VFiles::plUpdateOrder();
break;
case "update-thumb": //update playlist order
$pl_order = VFiles::plUpdateThumbnail();
break;
case "update-privacy": //update playlist privacy
$pl_priv = VFiles::plUpdatePrivacy();
break;
case "pl-mail": //email a playlist
$pl_mail = VFiles::plMail();
break;
break;
default: //add/clear from pl
$cb_action = (substr($_GET["a"], 0, 8) == 'cb-label') ? VFiles::doActions($_GET["a"]) : null;
break;
}
if ((isset($_GET["p"]) and (int) $_GET["p"] >= 0) or (isset($_GET["vm"]) and (int) $_GET["vm"] >= 0)) {
//viewmode changer/loader
$sort = $class_filter->clr_str($_GET["sort"]);
$view_mode = isset($_GET["m"]) ? (int) $_GET["m"] : (int) $_GET["vm"];
if (isset($_GET["pp"]) and (int) $_GET["pp"] == 1 and $sort != 'plpublic' and $sort != 'blpublic' and $sort != 'plviews' and $sort != 'blviews' and $sort != 'titleasc' and $sort != 'titledesc' and $sort != 'relevance') {
$view_mode = ($view_mode == 4) ? 1 : ($view_mode == 5 ? 2 : ($view_mode == 6 ? 3 : 1));
}
switch ($view_mode) {
case 1:
case 2:
case 3:
$t = VFiles::browseType();
$t = $t == 'document' ? 'doc' : $t;
$v = (int) $_GET["p"] == 1 ? 'pvm' : 'vm';
$_SESSION[$t . "_" . $v] = $view_mode;
echo $html = isset($_GET["m"]) ? VFiles::viewMode_loader($view_mode) : null;
break;
case 4:
case 5:
case 6:
$type = $class_filter->clr_str($_GET["t"]);
$entries = VFiles::listPlaylists($type, true);
$html = VFiles::listPlaylistMedia_content($type, $entries);
echo $html;
break;
}
}
if (!isset($_GET["s"]) and !isset($_GET["do"]) and !isset($_GET["p"]) and !isset($_GET["a"])) {
unset($_SESSION["q"]);
$section_check = VFiles::browseInit();
$smarty->assign('c_section', VHref::getKey("files"));
$display_page = $class_smarty->displayPage('frontend', 'tpl_files', $error_message, $notice_message);
}
$display_section = ((isset($_GET["v"]) or isset($_GET["s"])) and !isset($_GET["m"])) ? VFiles::sectionWrap() : null;

View File

@@ -0,0 +1,78 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once 'f_core/f_classes/class_thumb/ThumbLib.inc.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.account');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('live_uploads,image_player,video_player,audio_player,document_player,file_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,file_comment_spam,file_thumb_change,affiliate_module');
$logged_in = VLogin::checkFrontend(VHref::getKey("files"));
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$for = isset($_GET["s"]) ? 'short' : (isset($_GET["l"]) ? 'live' : (isset($_GET["v"]) ? 'video' : (isset($_GET["i"]) ? 'image' : (isset($_GET["a"]) ? 'audio' : (isset($_GET["d"]) ? 'doc' : (isset($_GET["b"]) ? 'blog' : null))))));
$files = new VFiles;
$post_edit = (isset($_POST["files_text_file_title"]) and $_GET["do"] == '') ? VFiles::saveEdit() : null;
$smarty->assign('file_type', $for[0]);
$smarty->assign('file_key', $class_filter->clr_str($_GET[$for[0]]));
if (isset($_GET["do"])) {
switch ($_GET["do"]) {
case "thumb": //change thumbnail
$smarty->assign('for', $for[0]);
$smarty->assign('src', $class_database->singleFieldValue('db_' . $for . 'files', 'embed_src', 'file_key', $class_filter->clr_str($_GET[$for[0]])));
$smarty->display('tpl_frontend/tpl_file/tpl_thumbnail.tpl');
break;
case "upload": //upload new thumbnail
VFiles::thumbChange_upload();
break;
case "save": //save new thumbnail
VFiles::thumbChange_save();
break;
case "cancel": //cancel changing thumbnail
VFiles::thumbChange_cancel();
break;
case "insert": //insert media into blog
VFiles::blog_insertMedia();
break;
case "find": //find media for inserting into blog
VFiles::blog_findMedia();
break;
default:break;
}
}
if ($_GET["fe"] == 1 and empty($_POST) and !isset($_GET["do"])) {
$smarty->assign('c_section', VHref::getKey("files_edit"));
}
$display_page = ($_GET["fe"] == 1 and empty($_POST) and !isset($_GET["do"])) ? $class_smarty->displayPage('frontend', 'tpl_files_edit', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,70 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
require_once 'Google/autoload.php';
require_once 'Google/Client.php';
require_once 'Google/Service/YouTube.php';
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
include_once 'f_core/config.backend.php';
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.conversion.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('backend', 'language.import');
$error_message = null;
$notice_message = null;
$logged_in = VLogin::checkFrontend(VHref::getKey("import") . '?t=video');
$cfg = $class_database->getConfigurations('file_approval,import_yt,import_dm,import_mc,import_vi,import_yt_channel_list,import_dm_user_list,import_mc_user_list,import_vi_user_list,import_yt_playback,youtube_api_key,import_mode,server_path_ffmpeg,server_path_php');
$membership_check = VLogin::checkSubscription();
$side = (strstr($_SERVER['REQUEST_URI'], $backend_access_url) == true) ? 'backend' : 'frontend';
switch ($_GET["do"]) {
case "list-feed": //list youtube video and channel feeds
case "import-yt-video": //import youtube video feeds
case "import-yt-channel": //import youtube channel feeds
$ht = VImport::processVideoFeed();
break;
case "vimeo-feed": //list vimeo user feeds
case "import-vimeo-feed": //import vimeo user feeds
$ht = VImport::processVimeoFeed();
break;
case "dm-feed": //list dailymotion user feeds
case "dm-video": //list dailymotion video feeds
case "import-dm-video": //import dailymotion video feeds
case "import-dm-user": //import dailymotion user feeds
$ht = VImport::processDailymotionFeed();
break;
case "mc-feed": //list metacafe user feeds
case "mc-video": //list metacafe video feeds
case "import-mc-user": //import metacafe user feeds
case "import-mc-video": //import metacafe video feeds
$ht = VImport::processMetacafeFeed();
break;
case "video-embed": //embed single file
case "video-find": //find single file
$ht = VImport::processVideoEmbed();
break;
default:break;
}
$display_page = !isset($_GET["do"]) ? $class_smarty->displayPage('frontend', 'tpl_import', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,407 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
/**
* Subtitle Management Page
*
* Allows users to:
* - Upload subtitle files (.srt, .vtt) for their videos
* - Manage multiple language tracks
* - Set default subtitle language
* - Delete subtitle tracks
* - Preview subtitles
*
* URL: /f_modules/m_frontend/m_file/manage_subtitles.php?v={file_key}&type={file_type}
*/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
// Check if user is logged in
if (!isset($_SESSION['USER_ID']) || $_SESSION['USER_ID'] == 0) {
header('Location: ' . $cfg['main_url'] . '/login.php');
exit;
}
$error_message = null;
$notice_message = null;
// Get file info from URL
$file_key = isset($_GET['v']) ? VSecurity::getParam('v', 'string') : '';
$file_type = isset($_GET['type']) ? VSecurity::getParam('type', 'string') : 'video';
// Validate file type
$allowed_types = ['video', 'short', 'live', 'audio'];
if (!in_array($file_type, $allowed_types)) {
$file_type = 'video';
}
// Get file ID from key
$table_map = [
'video' => 'db_videofiles',
'short' => 'db_shortfiles',
'live' => 'db_livefiles',
'audio' => 'db_audiofiles'
];
$sql = "SELECT `db_id`, `usr_id`, `file_title` FROM `{$table_map[$file_type]}`
WHERE `file_key` = '%s' AND `usr_id` = %d LIMIT 1";
$result = $class_database->doQuery($sql, $file_key, (int) $_SESSION['USER_ID']);
$file_info = $result->fetch_assoc();
if (!$file_info) {
$error_message = 'File not found or you do not have permission to manage its subtitles.';
} else {
$file_id = $file_info['db_id'];
// Handle subtitle upload
if (isset($_POST['upload_subtitle']) && isset($_FILES['subtitle_file'])) {
$language = VSecurity::postParam('language', 'string');
$label = VSecurity::postParam('label', 'string');
$is_default = isset($_POST['is_default']) ? true : false;
$result = VSubtitles::uploadSubtitle(
$file_id,
$file_type,
$_FILES['subtitle_file'],
$language,
$label,
$is_default
);
if ($result['success']) {
$notice_message = $result['message'];
} else {
$error_message = $result['message'];
}
}
// Handle subtitle deletion
if (isset($_POST['delete_subtitle'])) {
$sub_id = VSecurity::postParam('sub_id', 'int');
if (VSubtitles::deleteSubtitle($sub_id)) {
$notice_message = 'Subtitle deleted successfully';
} else {
$error_message = 'Failed to delete subtitle';
}
}
// Handle set default
if (isset($_POST['set_default'])) {
$sub_id = VSecurity::postParam('sub_id', 'int');
// Implement set default logic
$sql = "UPDATE `db_subtitles` SET `sub_default` = 0
WHERE `file_id` = %d AND `file_type` = '%s'";
$class_database->doQuery($sql, $file_id, $file_type);
$sql = "UPDATE `db_subtitles` SET `sub_default` = 1 WHERE `sub_id` = %d";
$class_database->doQuery($sql, $sub_id);
$notice_message = 'Default subtitle updated';
}
// Get existing subtitles
$subtitles = VSubtitles::getSubtitles($file_id, $file_type, false);
}
// Get configuration
$cfg = $class_database->getConfigurations('subtitles_enabled,subtitles_max_size,subtitles_allowed_formats,subtitles_max_per_video');
?>
<!DOCTYPE html>
<html>
<head>
<title>Manage Subtitles - <?php echo htmlspecialchars($file_info['file_title'] ?? 'EasyStream'); ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
max-width: 900px;
margin: 40px auto;
padding: 20px;
background: #f9f9f9;
}
.container {
background: white;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
h1 {
color: #333;
margin-bottom: 10px;
}
.file-title {
color: #666;
margin-bottom: 30px;
font-size: 14px;
}
.message {
padding: 12px 16px;
border-radius: 4px;
margin-bottom: 20px;
}
.error {
background: #fee;
color: #c33;
border-left: 4px solid #c33;
}
.notice {
background: #efe;
color: #3c3;
border-left: 4px solid #3c3;
}
.upload-form {
background: #f5f5f5;
padding: 20px;
border-radius: 6px;
margin-bottom: 30px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: 500;
color: #333;
}
input[type="text"],
input[type="file"],
select {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.checkbox-group {
display: flex;
align-items: center;
}
.checkbox-group input {
width: auto;
margin-right: 8px;
}
button {
background: #1a73e8;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
}
button:hover {
background: #1557b0;
}
.subtitle-list {
margin-top: 20px;
}
.subtitle-item {
background: #fff;
border: 1px solid #e0e0e0;
border-radius: 6px;
padding: 16px;
margin-bottom: 12px;
display: flex;
justify-content: space-between;
align-items: center;
}
.subtitle-info {
flex: 1;
}
.subtitle-label {
font-weight: 500;
color: #333;
margin-bottom: 4px;
}
.subtitle-meta {
font-size: 13px;
color: #666;
}
.subtitle-actions {
display: flex;
gap: 8px;
}
.btn-small {
padding: 6px 12px;
font-size: 13px;
}
.btn-danger {
background: #d93025;
}
.btn-danger:hover {
background: #a71e15;
}
.btn-secondary {
background: #5f6368;
}
.btn-secondary:hover {
background: #3c4043;
}
.badge {
background: #1a73e8;
color: white;
padding: 2px 8px;
border-radius: 12px;
font-size: 11px;
margin-left: 8px;
}
.badge-success {
background: #34a853;
}
.badge-warning {
background: #fbbc04;
color: #333;
}
.back-link {
display: inline-block;
margin-bottom: 20px;
color: #1a73e8;
text-decoration: none;
}
.back-link:hover {
text-decoration: underline;
}
.info-box {
background: #e8f0fe;
padding: 12px 16px;
border-radius: 4px;
margin-bottom: 20px;
font-size: 14px;
color: #174ea6;
}
</style>
</head>
<body>
<div class="container">
<a href="<?php echo $cfg['main_url']; ?>/watch?v=<?php echo htmlspecialchars($file_key); ?>" class="back-link">
← Back to Video
</a>
<h1>Manage Subtitles</h1>
<?php if (isset($file_info)): ?>
<div class="file-title">For: <strong><?php echo htmlspecialchars($file_info['file_title']); ?></strong></div>
<?php endif; ?>
<?php if ($error_message): ?>
<div class="message error"><?php echo htmlspecialchars($error_message); ?></div>
<?php endif; ?>
<?php if ($notice_message): ?>
<div class="message notice"><?php echo htmlspecialchars($notice_message); ?></div>
<?php endif; ?>
<?php if ($cfg['subtitles_enabled'] == 1 && isset($file_info)): ?>
<div class="info-box">
📝 Upload subtitle files in .VTT or .SRT format. Maximum file size: <?php echo round($cfg['subtitles_max_size'] / 1048576, 2); ?>MB.
You can upload up to <?php echo $cfg['subtitles_max_per_video']; ?> subtitle tracks per video.
</div>
<div class="upload-form">
<h3 style="margin-top: 0;">Upload New Subtitle</h3>
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="subtitle_file">Subtitle File (.vtt or .srt)</label>
<input type="file" id="subtitle_file" name="subtitle_file" accept=".vtt,.srt" required>
</div>
<div class="form-group">
<label for="language">Language Code</label>
<select id="language" name="language" required>
<option value="en">English (en)</option>
<option value="es">Spanish (es)</option>
<option value="fr">French (fr)</option>
<option value="de">German (de)</option>
<option value="it">Italian (it)</option>
<option value="pt">Portuguese (pt)</option>
<option value="ru">Russian (ru)</option>
<option value="ja">Japanese (ja)</option>
<option value="ko">Korean (ko)</option>
<option value="zh">Chinese (zh)</option>
<option value="ar">Arabic (ar)</option>
<option value="hi">Hindi (hi)</option>
</select>
</div>
<div class="form-group">
<label for="label">Display Label</label>
<input type="text" id="label" name="label" placeholder="e.g., English, Spanish, etc." required>
</div>
<div class="form-group checkbox-group">
<input type="checkbox" id="is_default" name="is_default">
<label for="is_default" style="margin-bottom: 0;">Set as default subtitle</label>
</div>
<button type="submit" name="upload_subtitle">Upload Subtitle</button>
</form>
</div>
<div class="subtitle-list">
<h3>Existing Subtitles</h3>
<?php if (empty($subtitles)): ?>
<p style="color: #666; font-style: italic;">No subtitles uploaded yet.</p>
<?php else: ?>
<?php foreach ($subtitles as $sub): ?>
<div class="subtitle-item">
<div class="subtitle-info">
<div class="subtitle-label">
<?php echo htmlspecialchars($sub['sub_label']); ?> (<?php echo htmlspecialchars($sub['sub_language']); ?>)
<?php if ($sub['sub_default'] == 1): ?>
<span class="badge badge-success">Default</span>
<?php endif; ?>
<?php if ($sub['active'] == 0): ?>
<span class="badge badge-warning">Pending Approval</span>
<?php endif; ?>
<?php if ($sub['sub_auto_generated'] == 1): ?>
<span class="badge">Auto-generated</span>
<?php endif; ?>
</div>
<div class="subtitle-meta">
Format: <?php echo strtoupper($sub['sub_format']); ?> |
Size: <?php echo round($sub['sub_filesize'] / 1024, 2); ?> KB |
Uploaded: <?php echo date('M d, Y', strtotime($sub['upload_date'])); ?>
</div>
</div>
<div class="subtitle-actions">
<?php if ($sub['sub_default'] != 1): ?>
<form method="POST" style="display: inline;">
<input type="hidden" name="sub_id" value="<?php echo $sub['sub_id']; ?>">
<button type="submit" name="set_default" class="btn-small btn-secondary">Set as Default</button>
</form>
<?php endif; ?>
<form method="POST" style="display: inline;">
<input type="hidden" name="sub_id" value="<?php echo $sub['sub_id']; ?>">
<button type="submit" name="delete_subtitle" class="btn-small btn-danger" onclick="return confirm('Are you sure you want to delete this subtitle?')">Delete</button>
</form>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php else: ?>
<p style="color: #666;">Subtitles are not enabled on this platform or file not found.</p>
<?php endif; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,61 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.upload');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.view');
include_once $class_language->setLanguageFile('frontend', 'language.email.notif');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('video_player,image_player,audio_player,doc_player,file_counts,file_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
if ($cfg["file_playlists"] == 0) {
header("Location: " . $cfg["main_url"]);
exit;
}
$files = new VFiles;
switch ($_GET["a"]) {
case "save":
$save = VFiles::savePlaylist();
break;
case "pl-mail":
$mail = VFiles::plMail();
break;
case "cb-favadd": //add to fav
case "cb-watchadd": //add to watchlist
$cb_action = VFiles::doActions($_GET["a"]);
break;
default: //add/clear from pl
$cb_action = (substr($_GET["a"], 0, 8) == 'cb-label') ? VFiles::doActions($_GET["a"]) : null;
break;
}
$smarty->assign('c_section', VHref::getKey("playlist"));
$display_page = ((strlen($_GET["v"]) >= 10 or strlen($_GET["s"]) >= 10 or strlen($_GET["l"]) >= 10 or strlen($_GET["i"]) >= 10 or strlen($_GET["a"]) >= 10 or strlen($_GET["d"]) >= 10 or strlen($_GET["b"]) >= 10) and !$_POST) ? $class_smarty->displayPage('frontend', 'tpl_playlist', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,39 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.home');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
header("Location: " . $cfg["main_url"] . '/' . VHref::getKey("videos"));
exit;
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('video_player,image_player,audio_player,doc_player,file_counts,file_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing');
$guest_chk = $_SESSION["USER_ID"] == '' ? VHref::guestPermissions('guest_browse_playlist', VHref::getKey("playlists")) : null;
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$playlist = new VPlaylist;
$files = new VFiles;
$smarty->assign('c_section', VHref::getKey("files"));
echo $display_page = (!isset($_GET["sort"]) and !isset($_GET["v"])) ? $class_smarty->displayPage('frontend', 'tpl_playlists', $error_message, $notice_message) : VPlaylist::listPlaylists();

View File

@@ -0,0 +1,58 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.respond');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
$error_message = null;
$notice_message = null;
$responses = new VResponses();
$get_type = $responses::$type;
$get_key = $responses::$file_key;
$logged_in = VLogin::checkFrontend(VHref::getKey("respond") . '?' . $get_type[0] . '=' . $get_key);
$cfg = $class_database->getConfigurations('file_responses');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$for = isset($_GET["l"]) ? 'live' : (isset($_GET["v"]) ? 'video' : (isset($_GET["i"]) ? 'image' : (isset($_GET["a"]) ? 'audio' : (isset($_GET["d"]) ? 'doc' : (isset($_GET["b"]) ? 'blog' : null)))));
$smarty->assign('file_type', $for[0]);
$smarty->assign('file_key', $class_filter->clr_str($_GET[$for[0]]));
$files = new VFiles;
$responses = new VResponses;
switch ($_GET["do"]) {
case "submit-response":
$do = VResponses::submitResponse();
break;
default:break;
}
if (!isset($_GET["s"]) and !isset($_GET["do"])) {
$smarty->assign('c_section', VHref::getKey("respond"));
}
$display_page = (!isset($_GET["do"])) ? $class_smarty->displayPage('frontend', 'tpl_respond', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,47 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.respond');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.view');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('paid_memberships,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,user_blocking,file_flagging,file_email_sharing,file_permalink_sharing,fcc_limit,file_comment_min_length,file_comment_max_length,file_comment_spam');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
switch ($_GET["do"]) {
case "resp-clear": //delete response
echo $do_load = VResponses::delResponse(1);
break;
case "cb-favadd": //file menu - add to favorites
case "cb-watchadd": //file menu - add to watchlist
$do_load = VFiles::doActions($_GET["do"]);
break;
default: //file menu - add to playlist
if (substr($_GET["do"], 0, 8) == 'cb-label') {
$do_load = VFiles::doActions($_GET["do"]);
}
break;
}
$display_page = ($_GET["s"] == '' and $_GET["do"] == '') ? $class_smarty->displayPage('frontend', 'tpl_respond_extra', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,68 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.search');
include_once $class_language->setLanguageFile('frontend', 'language.home');
include_once $class_language->setLanguageFile('frontend', 'language.userpage');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('user_subscriptions,user_friends,user_blocking,internal_messaging,channel_views,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,video_player,channel_promo,file_promo');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$_a = isset($_GET["a"]) ? $class_filter->clr_str($_GET["a"]) : null;
$_do = isset($_GET["do"]) ? $class_filter->clr_str($_GET["do"]) : null;
$search = new VSearch;
switch ($_do) {
case "autocomplete":
VGenerate::processAutoComplete('search');
break;
}
switch ($_a) {
case "cb-favadd":
case "cb-watchadd":
default:
$ct = $_a != '' ? VFiles::doActions($_a) : null;
break;
case "sub":
$act = VChannels::chSubscribe();
break;
case "unsub":
$act = VChannels::chSubscribe(1);
break;
case "cb-addfr":
case "cb-remfr":
case "cb-block":
case "cb-unblock":
$act = VChannels::contactActions($_a);
break;
case "cb-msg":
$act = VChannels::sessionMessageName();
break;
}
$c_section = VSearch::c_section();
$guest_chk = ($error_message == '' and !isset($_GET["s"]) and $_do == '' and $_a == '') ? VHref::guestPermissions('guest_search_page', VHref::getKey("search") . '?q=' . $class_filter->clr_str($_GET["q"])) : null;
$display_page = (!isset($_GET["s"]) and $_do == '' and $_a == '' and !isset($_GET["v"])) ? $class_smarty->displayPage('frontend', 'tpl_search', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,145 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.email.notif');
include_once $class_language->setLanguageFile('frontend', 'language.userpage');
include_once $class_language->setLanguageFile('frontend', 'language.respond');
include_once $class_language->setLanguageFile('frontend', 'language.view');
include_once $class_language->setLanguageFile('frontend', 'language.signup');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('image_player,video_player,audio_player,document_player,paid_memberships,file_downloads,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,channel_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,user_blocking,file_flagging,file_email_sharing,file_permalink_sharing,fcc_limit,file_comment_min_length,file_comment_max_length,file_comment_spam,file_download_s1,file_download_s2,file_download_s3,file_download_s4,file_download_reg,user_subscriptions,backend_email,guest_view_video,guest_view_image,guest_view_audio,guest_view_doc,guest_view_blog,affiliate_tracking_id,affiliate_module,conversion_video_previews,conversion_audio_previews,conversion_doc_previews,conversion_image_previews,conversion_live_previews,guest_view_live,guest_view_short');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$is_shorts = 1;
if ($_GET["g"] == 1) {
//for seo mod_rewrite rules
include 'f_core/config.href.php';
$section = $href["watch"];
}
$view = new VView();
$vfiles = new VFiles();
if ($cfg["file_responses"] == 1) {
$vresponses = new VResponses();
}
switch ($_GET["do"]) {
case "side-column":
case "recommend-more":
echo $do_load = VView::sideColumn(true);
case "resp-clear": //delete response
echo $do_load = VResponses::delResponse();
break;
case "comm-suspend": //suspend comments
case "comm-approve": //approve comments
case "comm-spam": //report spam
case "comm-delete": //delete comments
case "comm-like": //like
case "comm-dislike": //dislike
case "comm-edit": //edit
case "comm-pin": //pin
case "comm-unpin": //unpin
echo $do_load = VComments::commentActions($_GET["do"]);
break;
case "comm-sort": //load/reload after sorting
case "comm-load": //load/reload after posting, etc
echo $do_load = VComments::browseComment();
break;
case "comm-post": //post comments
case "comm-reply": //reply comments
echo $do_load = VComments::postComment();
break;
case "response-load": //load responses
echo $do_load = '';
break;
case "user-files": //load user files
echo $do_load = VView::loadUserFiles();
break;
case "load-more": //load more files
echo $do_load = VView::loadMoreFiles();
break;
case "featured-files": //load featured files
echo $do_load = VView::loadFeaturedFiles();
break;
case "user-sub": //subscribe to file owner
echo $do_load = VView::chSubscribe('', (int) $_POST["uf_vuid"]);
break;
case "user-unsub": //unsubscribe
echo $do_load = VView::chSubscribe(1, (int) $_POST["uf_vuid"]);
break;
case "user-follow": //follow file owner
echo $do_load = VView::chSubscribe('', (int) $_POST["uf_vuid"], true);
break;
case "user-unfollow": //unfollow
echo $do_load = VView::chSubscribe(1, (int) $_POST["uf_vuid"], true);
break;
case "user-unsubscribe":
echo $do_load = VSubscriber::unsub_request((int) $_POST["uf_vuid"]);
break;
case "unsub-option": //unsub html
echo $do_load = VView::subHtml(1);
break;
case "sub-option": //sub html
echo $do_load = VView::subHtml();
break;
case "sub-continue": //sub paypal
echo $do_load = VView::subContinue();
break;
case "ipn": //verify paypal
echo $do_load = VView::verifyPP();
break;
case "cb-favadd": //file menu - add to favorites
case "cb-favclear": //file menu - add to favorites
case "cb-labeladd": //file menu - add to playlists
case "cb-labelclear": //file menu - clear playlists
case "cb-watchadd": //file menu - add to watchlist
case "cb-watchclear": //file menu - add to watchlist
$do_load = VFiles::doActions($_GET["do"]);
break;
case "file-share": //share file via email
echo $do_load = VFiles::plMail();
break;
case "file-like": //like file
case "file-dislike": //like file
echo $do_load = VView::likeAction($_GET["do"]);
break;
default: //file flagging
$do_load = (substr($_GET["do"], 0, 9) == 'file-flag') ? VView::fileFlagging(intval(substr($_GET["do"], 9))) : null;
break;
}
if (!isset($_GET["do"])) {
$mob = $smarty->assign('is_mobile', VHref::isAnyMobile());
$file_info = VView::getFileInfo();
$smarty->assign('c_section', VHref::getKey("watch"));
$smarty->assign('tpl_section', "tpl_shorts");
$display_page = $class_smarty->displayPage('frontend', 'tpl_view', $error_message, $notice_message);
}

View File

@@ -0,0 +1,194 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.browse');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('video_player,image_player,audio_player,document_player,paid_memberships,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,file_comment_spam');
$uri = $class_filter->clr_str($_SERVER["REQUEST_URI"]);
$a = explode("/", $uri);
$t = count($a);
$c = null;
if ($a[$t - 2] == $href["subscriptions"]) {
$c = '/' . $class_filter->clr_str($a[$t - 1]);
}
$logged_in = VLogin::checkFrontend(VHref::getKey("subscriptions") . $c);
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$files = new VFiles;
switch ($_GET["do"]) {
case "autocomplete":
$autocomplate = VGenerate::processAutoComplete('media_library');
break;
case "video-thumb": //set playlist thumb
case "image-thumb":
case "audio-thumb":
case "doc-thumb":
$pl_thumb = VFiles::plThumb($_GET["a"]);
break;
case "read": //mark as read
$read = VMessages::readMessage();
break;
case "comm-disable": //suspend comment
case "comm-enable": //approve comment
case "comm-delete": //delete comment
$comm_action = VFiles::ownCommentActions($_GET["do"]);
break;
case "resp-disable": //suspend comment
case "resp-enable": //approve comment
case "resp-delete": //delete comment
$resp_action = VFiles::ownResponseActions($_GET["do"]);
break;
}
switch ($_GET["a"]) {
case "sort-video": //file type sort menu
case "sort-image": //file type sort menu
case "sort-audio": //file type sort menu
case "sort-doc": //file type sort menu
$sort_action = VFiles::fileTypeMenu($_GET["a"]);
break;
case "cb-renable": //approve selected responses
case "cb-rdisable": //suspend selected responses
case "cb-rdel": //delete selected responses
$resp_action = VFiles::ownResponseActions($_GET["a"]);
break;
case "cb-enable": //approve selected comments
case "cb-disable": //suspend selected comments
case "cb-commdel": //delete selected comments
$comm_action = VFiles::ownCommentActions($_GET["a"]);
break;
case "cb-private": //make private
case "cb-public": //make public
case "cb-personal": //make personal
case "cb-favadd": //add to fav
case "cb-watchadd": //add to watchlist
case "cb-watchclear": //clear from watchlist
case "cb-favclear": //clear from fav
case "cb-likeclear": //clear liked
case "cb-histclear": //clear history
case "cb-delete": //delete files
$cb_action = VFiles::doActions($_GET["a"]);
break;
case "video-thumb": //set playlist thumb
case "image-thumb":
case "audio-thumb":
case "doc-thumb":
$pl_thumb = VFiles::plThumb($_GET["a"]);
break;
case "confirm":
$confirm = VFiles::doConfirm();
break;
case "pl-sort": //reorder playlists
$pl_sort = VFiles::plSort();
break;
case "pl-cfg": //playlist settings
$pl_cfg = VFiles::plCfgTabs();
break;
case "pl-new": //create new playlists
$pl_new = VFiles::plCreateNew();
break;
case "pl-add": //submit new playlists
$pl_add = VFiles::plAddNew();
break;
case "menu": //reoload playlists left menus
$pl_menu = VFiles::plReloadMenu();
break;
case "share-pl": //share playlists
$pl_share = VFiles::plShare();
break;
case "embed-pl": //embed playlists
case "email-pl": //email playlists
case "social-pl": //social share playlists
$pl_embed = VFiles::plUpdateEmbed();
break;
case "delete-pl": //delete playlist
$pl_delete = VFiles::plDelete();
break;
case "update-pl": //update playlist info
$pl_update = VFiles::plUpdate();
break;
case "update-order": //update playlist order
$pl_order = VFiles::plUpdateOrder();
break;
case "update-thumb": //update playlist order
$pl_order = VFiles::plUpdateThumbnail();
break;
case "update-privacy": //update playlist privacy
$pl_priv = VFiles::plUpdatePrivacy();
break;
case "pl-mail": //email a playlist
$pl_mail = VFiles::plMail();
break;
break;
case "sub_edit": //subscription settings
$sub_action = VFiles::setSubSettings();
break;
default: //add/clear from pl
$cb_action = (substr($_GET["a"], 0, 8) == 'cb-label') ? VFiles::doActions($_GET["a"]) : null;
break;
}
if (isset($_GET["p"]) and (int) $_GET["p"] >= 0) {
//viewmode changer/loader
$sort = $class_filter->clr_str($_GET["sort"]);
$view_mode = (int) $_GET["m"];
if (isset($_GET["pp"]) and (int) $_GET["pp"] == 1 and $sort != 'plpublic' and $sort != 'plviews' and $sort != 'titleasc' and $sort != 'titledesc') {
$view_mode = ($view_mode == 4) ? 1 : ($view_mode == 5 ? 2 : ($view_mode == 6 ? 3 : 1));
}
switch ($view_mode) {
case 1:
case 2:
case 3:
echo $html = (int) $_GET["m"] > 0 ? VFiles::viewMode_loader($view_mode) : null;
break;
case 4:
case 5:
case 6:
$type = $class_filter->clr_str($_GET["t"]);
$entries = VFiles::listPlaylists($type, true);
$html = VFiles::listPlaylistMedia_content($type, $entries);
echo $html;
break;
}
}
if (!isset($_GET["s"]) and !isset($_GET["do"]) and !isset($_GET["p"]) and !isset($_GET["a"])) {
$section_check = VFiles::browseInit();
$smarty->assign('c_section', VHref::getKey("subscriptions"));
$display_page = $class_smarty->displayPage('frontend', 'tpl_subs', $error_message, $notice_message);
}
$display_section = ((isset($_GET["v"]) or isset($_GET["s"])) and !isset($_GET["m"]) and $_GET["a"] != 'sub_edit') ? VFiles::sectionWrap() : null;

View File

@@ -0,0 +1,52 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
$type = null;
$user_key = null;
$file_key = null;
$thumbnail = null;
if ($i = rawurldecode($_GET["_"]) and $d = json_decode(secured_decrypt($i), true)) {
$type = $class_filter->clr_str($d[0]);
$user_key = (int) $d[1];
$file_key = (int) $d[2];
if ($type and $user_key and $file_key) {
$tbl = sprintf("db_%sfiles", $type);
$get = $db->execute(sprintf("SELECT `db_id`, `thumb_cache`, `thumb_server` FROM `%s` WHERE `file_key`='%s' LIMIT 1;", $tbl, $file_key));
if ($get->fields["db_id"]) {
$thumb_server = $get->fields["thumb_server"];
$thumb_cache = $get->fields["thumb_cache"];
$thumb_cache = $thumb_cache > 1 ? $thumb_cache : null;
$thumbnail = VGenerate::thumbSigned($type, $file_key, array($user_key, $thumb_cache), (3600 * 24), 0, 0);
if ($thumbnail) {
header("Location: " . $thumbnail);
}
}
}
} else {
header("Location: " . $cfg["global_images_url"] . '/logo-mail.png');
}

View File

@@ -0,0 +1,158 @@
<?php
/**
* Video thumbnail preview generator
*
* A simple but effective command-line tool for generating thumbnails of a
* video and corresponding VTT file for use within JW Player.
*
* This script requires that ffmpeg is installed on your system.
*
* @author Andrew Collington, andy@amnuts.com
* @license MIT, http://acollington.mit-license.org/
*/
$params = [
'ffmpeg' => 'ffmpeg', // the ffmpeg command - full path if needs be
'input' => null, // input video file - specified as command line parameter
'output' => __DIR__, // The output directory
'timespan' => 3, // seconds between each thumbnail
'thumbWidth' => 140, // thumbnail width
'spriteWidth' => 10 // number of thumbnails per row in sprite sheet
];
$commands = [
'details' => $params['ffmpeg'] . ' -i %s 2>&1',
'poster' => $params['ffmpeg'] . ' -ss %d -i %s -y -vframes 1 "%s/poster.jpg" 2>&1',
'thumbs' => $params['ffmpeg'] . ' -ss %0.04f -i %s -y -an -sn -vsync 0 -q:v 5 -threads 1 '
. '-vf scale=%d:-1,select="not(mod(n\\,%d))" "%s/thumbnails/%s-%%04d.jpg" 2>&1'
];
if (PHP_SAPI !== 'cli') {
exit('Sorry, you can only use this via the command line.');
}
$opts = getopt('i:o:t:w:hvpd');
if (isset($opts['h']) || !isset($opts['i'])) {
$usage =<<< EOT
Usage: php thumbnails.php -i "/input/video.mp4" [-o "/output/directory"] [-t <number>] [-w <number>] [-v] [-p] [-d]
-i: The input file to be used.
-o: The output directory where the thumbnails and vtt file will be saved
-t: The time span (in seconds) between each thumbnail (default, {$params['timespan']})
-w: The max width of the thumbnail (default, {$params['thumbWidth']})
-v: Verbose - don't coalesce the thumbnails into one image
-p: Generate poster image from a random frame in the video
-d: Delete any previous thumbnails that match before generating new images
-h: Show this message
EOT;
exit($usage);
}
// process input parameters
$params['input'] = escapeshellarg($opts['i']);
if (isset($opts['o'])) {
$params['output'] = realpath($opts['o']);
}
if (isset($opts['t']) && (int)$opts['t']) {
$params['timespan'] = $opts['t'];
}
if (isset($opts['w']) && (int)$opts['w']) {
$params['thumbWidth'] = $opts['w'];
}
// sanity checks
if (!is_readable($opts['i'])) {
exit("Cannot read the input file '{$opts['i']}'");
}
if (!is_writable($params['output'])) {
exit("Cannot write to output directory '{$opts['o']}'");
}
if (!file_exists($params['output'] . '/thumbnails')) {
if (!mkdir($params['output'] . '/thumbnails')) {
exit("Could not create thumbnail output directory '{$params['output']}/thumbnails'");
}
}
$details = shell_exec(sprintf($commands['details'], $params['input']));
if ($details === null || !preg_match('/^(?:\s+)?ffmpeg version ([^\s,]*)/i', $details)) {
exit("Cannot find ffmpeg - try specifying the path in the \$params variable");
}
// determine some values we need
$time = $tbr = [];
preg_match('/Duration: ((\d+):(\d+):(\d+))\.\d+, start: ([^,]*)/is', $details, $time);
preg_match('/\b(\d+(?:\.\d+)?) tbr\b/', $details, $tbr);
$duration = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
$start = $time[5];
$tbr = $tbr[1];
// generate random poster if required
if (isset($opts['p'])) {
shell_exec(sprintf($commands['poster'], rand(1, $duration - 1), $opts['i'], $params['output']));
}
// generate all thumbnail images
$name = strtolower(substr(basename($opts['i']), 0, strrpos(basename($opts['i']), '.')));
if (isset($opts['d'])) {
$files = glob("{$params['output']}/thumbnails/{$name}-*.jpg");
foreach ($files as $f) {
unlink($f);
}
}
shell_exec(sprintf($commands['thumbs'],
$start + .0001, $params['input'], $params['thumbWidth'],
$params['timespan'] * $tbr, $params['output'], $name
));
$files = glob("{$params['output']}/thumbnails/{$name}-*.jpg");
if (!($total = count($files))) {
exit("Could not find any thumbnails matching '{$params['output']}/thumbnails/{$name}-*.jpg'");
}
// create coalesce image if needs be
if (!isset($opts['v'])) {
$thumbsAcross = min($total, $params['spriteWidth']);
$sizes = getimagesize($files[0]);
$rows = ceil($total/$thumbsAcross);
$w = $sizes[0] * $thumbsAcross;
$h = $sizes[1] * $rows;
$coalesce = imagecreatetruecolor($w, $h);
}
// generate vtt file, merge thumbnails if needs be
$vtt = "WEBVTT\n\n";
for ($rx = $ry = $s = $f = 0; $f < $total; $f++) {
$t1 = sprintf('%02d:%02d:%02d.000', ($s / 3600), ($s / 60 % 60), $s % 60);
$s += $params['timespan'];
$t2 = sprintf('%02d:%02d:%02d.000', ($s / 3600), ($s / 60 % 60), $s % 60);
if (isset($opts['v'])) {
$vtt .= "{$t1} --> {$t2}\nthumbnails/" . basename($files[$f]);
} else {
if ($f && !($f % $thumbsAcross)) {
$rx = 0;
++$ry;
}
imagecopymerge($coalesce, imagecreatefromjpeg($files[$f]), $rx * $sizes[0], $ry * $sizes[1], 0, 0, $sizes[0], $sizes[1], 100);
$vtt .= sprintf("%s --> %s\nthumbnails.jpg#xywh=%d,%d,%d,%d", $t1, $t2, $rx++ * $sizes[0], $ry * $sizes[1], $sizes[0], $sizes[1]);
}
$vtt .= "\n\n";
}
// tidy up
if (!isset($opts['v'])) {
imagejpeg($coalesce, "{$params['output']}/thumbnails.jpg", 100);
for ($s = 0, $f = 0; $f < $total; $f++) {
unlink($files[$f]);
}
}
file_put_contents("{$params['output']}/thumbnails.vtt", $vtt);
exit("Process completed. Check the output directory '{$params['output']}' for VTT file and images");

View File

@@ -0,0 +1,71 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
set_time_limit(0);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once 'f_core/f_classes/class.be.servers.php';
include_once 'f_core/f_classes/class_ftp/ftp_class.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
if (isset($_SERVER['argv'][1]) and isset($_SERVER['argv'][2]) and isset($_SERVER['argv'][3])) {
$file_type = $class_filter->clr_str($_SERVER['argv'][1]);
$file_id = $class_filter->clr_str($_SERVER['argv'][2]);
$user_key = $class_filter->clr_str($_SERVER['argv'][3]);
$server_id = intval($_SERVER['argv'][4]);
$do_tmb = intval($_SERVER['argv'][5]);
$data = $db->execute(sprintf("SELECT `file_title`, `thumb_cache` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $file_type, $file_id));
$file_title = $data->fields["file_title"];
$thumb_cache = $data->fields["thumb_cache"];
$thumb_cache = $thumb_cache > 1 ? $thumb_cache : null;
switch ($file_type[0]) {
case "v":
$_ext = '.360p.mp4';
break;
case "i":
$_ext = '.jpg';
break;
case "a":
$_ext = '.mp3';
break;
case "d":
$_ext = '.pdf';
break;
}
$file_name = $do_tmb == 0 ? md5($cfg["global_salt_key"] . $file_id) . $_ext : $file_id . '/0' . $thumb_cache . '.jpg';
$src_folder = $cfg["media_files_dir"] . '/' . $user_key . '/' . ($do_tmb == 0 ? $file_type[0] : 't') . '/';
$src = $src_folder . $file_name;
if (file_exists($src) && is_file($src)) {
$xfer = new fileTransfer();
if ($xfer->load($src, $file_type)) {
$xfer->log_setup($file_id, true);
$xfer->log("Preparing " . ($do_tmb == 1 ? 'thumb' : $file_type) . ": " . $file_title . "\n\n" . $xfer->get_data_string() . "\n");
$xfer->doTransfer($file_id, $user_key, $src, $server_id, $do_tmb);
} else {
$xfer->log('Failed to load file: ' . $src);
}
}
}

View File

@@ -0,0 +1,87 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.upload');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.account');
include_once $class_language->setLanguageFile('backend', 'language.import');
$error_message = '';
$notice_message = null;
$upload_type = $_GET["t"] != 'document' ? $class_filter->clr_str($_GET["t"]) : 'doc';
if (isset($_GET["t"])) {
if ($upload_type != 'video' and $upload_type != 'short' and $upload_type != 'audio' and $upload_type != 'image' and $upload_type != 'doc') {
header("Location: " . VHref::getKey("upload") . '?t=video');
exit;
}
}
$uid = (int) $_SESSION["USER_ID"];
$files = new VFiles;
if ($_POST and $_GET["do"] == 'form-update') {
foreach ($_POST['ekey'] as $k => $v) {
$name = $_POST['efile'][$k];
$name = (preg_match('/"/', $name) or preg_match('/`/', $name)) ? str_replace(array('"', '`'), array("'", "'"), $name) : $name;
$name = md5($class_filter->clr_str($name));
$sql = sprintf("SELECT `file_key` FROM `db_%sfiles` WHERE `usr_id`='%s' AND `file_hash`='%s' ORDER BY `db_id` DESC LIMIT 1;", $upload_type, $uid, $name);
$rs = $db->execute($sql);
$key = $rs->fields['file_key'];
$title = $class_filter->clr_str($_POST['c_entry_title'][$v]);
$descr = $class_filter->clr_str($_POST['c_entry_description'][$v]);
$tags = VForm::clearTag($_POST['c_entry_tags'][$v]);
$categ = (int) $_POST['c_entry_category'][$v];
$a = array('file_title' => $title, 'file_description' => $descr, 'file_tags' => $tags, 'file_category' => $categ);
foreach ($a as $field => $value) {
if ($value != '') {
$db->execute(sprintf("UPDATE `db_%sfiles` SET `%s`='%s' WHERE `usr_id`='%s' AND `file_key`='%s' LIMIT 1;", $upload_type, $field, $value, $uid, $key));
}
}
}
exit;
}
$type = VUpload::typeInit($upload_type == 'doc' ? 'document' : $upload_type);
$logged_in = VLogin::checkFrontend(VHref::getKey("upload") . ($type != '' ? '?t=' . $type : null));
$cfg = $class_database->getConfigurations('live_uploads,video_player,audio_player,multiple_file_uploads,video_file_types,video_limit,image_file_types,image_limit,audio_file_types,audio_limit,document_file_types,document_limit,file_counts,numeric_delimiter,file_responses,upload_category,import_yt,import_dm,import_vi,short_file_types,short_limit');
$init_cfg = ($error_message == '' and $type != '') ? VUpload::initCFG() : null;
$error_message = VUpload::verifiedEmailCheck();
$error_message = $error_message == '' ? VUseraccount::checkPerm('upload', $type[0]) : $error_message;
$check_section = ($error_message == '' and $_GET["t"] == '') ? VUpload::checkSection($type) : $error_message;
$membership_check = VLogin::checkSubscription();
switch ($_GET["do"]) {
case "reverify":
$rev = VUpload::processVerify();
break;
default:break;
}
if (isset($_GET["r"])) {
$responses = new VResponses();
}
$smarty->assign('user_key', $_SESSION["USER_KEY"]);
$smarty->assign('perm_err', VUseraccount::checkPerm('upload', $type[0]));
$display_page = (!isset($_GET["do"]) and !isset($_GET["cid"])) ? $class_smarty->displayPage('frontend', 'tpl_upload', $error_message, $notice_message) : null;

View File

@@ -0,0 +1,64 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.upload');
include_once $class_language->setLanguageFile('frontend', 'language.account');
$upload_type = $_GET["t"] != 'document' ? $class_filter->clr_str($_GET["t"]) : 'doc';
$upload_short = $upload_type == 'short';
$upload_module = $class_filter->clr_str($_GET["t"]);
$post_name = 'file';
$user_id = intval($_POST["UFUID"]);
$user_key = $class_filter->clr_str($_POST["UFSUID"]);
if (isset($_GET["t"])) {
if ($upload_type != 'video' and $upload_type != 'short' and $upload_type != 'audio' and $upload_type != 'image' and $upload_type != 'doc') {
header("Location: " . VHref::getKey("upload") . '?t=video');
exit;
}
}
$cfg = $class_database->getConfigurations('file_approval,conversion_' . $upload_module . '_que,' . $upload_module . '_limit');
$upload_file_size = intval($_POST["UFSIZE"]);
$upload_file_limit = $cfg[$upload_module . "_limit"] * 1024 * 1024;
switch ($_GET["do"]) {
case "reload-stats":
if ($cfg["paid_memberships"] == 1) {
echo $ht = VUseraccount::subscriptionStats(1);
echo $ht = VUpload::subscriptionCheck($upload_type, 1);
}
break;
}
if (($upload_file_size > $upload_file_limit) or ($cfg["paid_memberships"] == 1 and VUpload::subscriptionLimit($upload_type))) {
exit();
}
if (isset($_GET["r"])) {
$responses = new VResponses();
}
if (!isset($_GET["do"])) {
$db_id = VUpload::dbUpdate($upload_type, '', $user_id, $user_key, $upload_short);
$do_conversion = ($db_id != '' and $cfg["conversion_" . $upload_module . "_que"] == 0) ? VUpload::initConversion($db_id, $upload_type, '', $upload_short) : null;
}

View File

@@ -0,0 +1,162 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
sleep(1);
include_once 'f_core/config.core.php';
$post_name = 'file';
$upload_type = $_GET["t"] != 'document' ? $class_filter->clr_str($_GET["t"]) : 'doc';
if (isset($_GET["t"])) {
if ($upload_type != 'video' and $upload_type != 'short' and $upload_type != 'audio' and $upload_type != 'image' and $upload_type != 'doc') {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open input stream."}, "id" : "id"}');
}
}
// Make sure file is not cached (as it happens for example on iOS devices)
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
/*
// Support CORS
header("Access-Control-Allow-Origin: *");
// other CORS headers if any...
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
exit; // finish preflight CORS requests here
}
*/
// 5 minutes execution time
// @set_time_limit(5 * 60);
// Uncomment this one to fake upload time
// usleep(5000);
// Settings
$user_key = $class_filter->clr_str($_GET["u"]);
$targetDir = $cfg["upload_files_dir"] . '/' . $user_key . '/' . $upload_type[0];
$cleanupTargetDir = true; // Remove old files
$maxFileAge = 5 * 3600; // Temp file age in seconds
// Create target dir
if (!file_exists($targetDir)) {
@mkdir($targetDir);
}
// Get a file name
if (isset($_REQUEST["name"])) {
$fileName = $_REQUEST["name"];
} elseif (!empty($_FILES)) {
$fileName = $_FILES["file"]["name"];
} else {
$fileName = uniqid("file_");
}
$fileName = trim(pathinfo($fileName, PATHINFO_FILENAME) . '.' . strtolower(pathinfo($fileName, PATHINFO_EXTENSION)));
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
// Chunking might be enabled
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
// Remove old temp files
if ($cleanupTargetDir) {
if (!is_dir($targetDir) || !$dir = opendir($targetDir)) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
}
while (($file = readdir($dir)) !== false) {
$tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
// If temp file is current file proceed to the next
if ($tmpfilePath == "{$filePath}.part") {
continue;
}
// Remove temp file if it is older than the max age and is not the current file
if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge)) {
@unlink($tmpfilePath);
}
}
closedir($dir);
}
if (strpos(strtolower($fileName), '.php') !== false or strpos(strtolower($fileName), '.phar') !== false or strpos(strtolower($fileName), '.pl') !== false or strpos(strtolower($fileName), '.asp') !== false or strpos(strtolower($fileName), '.htm') !== false or strpos(strtolower($fileName), '.cgi') !== false or strpos(strtolower($fileName), '.py') !== false or strpos(strtolower($fileName), '.sh') !== false or strpos(strtolower($fileName), '.cin') !== false or strpos(strtolower($fileName), '.bin') !== false) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open input stream."}, "id" : "id"}');
}
// Open temp file
if (!$out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb")) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
if (!empty($_FILES)) {
if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
}
// Read binary input stream and append it to temp file
if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
} else {
if (!$in = @fopen("php://input", "rb")) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
}
}
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
@fclose($out);
@fclose($in);
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
// Strip the temp .part suffix off
$nfilePath = $targetDir . DIRECTORY_SEPARATOR . filesize("{$filePath}.part") . '.' . strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
rename("{$filePath}.part", $nfilePath);
if (!file_exists($nfilePath) or filesize($nfilePath) <= 16) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 106, "message": "Connection failure. Please check your connection and try again."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 106, "message": "Connection failure."}, "id" : "id"}');
}
if (preg_match('/"/', $nfilePath) or preg_match('/`/', $nfilePath)) {
$new_filePath = str_replace(array('"', '`'), array("'", "'"), $nfilePath);
rename($nfilePath, $new_filePath);
if (!file_exists($new_filePath) or filesize($new_filePath) <= 16) {
error_log('{"jsonrpc" : "2.0", "error" : {"code": 107, "message": "Connection failure. Please check your connection and try again."}, "id" : "id"}');
die('{"jsonrpc" : "2.0", "error" : {"code": 107, "message": "Connection failure."}, "id" : "id"}');
}
}
}
// Return Success JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

View File

@@ -0,0 +1,155 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
$main_dir = realpath(dirname(__FILE__) . '/../../../');
set_include_path($main_dir);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.email.notif');
include_once $class_language->setLanguageFile('frontend', 'language.userpage');
include_once $class_language->setLanguageFile('frontend', 'language.respond');
include_once $class_language->setLanguageFile('frontend', 'language.view');
include_once $class_language->setLanguageFile('frontend', 'language.signup');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('image_player,video_player,audio_player,document_player,paid_memberships,file_downloads,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,channel_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,user_blocking,file_flagging,file_email_sharing,file_permalink_sharing,fcc_limit,file_comment_min_length,file_comment_max_length,file_comment_spam,file_download_s1,file_download_s2,file_download_s3,file_download_s4,file_download_reg,user_subscriptions,backend_email,guest_view_video,guest_view_image,guest_view_audio,guest_view_doc,guest_view_blog,affiliate_tracking_id,affiliate_module,conversion_video_previews,conversion_audio_previews,conversion_doc_previews,conversion_image_previews,conversion_live_previews,guest_view_live,guest_view_short');
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
if ($_GET["g"] == 1) {
//for seo mod_rewrite rules
include 'f_core/config.href.php';
$section = $href["watch"];
}
$view = new VView();
$vfiles = new VFiles();
$vbrowse = new VBrowse();
if ($cfg["file_responses"] == 1) {
$vresponses = new VResponses();
}
if (isset($_POST["ec"])) {
echo VView::getEmbedCodeFromURL();
exit;
}
switch ($_GET["do"]) {
case "side-column":
case "recommend-suggested":
case "recommend-user":
case "recommend-category":
case "recommend-recent":
case "recommend-watched":
echo $do_load = VView::sideColumn(true);
break;
case "resp-clear": //delete response
echo $do_load = VResponses::delResponse();
break;
case "comm-suspend": //suspend comments
case "comm-approve": //approve comments
case "comm-spam": //report spam
case "comm-delete": //delete comments
case "comm-like": //like
case "comm-dislike": //dislike
case "comm-edit": //edit
case "comm-pin": //pin
case "comm-unpin": //unpin
echo $do_load = VComments::commentActions($_GET["do"]);
break;
case "comm-sort": //load/reload after sorting
case "comm-load": //load/reload after posting, etc
echo $do_load = VComments::browseComment();
break;
case "comm-post": //post comments
case "comm-reply": //reply comments
echo $do_load = VComments::postComment();
break;
case "response-load": //load responses
echo $do_load = '';
break;
case "user-files": //load user files
echo $do_load = VView::loadUserFiles();
break;
case "load-more": //load more files
echo $do_load = VView::loadMoreFiles();
break;
case "featured-files": //load featured files
echo $do_load = VView::loadFeaturedFiles();
break;
case "user-sub": //subscribe to file owner
echo $do_load = VView::chSubscribe('', (int) $_POST["uf_vuid"]);
break;
case "user-unsub": //unsubscribe
echo $do_load = VView::chSubscribe(1, (int) $_POST["uf_vuid"]);
break;
case "user-follow": //follow file owner
echo $do_load = VView::chSubscribe('', (int) $_POST["uf_vuid"], true);
break;
case "user-unfollow": //unfollow
echo $do_load = VView::chSubscribe(1, (int) $_POST["uf_vuid"], true);
break;
case "user-unsubscribe":
echo $do_load = VSubscriber::unsub_request((int) $_POST["uf_vuid"]);
break;
case "unsub-option": //unsub html
echo $do_load = VView::subHtml(1);
break;
case "sub-option": //sub html
echo $do_load = VView::subHtml();
break;
case "sub-continue": //sub paypal
echo $do_load = VView::subContinue();
break;
case "ipn": //verify paypal
echo $do_load = VView::verifyPP();
break;
case "cb-favadd": //file menu - add to favorites
case "cb-favclear": //file menu - add to favorites
case "cb-labeladd": //file menu - add to playlists
case "cb-labelclear": //file menu - clear playlists
case "cb-watchadd": //file menu - add to watchlist
case "cb-watchclear": //file menu - add to watchlist
$do_load = VFiles::doActions($_GET["do"]);
break;
case "file-share": //share file via email
echo $do_load = VFiles::plMail();
break;
case "file-like": //like file
case "file-dislike": //like file
echo $do_load = VView::likeAction($_GET["do"]);
break;
default: //file flagging
$do_load = (substr($_GET["do"], 0, 9) == 'file-flag') ? VView::fileFlagging(intval(substr($_GET["do"], 9))) : null;
break;
}
if (!isset($_GET["s"]) and !isset($_GET["do"])) {
$mob = $smarty->assign('is_mobile', VHref::isAnyMobile());
$file_info = VView::getFileInfo();
$smarty->assign('c_section', VHref::getKey("watch"));
$smarty->assign('tpl_section', "tpl_view");
$display_page = $class_smarty->displayPage('frontend', 'tpl_view', $error_message, $notice_message);
}

View File

@@ -0,0 +1,68 @@
<?php
/*******************************************************************************************************************
| Software Name : EasyStream
| Software Description : High End YouTube Clone Script with Videos, Shorts, Streams, Images, Audio, Documents, Blogs
| Software Author : (c) Sami Ahmed
|*******************************************************************************************************************
|
|*******************************************************************************************************************
| This source file is subject to the EasyStream Proprietary License Agreement.
|
| By using this software, you acknowledge having read this Agreement and agree to be bound thereby.
|*******************************************************************************************************************
| Copyright (c) 2025 Sami Ahmed. All rights reserved.
|*******************************************************************************************************************/
define('_ISVALID', true);
include_once 'f_core/config.core.php';
include_once $class_language->setLanguageFile('frontend', 'language.global');
include_once $class_language->setLanguageFile('frontend', 'language.files');
include_once $class_language->setLanguageFile('frontend', 'language.files.menu');
include_once $class_language->setLanguageFile('frontend', 'language.notifications');
include_once $class_language->setLanguageFile('frontend', 'language.userpage');
include_once $class_language->setLanguageFile('frontend', 'language.view');
$error_message = null;
$notice_message = null;
$cfg = $class_database->getConfigurations('paid_memberships,file_counts,file_comments,channel_comments,file_comment_votes,file_responses,file_rating,file_favorites,file_deleting,file_delete_method,file_privacy,file_playlists,file_views,file_history,file_watchlist,file_embedding,file_social_sharing,message_count,server_path_php,thumbs_width,thumbs_height,user_blocking,file_flagging,file_email_sharing,file_permalink_sharing,fcc_limit,file_comment_min_length,file_comment_max_length,file_comment_spam,ucc_limit,comment_min_length,comment_max_length');
$notifier = new VNotify;
$membership_check = ($cfg["paid_memberships"] == 1 and $_SESSION["USER_ID"] > 0) ? VLogin::checkSubscription() : null;
$view = new VView;
$vfiles = new VFiles;
$vbrowse = new VBrowse;
if (isset($_GET["c"]) and (int) $_GET["c"] > 0) {
$class = 'VChannelComments';
new $class;
} else {
$class = 'VComments';
}
switch ($_GET["do"]) {
case "comm-suspend": //suspend comments
case "comm-approve": //approve comments
case "comm-spam": //report spam
case "comm-delete": //delete comments
case "comm-like": //like
case "comm-dislike": //dislike
case "comm-edit": //edit
case "comm-pin": //pin
case "comm-unpin": //unpin
echo $do_load = $class::commentActions($_GET["do"]);
break;
case "comm-load": //load/reload after posting, etc
case "comm-sort": //load/reload after sorting
echo $do_load = $class::browseComment();
break;
case "comm-post": //post comments
case "comm-reply": //reply comments
echo $do_load = $class::postComment();
break;
}
$display_page = (!isset($_GET["s"]) and !isset($_GET["do"])) ? $class_smarty->displayPage('frontend', 'tpl_comments', $error_message, $notice_message) : null;