From de5611a88849be4b6131d720cdccb717e51ed972 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 23 Dec 2012 18:09:58 +0100 Subject: [PATCH] maj du 22.12.2012 --- oc454/README | 21 +- .../files_sharing_widget/js/widget.full.js | 44 ++- oc454/apps/files_sharing_widget/js/widget.js | 2 +- .../files_sharing_widget/lib/widgethelper.php | 54 +-- oc454/apps/files_sharing_widget/public.php | 34 +- .../templates/settings.php | 21 +- oc454/lib/base.min.php | 362 ++++++++++++++++++ oc454/widget.php | 30 ++ 8 files changed, 485 insertions(+), 83 deletions(-) create mode 100644 oc454/lib/base.min.php create mode 100644 oc454/widget.php diff --git a/oc454/README b/oc454/README index 6fe6db9..aaea657 100644 --- a/oc454/README +++ b/oc454/README @@ -7,11 +7,24 @@ Tested for OC4.5.4 Install instructions And Now also for OC4.5 That's all and now when you sharing a folder of images with subfolders you have a nice webwidget gallery. -[UPDATE] -If you have another apps directory as default (apps) where files_sharing_widget would be installed than you have to change the appspath -in the widgetloader.php [NEW Features] Now you can use The Gallery Widget in an other apps folder (e.g. apps2) if this is in config.php iconfigurated Now you can create your own Watermark text to the pictures (Copyright Hint) -New Js Engine in the widget.js \ No newline at end of file +New Js Engine in the widget.js + +[DEMOS] +On the right side the pics direct loaded from Owncloud Share Widget +http://www.coding-schmiede.de/ + +http://showcase.libasys.de/widget/ + +Click on the Button the widget will be shown +http://showcase.libasys.de/widgetdemo/ + +Integration the Widget on Facebook [password protected] +Pass:facebook +http://www.facebook.com/pages/Libasys/212217432121922?sk=app_390630084348208 + +Shared by a Link direct +https://ssl.webpack.de/demo.libasyscloud.de/widget.php?action=real&iToken=ZI5%2BKcT%2FIF5CQUeEOk2%2F%2B2UPO6EEAMULrGyHGLSctBM%3D \ No newline at end of file diff --git a/oc454/apps/files_sharing_widget/js/widget.full.js b/oc454/apps/files_sharing_widget/js/widget.full.js index b71a7b6..3f497ec 100644 --- a/oc454/apps/files_sharing_widget/js/widget.full.js +++ b/oc454/apps/files_sharing_widget/js/widget.full.js @@ -13,7 +13,7 @@ if (window.jQuery === undefined || window.jQuery.fn.jquery !== "1.8.2") { var script_tag = document.createElement("script"); script_tag.setAttribute("type", "text/javascript"); - script_tag.setAttribute("src",ownWidgetOptions.appspath+ "/js/jquery-pack.min.js"); + script_tag.setAttribute("src",ownWidgetOptions.path + ownWidgetOptions.appspath+ "/files_sharing_widget/js/jquery-pack.min.js"); if (script_tag.readyState) { script_tag.onreadystatechange = function() { @@ -50,7 +50,11 @@ // if($.browser.msie && $.browser.version<9){ //widgetContainer.css('opacity',0.3); // } - OwnWidget.init(ownWidgetOptions); + if(ownWidgetOptions.showButtonLink!=undefined){ + OwnWidget.prepareExternLink(ownWidgetOptions); + }else{ + if($("#ownWidget-container").length>0) OwnWidget.init(ownWidgetOptions); + } }); } @@ -60,7 +64,10 @@ var OwnWidget={ var defaults={ crypt:'', path:'', - appspath:'', // + appspath:'apps', + showButtonLink:'', + customThumbHeight:'', + customThumbpPage:'', display:'', fbAppid:'', modal:true, @@ -83,12 +90,24 @@ var OwnWidget={ } else { this.showWidget(); } - this.initSupersized() + this.initSupersized(); + + }, + prepareExternLink:function(options){ + var self=this; + + if(options.showButtonLink!=''){ + jQuery('#'+options.showButtonLink).click(function(){ + clearTimeout(timeout); + var timeout=setTimeout(function(){self.init(options);}, 500); + + + }); + } }, - loadCssFile:function(){ if(jQuery('#ownWidgetCss').length<1){ - jQuery("", {id:'ownWidgetCss',rel : "stylesheet",type : "text/css",href :this.options.appspath + "/css/widget.css"}).appendTo("head"); + jQuery("", {id:'ownWidgetCss',rel : "stylesheet",type : "text/css",href :this.options.path + this.options.appspath+ "/files_sharing_widget/css/widget.css"}).appendTo("head"); } }, @@ -206,10 +225,16 @@ var OwnWidget={ loadData:function() { var self = this; + var addCustomThumbSize=''; + if(this.options.customThumbHeight!='') addCustomThumbSize='&cTh='+this.options.customThumbHeight; + + var addCustomThumbPage=''; + if(this.options.customThumbpPage!='') addCustomThumbPage='&cTpP='+this.options.customThumbpPage; + //customThumbpPage jQuery.ajax({ dataType : "jsonp", jsonp : "jsonp_callback", - url : self.options.path + "/public.php?service=pics&iToken=" + rawurlencode(self.options.crypt) + self.loadPage, + url : self.options.path + "widget.php?iToken=" + rawurlencode(self.options.crypt) + self.loadPage+addCustomThumbSize+addCustomThumbPage, success : function(data) { @@ -241,6 +266,7 @@ var OwnWidget={ self.widgetContainer.css(self.options.cssAddWidget); if (!self.options.cssAddWidget.top && !self.options.cssAddWidget.left) { + self.widgetContainer.css({ top : (jQuery(window).height() / 2) - (self.widgetContainer.height() / 2), left : (jQuery(window).width() / 2) - (self.widgetContainer.width() / 2) @@ -289,7 +315,7 @@ var OwnWidget={ progress_delay : false, thumb_page : false, thumb_interval : false, - image_path : this.options.appspath+ "/img/", + image_path : this.options.path + this.options.appspath+ "/files_sharing_widget/img/", play_button : "#pauseplay", next_slide : "#nextslide", prev_slide : "#prevslide", @@ -310,7 +336,7 @@ var OwnWidget={ }, initSupersized:function() { var self=this; - var htmlString = ''; + var htmlString = ''; jQuery(htmlString).appendTo("body"); jQuery("#closeSlideShow").click(function() { if (jQuery.supersized.vars.slideshow_interval) { diff --git a/oc454/apps/files_sharing_widget/js/widget.js b/oc454/apps/files_sharing_widget/js/widget.js index b8b9c33..000bab9 100644 --- a/oc454/apps/files_sharing_widget/js/widget.js +++ b/oc454/apps/files_sharing_widget/js/widget.js @@ -6,4 +6,4 @@ * * */ -(function(){var d;if(window.jQuery===undefined||window.jQuery.fn.jquery!=="1.8.2"){var e=document.createElement("script");e.setAttribute("type","text/javascript");e.setAttribute("src",ownWidgetOptions.path+ownWidgetOptions.appspath+"/files_sharing_widget/js/jquery-pack.min.js");if(e.readyState){e.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){b()}}}else{e.onload=b}(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(e)}else{d=window.jQuery;a()}function b(){d=window.jQuery.noConflict(true);a()}function f(g){g=(g+"").toString();return encodeURIComponent(g).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function a(){d(document).ready(function(g){c.init(ownWidgetOptions)})}var c={init:function(g){var h={crypt:"",path:"",appspath:"apps",display:"",fbAppid:"",modal:true,cssAddWidget:{width:1000,height:560},cssAddButton:{top:20,left:20},buttonlabel:"Fotogalerie"};this.options=d.extend(true,h,g);this.loadCssFile();this.imageSlide=[];this.loadPage="";this.widgetContainer=d("#ownWidget-container");this.firstShow=true;if(this.options.fbAppid!=""){this.loginToFacebookApp()}if(this.options.display=="hidden"){this.createShowButton()}else{this.showWidget()}this.initSupersized()},loadCssFile:function(){if(d("#ownWidgetCss").length<1){d("",{id:"ownWidgetCss",rel:"stylesheet",type:"text/css",href:this.options.path+this.options.appspath+"/files_sharing_widget/css/widget.css"}).appendTo("head")}},createShowButton:function(){self=this;this.widgetContainer.hide();if(this.options.modal){this.overlay=d('
').appendTo("body")}this.addWidgetControls();var g=d('
'+this.options.buttonlabel+"
");g.css(this.options.cssAddButton);g.appendTo("body");g.click(function(){if(self.options.modal){self.overlay.height(d(window).height());self.overlay.width(d(window).width());self.overlay.animate({opacity:0.5},500,function(){self.loadData()})}else{self.loadData()}})},showWidget:function(){this.widgetContainer.hide();this.addWidgetControls();this.loadData()},addWidgetControls:function(){var g=this;if(this.options.display=="hidden"){var i=d('
X
');this.widgetContainer.prepend(i)}this.widgetContainer.prepend('
');var h=d('
Slideshow
');this.widgetContainer.prepend(h);d("#SlideShowButton").click(function(){g.widgetContainer.animate({opacity:"toggle"},500,function(){d("body").append("
");d("#supersized-loader").remove();d("#supersized").remove();d("#supersized-holder").append("
");d("#supersized").show();d("#slideshow-content").animate({opacity:"toggle"});d("a[rel=fancyArea]").each(function(j,k){g.imageSlide.push({image:k.href,title:k.title.replace(//,">"),thumb:k.children[0].src})});g.loadSupersized()})});d("#SlideShowButton").hide();if(this.options.display=="hidden"){i.click(function(){g.widgetContainer.animate({opacity:"toggle"},500,function(){if(g.options.modal){g.overlay.height(0);g.overlay.width(0)}g.firstShow=true;g.widgetContainer.hide()})})}},initMovingBox:function(){var g=this;var i=this.widgetContainer.height()-80;if(d("#albumPics").length>0){var i=this.widgetContainer.height()-210}d("#ownWidget-slider").movingBoxes({reducedSize:1,startPanel:1,hashTags:false,speed:700,fixedHeight:true,wrap:false,buildNav:true,navFormatter:function(){return"●"},preinit:function(){g.widgetContainer.prepend('
 
