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:
77
f_modules/m_backend/m_tools/m_upload/import.php
Normal file
77
f_modules/m_backend/m_tools/m_upload/import.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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);
|
||||
define('_ISADMIN', 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.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('frontend', 'language.upload');
|
||||
include_once $class_language->setLanguageFile('frontend', 'language.account');
|
||||
include_once $class_language->setLanguageFile('backend', 'language.import');
|
||||
include_once $class_language->setLanguageFile('backend', 'language.settings.entries');
|
||||
include_once $class_language->setLanguageFile('backend', 'language.advertising');
|
||||
|
||||
$error_message = null;
|
||||
$notice_message = null;
|
||||
$logged_in = VLogin::checkBackend(VHref::getKey("be_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,video_player,audio_player');
|
||||
$side = (strstr($_SERVER['REQUEST_URI'], $backend_access_url) == true) ? 'backend' : 'frontend';
|
||||
$error_message = VImport::chkAccount();
|
||||
$smarty->assign('tpl_error_max', $error_message);
|
||||
|
||||
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;
|
||||
case "autocomplete": //autocomplete username
|
||||
$ht = VGenerate::processAutoComplete('import');
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
$display_page = ($_GET["do"] == '') ? $class_smarty->displayPage('backend', 'backend_tpl_import', $error_message, $notice_message) : null;
|
||||
77
f_modules/m_backend/m_tools/m_upload/upload.php
Normal file
77
f_modules/m_backend/m_tools/m_upload/upload.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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);
|
||||
define('_ISADMIN', 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');
|
||||
include_once $class_language->setLanguageFile('backend', 'language.settings.entries');
|
||||
include_once $class_language->setLanguageFile('backend', 'language.advertising');
|
||||
|
||||
$error_message = null;
|
||||
$notice_message = null;
|
||||
$upload_type = $_GET["t"] != 'document' ? $class_filter->clr_str($_GET["t"]) : 'doc';
|
||||
$logged_in = VLogin::checkBackend(VHref::getKey("be_upload") . '?t=' . $upload_type);
|
||||
$cfg = $class_database->getConfigurations('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');
|
||||
|
||||
$files = new VFiles;
|
||||
|
||||
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("be_upload") . '?t=video');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
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 `file_hash`='%s' ORDER BY `db_id` DESC LIMIT 1;", $upload_type, $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 `file_key`='%s' LIMIT 1;", $upload_type, $field, $value, $key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
switch ($_GET["do"]) {
|
||||
case "autocomplete": //autocomplete username
|
||||
$ht = VGenerate::processAutoComplete('upload');
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
$init_cfg = ($error_message == '' and $_GET["t"] != '') ? VUpload::initCFG(1) : null;
|
||||
$display_page = ($_GET["do"] == '' and $_GET["cid"] == '') ? $class_smarty->displayPage('backend', 'backend_tpl_upload', $error_message, $notice_message) : null;
|
||||
44
f_modules/m_backend/m_tools/m_upload/upload_form.php
Normal file
44
f_modules/m_backend/m_tools/m_upload/upload_form.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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';
|
||||
|
||||
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("be_upload") . '?t=video');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$user_key = $class_filter->clr_str($_POST["assign_username"]);
|
||||
$_SESSION["file_owner"] = $user_key;
|
||||
$cfg = $class_database->getConfigurations('file_approval,conversion_' . $class_filter->clr_str($_GET["t"]) . '_que,' . $class_filter->clr_str($_GET["t"]) . '_limit');
|
||||
|
||||
$upload_file_size = intval($_POST["UFSIZE"]);
|
||||
$upload_file_limit = $cfg[$class_filter->clr_str($_GET["t"]) . "_limit"] * 1024 * 1024;
|
||||
|
||||
$db_id = VUpload::dbUpdate($upload_type, 1, '', $user_key, $upload_short);
|
||||
$do_conversion = ($db_id != '' and $cfg["conversion_" . $class_filter->clr_str($_GET["t"]) . "_que"] == 0) ? VUpload::initConversion($db_id, $upload_type, 1, $upload_short) : null;
|
||||
162
f_modules/m_backend/m_tools/m_upload/uploader.php
Normal file
162
f_modules/m_backend/m_tools/m_upload/uploader.php
Normal 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($_REQUEST["UFSUID"]);
|
||||
|
||||
$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"}');
|
||||
Reference in New Issue
Block a user