Skip to content

Commit

Permalink
Making the code ready for FTP plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Dec 4, 2018
1 parent 50999e1 commit 1d6d5cd
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 47 deletions.
88 changes: 45 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
/nbproject/private/
/videos/
/nbproject/
/plugin/LiveOnlineUsers/
/plugin/LiveUsers/
/plugin/VideoResolutionSwitcher/
/plugin/AudioTrackSwitcher/
/plugin/Customize/
/plugin/VideoThumbnails/
/plugin/MP4ThumbsAndGif/
/plugin/MP4ThumbsAndGifLocal/
/plugin/PayPalToWatch/
/plugin/predefinedCategory/
/plugin/SecureVideosDirectory/
/plugin/PointsSystem/
/plugin/GoogleAds_IMA/
/plugin/LoginLDAP/
/plugin/SendRecordedToEncoder/
/plugin/SupportAuthor/
/plugin/CountryRedirect/
/plugin/SubtitleSwitcher/
/plugin/AWS_S3/
/plugin/SignUpAgreement/
/plugin/PromoteVideos/
/plugin/Livesearch/
/plugin/AudioVisualizer/
/plugin/Notifications/
/plugin/DIY/
/plugin/AutoShare/
/plugin/LiveCountdownEvent/
/plugin/ReturnToLastPosition/
/plugin/SecondWatch/
/plugin/Tecorio/
/plugin/AD_Server_Promote_Videos/
/plugin/Blackblaze_B2/
/plugin/VideoDocuments/
/plugin/VideoSpeed/
/plugin/FTPAutoImport/
/plugin/IPDirectConnect/
/plugin/Bookmark/
/plugin/Subscription/
/plugin/LifeStreamLayout/
/plugin/Backup/
/nbproject/private/
/videos/
/nbproject/
/plugin/LiveOnlineUsers/
/plugin/LiveUsers/
/plugin/VideoResolutionSwitcher/
/plugin/AudioTrackSwitcher/
/plugin/Customize/
/plugin/VideoThumbnails/
/plugin/MP4ThumbsAndGif/
/plugin/MP4ThumbsAndGifLocal/
/plugin/PayPalToWatch/
/plugin/predefinedCategory/
/plugin/SecureVideosDirectory/
/plugin/PointsSystem/
/plugin/GoogleAds_IMA/
/plugin/LoginLDAP/
/plugin/SendRecordedToEncoder/
/plugin/SupportAuthor/
/plugin/CountryRedirect/
/plugin/SubtitleSwitcher/
/plugin/AWS_S3/
/plugin/SignUpAgreement/
/plugin/PromoteVideos/
/plugin/Livesearch/
/plugin/AudioVisualizer/
/plugin/Notifications/
/plugin/DIY/
/plugin/AutoShare/
/plugin/LiveCountdownEvent/
/plugin/ReturnToLastPosition/
/plugin/SecondWatch/
/plugin/Tecorio/
/plugin/AD_Server_Promote_Videos/
/plugin/Blackblaze_B2/
/plugin/VideoDocuments/
/plugin/VideoSpeed/
/plugin/FTPAutoImport/
/plugin/IPDirectConnect/
/plugin/Bookmark/
/plugin/Subscription/
/plugin/LifeStreamLayout/
/plugin/Backup/
/plugin/FTP_Storage/
/plugin/SecondLife/
8 changes: 4 additions & 4 deletions admin/storage_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><i class="fas fa-hdd"></i> FTP <div class="pull-right"><?php echo getPluginSwitch('FTP'); ?></div></div>
<div class="panel-heading"><i class="fas fa-hdd"></i> FTP <div class="pull-right"><?php echo getPluginSwitch('FTP_Storage'); ?></div></div>
<div class="panel-body" style="overflow: hidden;">
<div class="alert alert-danger">
This plugin still under development, it will come soon
</div>
<?php
createTable("FTP_Storage");
?>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions locale/br.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
$t['Admin'] = "Admin";
$t['Advanced Configuration'] = "Configuração Avançada";
$t['Advanced configuration'] = "Configuração avançada";
$t['ago'] = "atrás";
$t['Are you sure?'] = "Você tem certeza?";
$t['Audio only'] = "Somente Audio";
$t['Audios and Videos'] = "Audios e Vídeos";
Expand Down
6 changes: 6 additions & 0 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,13 @@ function decideMoveUploadedToVideos($tmp_name, $filename) {
$obj = new stdClass();
$aws_s3 = YouPHPTubePlugin::loadPluginIfEnabled('AWS_S3');
$bb_b2 = YouPHPTubePlugin::loadPluginIfEnabled('Blackblaze_B2');
$ftp = YouPHPTubePlugin::loadPluginIfEnabled('FTP_Storage');
if (!empty($aws_s3)) {
$aws_s3->move_uploaded_file($tmp_name, $filename);
} else if (!empty($bb_b2)) {
$bb_b2->move_uploaded_file($tmp_name, $filename);
} else if (!empty($ftp)) {
$ftp->move_uploaded_file($tmp_name, $filename);
} else {
if (!move_uploaded_file($tmp_name, "{$global['systemRootPath']}videos/{$filename}")) {
if (!rename($tmp_name, "{$global['systemRootPath']}videos/{$filename}")) {
Expand All @@ -847,10 +850,13 @@ function decideFile_put_contentsToVideos($tmp_name, $filename) {
global $global;
$aws_s3 = YouPHPTubePlugin::loadPluginIfEnabled('AWS_S3');
$bb_b2 = YouPHPTubePlugin::loadPluginIfEnabled('Blackblaze_B2');
$ftp = YouPHPTubePlugin::loadPluginIfEnabled('FTP_Storage');
if (!empty($bb_b2)) {
$bb_b2->move_uploaded_file($tmp_name, $filename);
} else if (!empty($aws_s3)) {
$aws_s3->move_uploaded_file($tmp_name, $filename);
} else if (!empty($ftp)) {
$ftp->move_uploaded_file($tmp_name, $filename);
} else {
if (!move_uploaded_file($tmp_name, "{$global['systemRootPath']}videos/{$filename}")) {
$obj->msg = "Error on move_uploaded_file({$tmp_name}, {$global['systemRootPath']}videos/{$filename})";
Expand Down
9 changes: 9 additions & 0 deletions objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,12 +1021,16 @@ function delete() {
$this->removeFiles($video['filename']);
$aws_s3 = YouPHPTubePlugin::loadPluginIfEnabled('AWS_S3');
$bb_b2 = YouPHPTubePlugin::loadPluginIfEnabled('Blackblaze_B2');
$ftp = YouPHPTubePlugin::loadPluginIfEnabled('FTP_Storage');
if (!empty($aws_s3)) {
$aws_s3->removeFiles($video['filename']);
}
if (!empty($bb_b2)) {
$bb_b2->removeFiles($video['filename']);
}
if (!empty($ftp)) {
$ftp->removeFiles($video['filename']);
}
}
return $resp;
}
Expand Down Expand Up @@ -1688,6 +1692,7 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
*/
$aws_s3 = YouPHPTubePlugin::loadPluginIfEnabled('AWS_S3');
$bb_b2 = YouPHPTubePlugin::loadPluginIfEnabled('Blackblaze_B2');
$ftp = YouPHPTubePlugin::loadPluginIfEnabled('FTP_Storage');
if (!empty($aws_s3)) {
$aws_s3_obj = $aws_s3->getDataObject();
if (!empty($aws_s3_obj->useS3DirectLink)) {
Expand All @@ -1698,6 +1703,8 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
if (!empty($bb_b2_obj->useDirectLink)) {
$includeS3 = true;
}
}else if (!empty($ftp)) {
$includeS3 = true;
}
$token = "";
$secure = YouPHPTubePlugin::loadPluginIfEnabled('SecureVideosDirectory');
Expand All @@ -1714,6 +1721,8 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
$source = $aws_s3->getAddress("{$filename}{$type}");
} else if (!empty($bb_b2)) {
$source = $bb_b2->getAddress("{$filename}{$type}");
} else if (!empty($ftp)) {
$source = $ftp->getAddress("{$filename}{$type}");
}
}
}
Expand Down

0 comments on commit 1d6d5cd

Please sign in to comment.