');d("#ownWidget-output").hide();d(".mb-wrapper").css({height:i})},initialized:function(k,j,h){d(".mb-scroll").height(i-20);d("#ownWidget-slider").height(i-20);d("#ownWidget-Loader").remove();d("#ownWidget-output").show()}})},loadData:function(){var g=this;d.ajax({dataType:"jsonp",jsonp:"jsonp_callback",url:g.options.path+"widget.php?iToken="+f(g.options.crypt)+g.loadPage,success:function(h){d("#ownWidget-output").html("");d("#ownWidget-output").html(h.databack);d("#ownWidget-header").html(h.nav+" "+h.folder);if(d("#loginForm").length>0){d("#loginForm #iSubmit").click(function(i){i.preventDefault();g.loadPage="&password="+d("#password").val();g.loadData()})}d("#ownWidget-header .loadAlbum").each(function(j,k){d(k).click(function(){if(d(k).attr("title")==""){g.loadPage=""}else{g.loadPage="&path=/"+d(k).attr("title")}g.loadData()})});if(g.firstShow){g.widgetContainer.css(g.options.cssAddWidget);if(!g.options.cssAddWidget.top&&!g.options.cssAddWidget.left){g.widgetContainer.css({top:(d(window).height()/2)-(g.widgetContainer.height()/2),left:(d(window).width()/2)-(g.widgetContainer.width()/2)})}g.widgetContainer.show();g.firstShow=false}if(d("#ownWidget-slider").length>0){d("#ownWidget-slider").css({width:g.widgetContainer.width()-12});d("#ownWidget-slider > div").css({width:g.widgetContainer.width()-15});if(d("#ownWidget-slider > div").length>1){g.initMovingBox()}else{if(d("#ownWidget-slider").html()==""){d("#ownWidget-slider").html("
No images found!
");d("#SlideShowButton").hide()}}}if(d("a[rel=fancyArea]").length>0){d("a[rel=fancyArea]").fancybox({transitionIn:"elastic",transitionOut:"elastic",speedIn:600,speedOut:200,titlePosition:"over",titleFormat:function(i,j,l,k){return'Image '+(l+1)+" / "+j.length+" "+i+""}});d("#SlideShowButton").show()}}})},loadSuperSizedTheme:function(){d.supersized.themeVars={progress_delay:false,thumb_page:false,thumb_interval:false,image_path:this.options.path+this.options.appspath+"/files_sharing_widget/img/",play_button:"#pauseplay",next_slide:"#nextslide",prev_slide:"#prevslide",next_thumb:"#nextthumb",prev_thumb:"#prevthumb",slide_caption:"#slidecaption",slide_current:".slidenumber",slide_total:".totalslides",slide_list:"#slide-list",thumb_tray:"#thumb-tray",thumb_list:"#thumb-list",thumb_forward:"#thumb-forward",thumb_back:"#thumb-back",tray_arrow:"#tray-arrow",tray_button:"#tray-button",progress_bar:"#progress-bar"}},initSupersized:function(){var g=this;var h='';d(h).appendTo("body");d("#closeSlideShow").click(function(){if(d.supersized.vars.slideshow_interval){clearInterval(d.supersized.vars.slideshow_interval)}g.imageSlide=[];d("#supersized-holder").remove();d("#slideshow-content").animate({opacity:"toggle"});d("#thumb-list").remove();g.widgetContainer.animate({opacity:"toggle"})})},loadSupersized:function(){this.loadSuperSizedTheme();d.supersized({slideshow:1,autoplay:0,start_slide:1,stop_loop:0,random:0,slide_interval:3000,transition:6,transition_speed:1000,new_window:1,pause_hover:0,keyboard_nav:1,performance:1,image_protect:1,min_width:0,min_height:0,vertical_center:1,horizontal_center:1,fit_always:0,fit_portrait:1,fit_landscape:0,slide_links:false,new_window:false,thumb_links:1,thumbnail_navigation:0,slides:this.imageSlide,progress_bar:1,mouse_scrub:0})},loginToFacebookApp:function(){d("body").append('
');d.getScript(document.location.protocol+"//connect.facebook.net/de_DE/all.js");window.fbAsyncInit=function(){FB.init({appId:this.options.fbAppid,status:true,cookie:true,xfbml:true})}}}})(); \ No newline at end of file +(function(){var d;if(window.jQuery===undefined||window.jQuery.fn.jquery!=="1.8.2"){var e=document.createElement("script");e.setAttribute("type","text/javascript");e.setAttribute("src",ownWidgetOptions.path+ownWidgetOptions.appspath+"/files_sharing_widget/js/jquery-pack.min.js");if(e.readyState){e.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){b()}}}else{e.onload=b}(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(e)}else{d=window.jQuery;a()}function b(){d=window.jQuery.noConflict(true);a()}function f(g){g=(g+"").toString();return encodeURIComponent(g).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")}function a(){d(document).ready(function(g){if(ownWidgetOptions.showButtonLink!=undefined){c.prepareExternLink(ownWidgetOptions)}else{if(g("#ownWidget-container").length>0){c.init(ownWidgetOptions)}}})}var c={init:function(g){var h={crypt:"",path:"",appspath:"apps",showButtonLink:"",customThumbHeight:"",customThumbpPage:"",display:"",fbAppid:"",modal:true,cssAddWidget:{width:1000,height:560},cssAddButton:{top:20,left:20},buttonlabel:"Fotogalerie"};this.options=d.extend(true,h,g);this.loadCssFile();this.imageSlide=[];this.loadPage="";this.widgetContainer=d("#ownWidget-container");this.firstShow=true;if(this.options.fbAppid!=""){this.loginToFacebookApp()}if(this.options.display=="hidden"){this.createShowButton()}else{this.showWidget()}this.initSupersized()},prepareExternLink:function(h){var g=this;if(h.showButtonLink!=""){d("#"+h.showButtonLink).click(function(){clearTimeout(i);var i=setTimeout(function(){g.init(h)},500)})}},loadCssFile:function(){if(d("#ownWidgetCss").length<1){d("",{id:"ownWidgetCss",rel:"stylesheet",type:"text/css",href:this.options.path+this.options.appspath+"/files_sharing_widget/css/widget.css"}).appendTo("head")}},createShowButton:function(){self=this;this.widgetContainer.hide();if(this.options.modal){this.overlay=d('
').appendTo("body")}this.addWidgetControls();var g=d('
'+this.options.buttonlabel+"
");g.css(this.options.cssAddButton);g.appendTo("body");g.click(function(){if(self.options.modal){self.overlay.height(d(window).height());self.overlay.width(d(window).width());self.overlay.animate({opacity:0.5},500,function(){self.loadData()})}else{self.loadData()}})},showWidget:function(){this.widgetContainer.hide();this.addWidgetControls();this.loadData()},addWidgetControls:function(){var g=this;if(this.options.display=="hidden"){var i=d('
X
');this.widgetContainer.prepend(i)}this.widgetContainer.prepend('
');var h=d('
Slideshow
');this.widgetContainer.prepend(h);d("#SlideShowButton").click(function(){g.widgetContainer.animate({opacity:"toggle"},500,function(){d("body").append("
");d("#supersized-loader").remove();d("#supersized").remove();d("#supersized-holder").append("
");d("#supersized").show();d("#slideshow-content").animate({opacity:"toggle"});d("a[rel=fancyArea]").each(function(j,k){g.imageSlide.push({image:k.href,title:k.title.replace(//,">"),thumb:k.children[0].src})});g.loadSupersized()})});d("#SlideShowButton").hide();if(this.options.display=="hidden"){i.click(function(){g.widgetContainer.animate({opacity:"toggle"},500,function(){if(g.options.modal){g.overlay.height(0);g.overlay.width(0)}g.firstShow=true;g.widgetContainer.hide()})})}},initMovingBox:function(){var g=this;var i=this.widgetContainer.height()-80;if(d("#albumPics").length>0){var i=this.widgetContainer.height()-210}d("#ownWidget-slider").movingBoxes({reducedSize:1,startPanel:1,hashTags:false,speed:700,fixedHeight:true,wrap:false,buildNav:true,navFormatter:function(){return"●"},preinit:function(){g.widgetContainer.prepend('
 
