diff --git a/controller/ftpdownloader.php b/controller/ftpdownloader.php index 3352c00..0c58a8e 100644 --- a/controller/ftpdownloader.php +++ b/controller/ftpdownloader.php @@ -127,6 +127,16 @@ public function Add () $OPTIONS['ftp-user'] = $_POST['OPTIONS']['FTPUser']; $OPTIONS['ftp-passwd'] = $_POST['OPTIONS']['FTPPasswd']; } + if (isset ($_POST['OPTIONS']['FTPReferer']) && strlen (trim ($_POST['OPTIONS']['FTPReferer'])) > 0) + { + $OPTIONS['referer'] = $_POST['OPTIONS']['FTPReferer']; + } + + if (isset ($_POST['OPTIONS']['FTPUseragent']) && strlen (trim ($_POST['OPTIONS']['FTPUseragent'])) > 0) + { + $OPTIONS['user-agent'] = $_POST['OPTIONS']['FTPUseragent']; + } + if (isset ($_POST['OPTIONS']['FTPPasv']) && strlen (trim ($_POST['OPTIONS']['FTPPasv'])) > 0) { $OPTIONS['ftp-pasv'] = strcmp ($_POST['OPTIONS']['FTPPasv'], "true") == 0 ? true : false; @@ -205,4 +215,4 @@ public function Add () return new JSONResponse (Array ('ERROR' => true, 'MESSAGE' => (string)$this->L10N->t ('Please check the URL you\'ve just provided'))); } } -} \ No newline at end of file +} diff --git a/js/add.js b/js/add.js index 3b359a1..01a9594 100644 --- a/js/add.js +++ b/js/add.js @@ -94,7 +94,9 @@ $(document).ready (function () { FTPUser: $('#option-ftp-user').val (), FTPPasswd: $('#option-ftp-pwd').val (), - FTPPasv: $('#option-ftp-pasv').prop ('checked') + FTPPasv: $('#option-ftp-pasv').prop ('checked'), + FTPReferer: $('#option-ftp-referer').val (), + FTPUseragent: $('#option-ftp-useragent').val () }); } else @@ -106,6 +108,8 @@ $(document).ready (function () $('#option-ftp-user').val (''); $('#option-ftp-pwd').val (''); $('#option-ftp-pasv').prop ('checked', true); + $('#option-ftp-referer').val (''); + $('#option-ftp-useragent').val (''); }); // Launch YT download diff --git a/js/add.min.js b/js/add.min.js index 1b6593e..3b04582 100644 --- a/js/add.min.js +++ b/js/add.min.js @@ -7,4 +7,4 @@ * @author Xavier Beurois * @copyright Xavier Beurois 2015 */ -$(document).ready(function(){$("#ball").Badger("..."),$("#bcompletes").Badger("..."),$("#bactives").Badger("..."),$("#bwaitings").Badger("..."),$("#bstopped").Badger("..."),$("#bremoved").Badger("..."),OCDLR.Utils.UpdateQueue(!0,"add"),$("#NewDL").bind("click",function(){$(this).children("ul").is(":visible")?$(this).children("ul").hide():$(this).children("ul").show()}),$("#NewDL").children("div").children("p").bind("click",function(){$("#app-content-wrapper .content-page").hide(),$("#app-content-wrapper .content-page[rel="+$(this).attr("data-rel")+"]").show()}),$("#NewDL").children("div").bind("click",function(){$("#app-content-wrapper .content-page").hide(),$("#app-content-wrapper .content-page[rel="+$(this).attr("data-rel")+"]").show()}),$("#option-ftp-pasv").prop("checked",!0),$("#option-yt-extractaudio").prop("checked",!1),$("#option-yt-forceipv4").prop("checked",!0),$("#option-bt-rmtorrent").prop("checked",!0),$("#TorrentsList").bind("click",function(){OCDLR.Utils.GetTorrentsList($(this).children("ul"))}),$("#app-content-wrapper .content-page[rel=OCDHTTP] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"http",e.val(),{HTTPUser:$("#option-http-user").val(),HTTPPasswd:$("#option-http-pwd").val(),HTTPReferer:$("#option-http-referer").val(),HTTPUseragent:$("#option-http-useragent").val()}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-http-user").val(""),$("#option-http-pwd").val(""),$("#option-http-referer").val(""),$("#option-http-useragent").val("")}),$("#app-content-wrapper .content-page[rel=OCDFTP] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"ftp",e.val(),{FTPUser:$("#option-ftp-user").val(),FTPPasswd:$("#option-ftp-pwd").val(),FTPPasv:$("#option-ftp-pasv").prop("checked")}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-ftp-user").val(""),$("#option-ftp-pwd").val(""),$("#option-ftp-pasv").prop("checked",!0)}),$("#app-content-wrapper .content-page[rel=OCDYT] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"yt",e.val(),{YTExtractAudio:$("#option-yt-extractaudio").prop("checked"),YTForceIPv4:$("#option-yt-forceipv4").prop("checked")}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-yt-extractaudio").prop("checked",!1),$("#option-yt-forceipv4").prop("checked",!0)}),$("#app-content-wrapper .content-page[rel=OCDBT] div.launch").bind("click",function(){var e=$("#TorrentsList").children("a"),o=t("ocdownloader","Select a file.torrent");e.text().trim()!=o.trim()&&"File"==e.prop("data-rel")&&OCDLR.Utils.AddDownload($(this),"bt",e.text(),{BTRMTorrent:$("#option-bt-rmtorrent").prop("checked")}),e.text(o),$("#option-bt-rmtorrent").prop("checked",!0)});var e=$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile #uploadfile").fileupload({autoUpload:!0,sequentialUploads:!0,type:"POST",dataType:"json"});e.on("fileuploadstart",function(t,e){$("#TorrentsList").children("ul").hide(),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").removeClass("icon-upload"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").addClass("icon-loading-small"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile input").prop("disabled",!0)}),e.on("fileuploaddone",function(t,e){e.result.ERROR?OCDLR.Utils.PrintError(e.result.MESSAGE):OCDLR.Utils.PrintInfo(e.result.MESSAGE),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile input").prop("disabled",!1),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").removeClass("icon-loading-small"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").addClass("icon-upload")}),e.on("fileuploadfail",function(e,o){OCDLR.Utils.PrintError(t("ocdownloader","Error while uploading torrent file"))}),OCDLR.Utils.GetCounters()}); + $(document).ready(function(){$("#ball").Badger("..."),$("#bcompletes").Badger("..."),$("#bactives").Badger("..."),$("#bwaitings").Badger("..."),$("#bstopped").Badger("..."),$("#bremoved").Badger("..."),OCDLR.Utils.UpdateQueue(!0,"add"),$("#NewDL").bind("click",function(){$(this).children("ul").is(":visible")?$(this).children("ul").hide():$(this).children("ul").show()}),$("#NewDL").children("div").children("p").bind("click",function(){$("#app-content-wrapper .content-page").hide(),$("#app-content-wrapper .content-page[rel="+$(this).attr("data-rel")+"]").show()}),$("#NewDL").children("div").bind("click",function(){$("#app-content-wrapper .content-page").hide(),$("#app-content-wrapper .content-page[rel="+$(this).attr("data-rel")+"]").show()}),$("#option-ftp-pasv").prop("checked",!0),$("#option-yt-extractaudio").prop("checked",!1),$("#option-yt-forceipv4").prop("checked",!0),$("#option-bt-rmtorrent").prop("checked",!0),$("#TorrentsList").bind("click",function(){OCDLR.Utils.GetTorrentsList($(this).children("ul"))}),$("#app-content-wrapper .content-page[rel=OCDHTTP] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"http",e.val(),{HTTPUser:$("#option-http-user").val(),HTTPPasswd:$("#option-http-pwd").val(),HTTPReferer:$("#option-http-referer").val(),HTTPUseragent:$("#option-http-useragent").val()}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-http-user").val(""),$("#option-http-pwd").val(""),$("#option-http-referer").val(""),$("#option-http-useragent").val("")}),$("#app-content-wrapper .content-page[rel=OCDFTP] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"ftp",e.val(),{FTPUser:$("#option-ftp-user").val(),FTPPasswd:$("#option-ftp-pwd").val(),FTPPasv:$("#option-ftp-pasv").prop("checked"),FTPReferer:$("#option-ftp-referer").val(),FTPUseragent:$("#option-ftp-useragent").val()}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-ftp-user").val(""),$("#option-ftp-pwd").val(""),$("#option-ftp-pasv").prop("checked",!0),$("#option-ftp-referer").val(""),$("#option-ftp-useragent").val("")}),$("#app-content-wrapper .content-page[rel=OCDYT] div.launch").bind("click",function(){var e=$(this).parent().parent().children("input.url");OCDLR.Utils.ValidURL(e.val())?OCDLR.Utils.AddDownload($(this),"yt",e.val(),{YTExtractAudio:$("#option-yt-extractaudio").prop("checked"),YTForceIPv4:$("#option-yt-forceipv4").prop("checked")}):OCDLR.Utils.PrintError(t("ocdownloader","Invalid URL. Please check the address of the file ...")),e.val(""),$("#option-yt-extractaudio").prop("checked",!1),$("#option-yt-forceipv4").prop("checked",!0)}),$("#app-content-wrapper .content-page[rel=OCDBT] div.launch").bind("click",function(){var e=$("#TorrentsList").children("a"),o=t("ocdownloader","Select a file.torrent");e.text().trim()!=o.trim()&&"File"==e.prop("data-rel")&&OCDLR.Utils.AddDownload($(this),"bt",e.text(),{BTRMTorrent:$("#option-bt-rmtorrent").prop("checked")}),e.text(o),$("#option-bt-rmtorrent").prop("checked",!0)});var e=$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile #uploadfile").fileupload({autoUpload:!0,sequentialUploads:!0,type:"POST",dataType:"json"});e.on("fileuploadstart",function(t,e){$("#TorrentsList").children("ul").hide(),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").removeClass("icon-upload"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").addClass("icon-loading-small"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile input").prop("disabled",!0)}),e.on("fileuploaddone",function(t,e){e.result.ERROR?OCDLR.Utils.PrintError(e.result.MESSAGE):OCDLR.Utils.PrintInfo(e.result.MESSAGE),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile input").prop("disabled",!1),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").removeClass("icon-loading-small"),$("#app-content-wrapper .content-page[rel=OCDBT] div.uploadfile label").addClass("icon-upload")}),e.on("fileuploadfail",function(e,o){OCDLR.Utils.PrintError(t("ocdownloader","Error while uploading torrent file"))}),OCDLR.Utils.GetCounters()}); diff --git a/templates/add.php b/templates/add.php index f9cf0f5..738fe22 100644 --- a/templates/add.php +++ b/templates/add.php @@ -86,6 +86,8 @@
+ +