');d("#ownWidget-output").hide();d(".mb-wrapper").css({height:i})},initialized:function(k,j,h){d(".mb-scroll").height(i-20);d("#ownWidget-slider").height(i-20);d("#ownWidget-Loader").remove();d("#ownWidget-output").show()}})},loadData:function(){var h=this;var i="";if(this.options.customThumbHeight!=""){i="&cTh="+this.options.customThumbHeight}var g="";if(this.options.customThumbpPage!=""){g="&cTpP="+this.options.customThumbpPage}d.ajax({dataType:"jsonp",jsonp:"jsonp_callback",url:h.options.path+"widget.php?iToken="+f(h.options.crypt)+h.loadPage+i+g,success:function(j){d("#ownWidget-output").html("");d("#ownWidget-output").html(j.databack);d("#ownWidget-header").html(j.nav+" "+j.folder);if(d("#loginForm").length>0){d("#loginForm #iSubmit").click(function(k){k.preventDefault();h.loadPage="&password="+d("#password").val();h.loadData()})}d("#ownWidget-header .loadAlbum").each(function(k,l){d(l).click(function(){if(d(l).attr("title")==""){h.loadPage=""}else{h.loadPage="&path=/"+d(l).attr("title")}h.loadData()})});if(h.firstShow){h.widgetContainer.css(h.options.cssAddWidget);if(!h.options.cssAddWidget.top&&!h.options.cssAddWidget.left){h.widgetContainer.css({top:(d(window).height()/2)-(h.widgetContainer.height()/2),left:(d(window).width()/2)-(h.widgetContainer.width()/2)})}h.widgetContainer.show();h.firstShow=false}if(d("#ownWidget-slider").length>0){d("#ownWidget-slider").css({width:h.widgetContainer.width()-12});d("#ownWidget-slider > div").css({width:h.widgetContainer.width()-15});if(d("#ownWidget-slider > div").length>1){h.initMovingBox()}else{if(d("#ownWidget-slider").html()==""){d("#ownWidget-slider").html("
No images found!
");d("#SlideShowButton").hide()}}}if(d("a[rel=fancyArea]").length>0){d("a[rel=fancyArea]").fancybox({transitionIn:"elastic",transitionOut:"elastic",speedIn:600,speedOut:200,titlePosition:"over",titleFormat:function(k,l,n,m){return'Image '+(n+1)+" / "+l.length+" "+k+""}});d("#SlideShowButton").show()}}})},loadSuperSizedTheme:function(){d.supersized.themeVars={progress_delay:false,thumb_page:false,thumb_interval:false,image_path:this.options.path+this.options.appspath+"/files_sharing_widget/img/",play_button:"#pauseplay",next_slide:"#nextslide",prev_slide:"#prevslide",next_thumb:"#nextthumb",prev_thumb:"#prevthumb",slide_caption:"#slidecaption",slide_current:".slidenumber",slide_total:".totalslides",slide_list:"#slide-list",thumb_tray:"#thumb-tray",thumb_list:"#thumb-list",thumb_forward:"#thumb-forward",thumb_back:"#thumb-back",tray_arrow:"#tray-arrow",tray_button:"#tray-button",progress_bar:"#progress-bar"}},initSupersized:function(){var g=this;var h='';d(h).appendTo("body");d("#closeSlideShow").click(function(){if(d.supersized.vars.slideshow_interval){clearInterval(d.supersized.vars.slideshow_interval)}g.imageSlide=[];d("#supersized-holder").remove();d("#slideshow-content").animate({opacity:"toggle"});d("#thumb-list").remove();g.widgetContainer.animate({opacity:"toggle"})})},loadSupersized:function(){this.loadSuperSizedTheme();d.supersized({slideshow:1,autoplay:0,start_slide:1,stop_loop:0,random:0,slide_interval:3000,transition:6,transition_speed:1000,new_window:1,pause_hover:0,keyboard_nav:1,performance:1,image_protect:1,min_width:0,min_height:0,vertical_center:1,horizontal_center:1,fit_always:0,fit_portrait:1,fit_landscape:0,slide_links:false,new_window:false,thumb_links:1,thumbnail_navigation:0,slides:this.imageSlide,progress_bar:1,mouse_scrub:0})},loginToFacebookApp:function(){d("body").append('
');d.getScript(document.location.protocol+"//connect.facebook.net/de_DE/all.js");window.fbAsyncInit=function(){FB.init({appId:this.options.fbAppid,status:true,cookie:true,xfbml:true})}}}})(); \ No newline at end of file diff --git a/oc454/apps/files_sharing_widget/lib/widgethelper.php b/oc454/apps/files_sharing_widget/lib/widgethelper.php index 0d55ab4..8b82efb 100644 --- a/oc454/apps/files_sharing_widget/lib/widgethelper.php +++ b/oc454/apps/files_sharing_widget/lib/widgethelper.php @@ -19,7 +19,7 @@ class OC_Widget_Helper { * Returns a absolute url to the given service. */ public static function linkToWidget($service, $add_slash = false) { - return OC_Helper::linkToAbsolute( '', 'public.php') . '?service=pics&action=' . $service . (($add_slash && $service[strlen($service)-1]!='/')?'/':''); + return OC_Helper::linkToAbsolute( '', 'widget.php') . '?action=' . $service . (($add_slash && $service[strlen($service)-1]!='/')?'/':''); } @@ -73,7 +73,7 @@ public static function makeNormPic($path,$bWatermark=true,$sWatermarkTxt='(c) ze $image -> show(); } } - + /** * @load Template for real view * @param int width of the widget @@ -81,7 +81,7 @@ public static function makeNormPic($path,$bWatermark=true,$sWatermarkTxt='(c) ze * @return return the template * */ -/* public static function getRelativeAppWebPath() { + public static function getRelativeAppWebPath() { foreach(OC::$APPSROOTS as $dir) { if(file_exists($dir['path'].'/files_sharing_widget')) { @@ -90,16 +90,25 @@ public static function makeNormPic($path,$bWatermark=true,$sWatermarkTxt='(c) ze } return false; } -*/ + public static function loadTemplateReal($WIDTH="770",$HEIGHT="570",$TITLE='Zeus-Cloud Picture Widget') { - + + $getRelativeAppsPath=OC_Widget_Helper::getRelativeAppWebPath(); + if(strripos(OC::$WEBROOT,'/')) $getRelativeAppsPath=substr($getRelativeAppsPath,1,strlen($getRelativeAppsPath)-1); + + $addcustomThumbHeight=''; + if(isset($_GET['cTh']) && intval($_GET['cTh'])>0) $addcustomThumbHeight=intval($_GET['cTh']); + + $addcustomThumbperPage=''; + if(isset($_GET['cTpP']) && intval($_GET['cTpP'])>0) $addcustomThumbperPage=intval($_GET['cTpP']); + $tpl="\n\n\n".htmlentities(utf8_decode($TITLE))." \n \n - \n - \n - \n - \n\n + \n + \n + \n + \n\n \n \n \n
@@ -135,31 +144,7 @@ public static function encrypt($sValue, $sSecretKey) { ) ,"\0\3"); } - /** - * @decrypt string - * @param string Value to decrypt - * @param string Secret Key - * @return decrypted string - * - */ - public static function decrypt($sValue, $sSecretKey) { - return rtrim( - mcrypt_decrypt( - MCRYPT_RIJNDAEL_256, - $sSecretKey, - base64_decode($sValue), - MCRYPT_MODE_ECB, - mcrypt_create_iv( - mcrypt_get_iv_size( - MCRYPT_RIJNDAEL_256, - MCRYPT_MODE_ECB - ), - MCRYPT_RAND - ) - ) - ,"\0\3"); - } /** * @get Count Pics of Directory and one image for Preview @@ -213,7 +198,7 @@ public static function getAllSharesUser($SECRET){ if($share['item_type']=='folder') $itemTypeChoose='dir'; $expDate = new \DateTime($share['expiration'], new \DateTimeZone($tz)); $EXPDATE=$expDate->format('d.m.Y H:i'); -/* + if($share['share_type']==0){ $output[]=array( 'id'=>$share['id'], @@ -236,7 +221,6 @@ public static function getAllSharesUser($SECRET){ 'iToken'=>'' ); } -*/ if($share['share_type']==3){ $addPassImg=''; $tokenLink='&'.$itemTypeChoose.'='.$share['path']; diff --git a/oc454/apps/files_sharing_widget/public.php b/oc454/apps/files_sharing_widget/public.php index 558bb69..6bb354c 100644 --- a/oc454/apps/files_sharing_widget/public.php +++ b/oc454/apps/files_sharing_widget/public.php @@ -7,23 +7,13 @@ * * */ + OC::$CLASSPATH['OC_Share_Backend_File'] = "files_sharing/lib/share/file.php"; OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php'; OC::$CLASSPATH['OC_Filestorage_Shared'] = "files_sharing/lib/sharedstorage.php"; OCP\Util::connectHook('OC_Filesystem', 'setup', 'OC_Filestorage_Shared', 'setup'); -//OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); -//OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); - -// -$SESSIONPREFIX = OC_Config::getValue('SESSIONPREFIX'); - -$shareSecret=OCP\Config::getSystemValue('secretword'); -if($shareSecret=='') $shareSecret='mySecretWord'; -$getSchluessel= OC_Widget_Helper::decrypt(rawurldecode($_GET['iToken']),$shareSecret); - -$_GET['dir']=$getSchluessel; -//$_GET['service']='pics'; -// +OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); +OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $bReal=false; if (isset($_GET['action']) && $_GET['action']=='real') { @@ -66,7 +56,7 @@ $ObjParamter['imgheight']=150; $ObjParamter['width']=750; $ObjParamter['height']=550; - $ObjParamter['watermark']=1; + $ObjParamter['watermark']=0; $ObjParamter['watermarktxt']=''; $ObjParamter['title']=''; } @@ -129,7 +119,9 @@ if (isset($_GET['dir'])) { if (isset($_GET['path']) && $_GET['path'] != '') { - OC_Widget_Helper::makeThumb($path,$ObjParamter['imgheight'],$ObjParamter['watermark'],$ObjParamter['watermarktxt']); + $addThumbHeight=$ObjParamter['imgheight']; + if(isset($_GET['cTh']) && (intval($_GET['cTh']) > 49 && intval($_GET['cTh']) < 151)) $addThumbHeight=intval($_GET['cTh']); + OC_Widget_Helper::makeThumb($path,$addThumbHeight,$ObjParamter['watermark'],$ObjParamter['watermarktxt']); } } }else{ @@ -145,14 +137,14 @@ $rootLength = strlen($baseDir) + 1; $counter = 0; $maxNeben = $ObjParamter['maxpicsperpage']; - if ($maxNeben) - $maxNeben = ((int)$maxNeben - 1); + if(isset($_GET['cTpP']) && (intval($_GET['cTpP']) > 2 && intval($_GET['cTpP']) < 31)) $maxNeben=intval($_GET['cTpP']); + if ($maxNeben) $maxNeben = ((int)$maxNeben - 1); if (!$maxNeben) $maxNeben = 5; $mySecret=OCP\Config::getSystemValue('secretword'); if($mySecret=='') $mySecret='mySecretWord'; $thumbSize=$ObjParamter['imgheight']; - + if(isset($_GET['cTh']) && (intval($_GET['cTh']) > 49 && intval($_GET['cTh']) < 151)) $thumbSize=intval($_GET['cTh']); //$aFilesArray=[]; foreach (OC_Files::getDirectoryContent($path) as $i) { @@ -194,9 +186,11 @@ $ouputAlbumThumb='
 
'.$i['name'].' ('.$AlbumData['ANZAHLPICS'].')
'; if($AlbumData['path']){ $relPath=substr($AlbumData['path'], $rootLength); + if($thumbSize>66) $albumThSize=65; + else $albumThSize=$thumbSize; $ShowAlbumThumb = OC_Widget_Helper::linkToWidget('thumb') . '&path=/'.$relPath.'&iToken='.rawurlencode($_GET['iToken']); - $ouputAlbumThumb='

'.$i['name'].' ('.$AlbumData['ANZAHLPICS'].')
'; + $ouputAlbumThumb='

'.$i['name'].' ('.$AlbumData['ANZAHLPICS'].')
'; } $dataFolder.= ''.$ouputAlbumThumb.' '; @@ -253,7 +247,7 @@ $dataOutput='
Password: - +
'; } diff --git a/oc454/apps/files_sharing_widget/templates/settings.php b/oc454/apps/files_sharing_widget/templates/settings.php index 9d84733..ebe36bb 100644 --- a/oc454/apps/files_sharing_widget/templates/settings.php +++ b/oc454/apps/files_sharing_widget/templates/settings.php @@ -9,7 +9,7 @@ */ ?>
- Shared files and folders with link + Shared Files and Folders
Configurationparameters:
@@ -45,24 +47,15 @@

Use as Widget: (For Integration Homepage, Facebook)
+
diff --git a/oc454/lib/base.min.php b/oc454/lib/base.min.php new file mode 100644 index 0000000..8259b7c --- /dev/null +++ b/oc454/lib/base.min.php @@ -0,0 +1,362 @@ + + * + * modifed lib/base.php for Picture Widget use + * + */ + +class OC{ + /** + * Assoziative array for autoloading. classname => filename + */ + public static $CLASSPATH = array(); + /** + * The installation path for owncloud on the server (e.g. /srv/http/owncloud) + */ + public static $SERVERROOT = ''; + /** + * the current request path relative to the owncloud root (e.g. files/index.php) + */ + private static $SUBURI = ''; + /** + * the owncloud root path for http requests (e.g. owncloud/) + */ + public static $WEBROOT = ''; + /** + * The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty) + */ + public static $THIRDPARTYROOT = ''; + /** + * the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty) + */ + public static $THIRDPARTYWEBROOT = ''; + /** + * The installation path array of the apps folder on the server (e.g. /srv/http/owncloud) 'path' and + * web path in 'url' + */ + public static $APPSROOTS = array(); + /* + * requested app + */ + public static $REQUESTEDAPP = ''; + /* + * requested file of app + */ + public static $REQUESTEDFILE = ''; + /** + * check if owncloud runs in cli mode + */ + public static $CLI = false; + /** + * MULTI INSTANCE OF cloud installation + */ + + // public static $SESSIONPREFIX = ''; + + /** + * SPL autoload + */ + public static function autoload($className) { + + if(array_key_exists($className, OC::$CLASSPATH)) { + /** @TODO: Remove this when necessary + Remove "apps/" from inclusion path for smooth migration to mutli app dir + */ + + $path = str_replace('apps/', '', OC::$CLASSPATH[$className]); + require_once $path; + } + elseif(strpos($className, 'OC_')===0) { + + $path = strtolower(str_replace('_', '/', substr($className, 3)) . '.php'); + + } + elseif(strpos($className, 'OCP\\')===0) { + $path = 'public/'.strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); + } + elseif(strpos($className, 'OCA\\')===0) { + $path = 'apps/'.strtolower(str_replace('\\', '/', substr($className, 3)) . '.php'); + } + else{ + return false; + } + + if($fullPath = stream_resolve_include_path($path)) { + require_once $path; + } + return false; + } + + public static function initPaths() { + // calculate the root directories + //OC::$SERVERROOT='/opt/local/apache2/htdocs/oc45/'; + OC::$SERVERROOT=str_replace("\\", '/', substr(__FILE__, 0, -16)); + //OC::$SERVERROOT='/is/htdocs/wp11048482_6MQ454GFGE/www/demo'; + OC::$SUBURI= str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen(OC::$SERVERROOT))); + $scriptName=$_SERVER["SCRIPT_NAME"]; + if(substr($scriptName, -1)=='/') { + $scriptName.='index.php'; + //make sure suburi follows the same rules as scriptName + if(substr(OC::$SUBURI, -9)!='index.php') { + if(substr(OC::$SUBURI, -1)!='/') { + OC::$SUBURI=OC::$SUBURI.'/'; + } + OC::$SUBURI=OC::$SUBURI.'index.php'; + } + } + + OC::$WEBROOT=substr($scriptName, 0, strlen($scriptName)-strlen(OC::$SUBURI)); + + if ( isset($_SERVER['HTTP_X_FORWARDED_SERVER']) ) { + OC::$WEBROOT=$_SERVER['SERVER_NAME']. OC::$WEBROOT; + OC_Log::write('core', 'WEBROOT: '. OC::$WEBROOT, OC_Log::DEBUG); + } + + if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/') { + OC::$WEBROOT='/'.OC::$WEBROOT; + + } + + // ensure we can find OC_Config + set_include_path( + OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. + get_include_path() + ); + + // search the 3rdparty folder + if(OC_Config::getValue('3rdpartyroot', '')<>'' and OC_Config::getValue('3rdpartyurl', '')<>'') { + OC::$THIRDPARTYROOT=OC_Config::getValue('3rdpartyroot', ''); + OC::$THIRDPARTYWEBROOT=OC_Config::getValue('3rdpartyurl', ''); + }elseif(file_exists(OC::$SERVERROOT.'/3rdparty')) { + OC::$THIRDPARTYROOT=OC::$SERVERROOT; + OC::$THIRDPARTYWEBROOT=OC::$WEBROOT; + }elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')) { + OC::$THIRDPARTYWEBROOT=rtrim(dirname(OC::$WEBROOT), '/'); + OC::$THIRDPARTYROOT=rtrim(dirname(OC::$SERVERROOT), '/'); + }else{ + echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); + exit; + } + + // search the apps folder + $config_paths = OC_Config::getValue('apps_paths', array()); + if(! empty($config_paths)) { + foreach($config_paths as $paths) { + if( isset($paths['url']) && isset($paths['path'])) { + $paths['url'] = rtrim($paths['url'], '/'); + $paths['path'] = rtrim($paths['path'], '/'); + OC::$APPSROOTS[] = $paths; + } + } + }elseif(file_exists(OC::$SERVERROOT.'/apps')) { + OC::$APPSROOTS[] = array('path'=> OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true); + }elseif(file_exists(OC::$SERVERROOT.'/../apps')) { + OC::$APPSROOTS[] = array('path'=> rtrim(dirname(OC::$SERVERROOT), '/').'/apps', 'url' => '/apps', 'writable' => true); + } + + if(empty(OC::$APPSROOTS)) { + echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); + exit; + } + + $paths = array(); + foreach( OC::$APPSROOTS as $path) $paths[] = $path['path']; + + // set the right include path + set_include_path( + OC::$SERVERROOT.'/lib'.PATH_SEPARATOR. + OC::$SERVERROOT.'/config'.PATH_SEPARATOR. + OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR. + implode($paths,PATH_SEPARATOR).PATH_SEPARATOR. + get_include_path().PATH_SEPARATOR. + OC::$SERVERROOT + ); + } + + public static function initSession() { + ini_set('session.cookie_httponly', '1;'); + + session_start(); + } + + public static function init() { + // register autoloader + spl_autoload_register(array('OC','autoload')); + setlocale(LC_ALL, 'en_US.UTF-8'); + + // set some stuff + //ob_start(); + error_reporting(E_ALL | E_STRICT); + if (defined('DEBUG') && DEBUG) { + ini_set('display_errors', 1); + } + self::$CLI=(php_sapi_name() == 'cli'); + + date_default_timezone_set('UTC'); + ini_set('arg_separator.output', '&'); + + + + //try to configure php to enable big file uploads. + //this doesn´t work always depending on the webserver and php configuration. + //Let´s try to overwrite some defaults anyways + + //try to set the maximum execution time to 60min + set_time_limit(3600); + ini_set('max_execution_time', 3600); + ini_set('max_input_time', 3600); + + //try to set the maximum filesize to 10G + @ini_set('upload_max_filesize', '10G'); + @ini_set('post_max_size', '10G'); + @ini_set('file_uploads', '50'); + //print OC::$SERVERROOT; + + // session_save_path('/is/htdocs/wp11048482_6MQ454GFGE/www/demo/tmp'); + //try to set the session lifetime to 60min + @ini_set('gc_maxlifetime', '3600'); + + + + self::initPaths(); + + + + // register the stream wrappers + require_once 'streamwrappers.php'; + stream_wrapper_register("fakedir", "OC_FakeDirStream"); + stream_wrapper_register('static', 'OC_StaticStreamWrapper'); + stream_wrapper_register('close', 'OC_CloseStreamWrapper'); + + + self::initSession(); + + + //$errors=OC_Util::checkServer(); + + + + OC_User::useBackend(new OC_User_Database()); + OC_Group::useBackend(new OC_Group_Database()); + + // Load Apps + // This includes plugins for users and filesystems as well + global $RUNTIME_NOAPPS; + global $RUNTIME_APPTYPES; + if(!$RUNTIME_NOAPPS ) { + if($RUNTIME_APPTYPES) { + OC_App::loadApps($RUNTIME_APPTYPES); + }else{ + OC_App::loadApps(); + } + } + + //setup extra user backends + OC_User::setupBackends(); + + // register cache cleanup jobs + OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc'); + OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener'); + + // Check for blacklisted files + OC_Hook::connect('OC_Filesystem', 'write', 'OC_Filesystem', 'isBlacklisted'); + OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted'); + + //make sure temporary files are cleaned up + register_shutdown_function(array('OC_Helper','cleanTmp')); + + //parse the given parameters + self::$REQUESTEDAPP = (isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files')); + if(substr_count(self::$REQUESTEDAPP, '?') != 0) { + $app = substr(self::$REQUESTEDAPP, 0, strpos(self::$REQUESTEDAPP, '?')); + $param = substr($_GET['app'], strpos($_GET['app'], '?') + 1); + parse_str($param, $get); + $_GET = array_merge($_GET, $get); + self::$REQUESTEDAPP = $app; + $_GET['app'] = $app; + } + self::$REQUESTEDFILE = (isset($_GET['getfile'])?$_GET['getfile']:null); + if(substr_count(self::$REQUESTEDFILE, '?') != 0) { + $file = substr(self::$REQUESTEDFILE, 0, strpos(self::$REQUESTEDFILE, '?')); + $param = substr(self::$REQUESTEDFILE, strpos(self::$REQUESTEDFILE, '?') + 1); + parse_str($param, $get); + $_GET = array_merge($_GET, $get); + self::$REQUESTEDFILE = $file; + $_GET['getfile'] = $file; + } + if(!is_null(self::$REQUESTEDFILE)) { + $subdir = OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . self::$REQUESTEDFILE; + $parent = OC_App::getAppPath(OC::$REQUESTEDAPP); + if(!OC_Helper::issubdirectory($subdir, $parent)) { + self::$REQUESTEDFILE = null; + header('HTTP/1.0 404 Not Found'); + exit; + } + } + + } + +} + +function encrypt($sValue, $sSecretKey) { + return rtrim( + base64_encode( + mcrypt_encrypt( + MCRYPT_RIJNDAEL_256, + $sSecretKey, $sValue, + MCRYPT_MODE_ECB, + mcrypt_create_iv( + mcrypt_get_iv_size( + MCRYPT_RIJNDAEL_256, + MCRYPT_MODE_ECB + ), + MCRYPT_RAND) + ) + ) + ,"\0\3"); +} + +function decrypt($sValue, $sSecretKey) { + return rtrim( + mcrypt_decrypt( + MCRYPT_RIJNDAEL_256, + $sSecretKey, + base64_decode($sValue), + MCRYPT_MODE_ECB, + mcrypt_create_iv( + mcrypt_get_iv_size( + MCRYPT_RIJNDAEL_256, + MCRYPT_MODE_ECB + ), + MCRYPT_RAND + ) + ) + ,"\0\3"); +} + +// define runtime variables - unless this already has been done +if( !isset( $RUNTIME_NOAPPS )) { + $RUNTIME_NOAPPS = false; +} + +if(!function_exists('get_temp_dir')) { + function get_temp_dir() { + if( $temp=ini_get('upload_tmp_dir') ) return $temp; + if( $temp=getenv('TMP') ) return $temp; + if( $temp=getenv('TEMP') ) return $temp; + if( $temp=getenv('TMPDIR') ) return $temp; + $temp=tempnam(__FILE__, ''); + if (file_exists($temp)) { + unlink($temp); + return dirname($temp); + } + if( $temp=sys_get_temp_dir()) return $temp; + + return null; + } +} +OC::init(); \ No newline at end of file diff --git a/oc454/widget.php b/oc454/widget.php new file mode 100644 index 0000000..24cf999 --- /dev/null +++ b/oc454/widget.php @@ -0,0 +1,30 @@ + + * + * + */ + +$RUNTIME_NOAPPS = TRUE; +require_once 'lib/base.min.php'; + +$shareSecret=OCP\Config::getSystemValue('secretword'); +if($shareSecret=='') $shareSecret='mySecretWord'; +$getSchluessel= decrypt(rawurldecode($_GET['iToken']),$shareSecret); + +$_GET['dir']=$getSchluessel; +$_GET['service']='pics'; +/* +$file='files_sharing_widget/public.php'; +if(is_null($file)) { + header('HTTP/1.0 404 Not Found'); + exit; +}*/ + +OC_Util::checkAppEnabled('files_sharing_widget'); +OC_App::loadApp('files_sharing_widget'); + +require_once OC_App::getAppPath('files_sharing_widget') .'/public.php';