summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-08-06 21:38:35 +0000
committerNathan Kinkade <nath@nkinka.de>2012-08-06 21:38:35 +0000
commitc6047a18fe13df2fc5bae7f9b2c7c5df30446bc1 (patch)
treeb1590c3e6842bf4bb82841b03e4081e50a66a654
parent527bc809aaa6d48e7c1a7be50de31a4c3adcee90 (diff)
parentd882c1ba78b6ae811abd226dd46446c914e74dd0 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
-rw-r--r--.build_number2
-rw-r--r--installer/install.sql2
-rw-r--r--lib/flowplayer.controls.swfbin36843 -> 38265 bytes
-rw-r--r--lib/flowplayer.js89
-rw-r--r--lib/flowplayer.pseudostreaming-byterange.swfbin0 -> 170919 bytes
-rw-r--r--lib/flowplayer.pseudostreaming.swfbin4477 -> 4715 bytes
-rw-r--r--lib/flowplayer.swfbin120221 -> 126406 bytes
-rw-r--r--modules/comment/helpers/comment_rss.php2
-rw-r--r--modules/gallery/controllers/admin_advanced_settings.php30
-rw-r--r--modules/gallery/helpers/gallery_installer.php25
-rw-r--r--modules/gallery/helpers/gallery_task.php108
-rw-r--r--modules/gallery/models/item.php2
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/tests/Item_Model_Test.php6
-rw-r--r--modules/gallery/views/admin_advanced_settings.html.php2
-rw-r--r--modules/gallery/views/movieplayer.html.php2
-rw-r--r--modules/tag/helpers/tag_event.php3
17 files changed, 188 insertions, 87 deletions
diff --git a/.build_number b/.build_number
index df37d3b0..9bfced49 100644
--- a/.build_number
+++ b/.build_number
@@ -3,4 +3,4 @@
; process. You don't need to edit it. In fact..
;
; DO NOT EDIT THIS FILE BY HAND!
-build_number=246
+build_number=251
diff --git a/installer/install.sql b/installer/install.sql
index 2ba168d2..2353a75a 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',49,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',50,1);
INSERT INTO {modules} VALUES (2,1,'user',4,2);
INSERT INTO {modules} VALUES (3,1,'comment',6,3);
INSERT INTO {modules} VALUES (4,1,'organize',4,4);
diff --git a/lib/flowplayer.controls.swf b/lib/flowplayer.controls.swf
index 5507a531..1bf12a11 100644
--- a/lib/flowplayer.controls.swf
+++ b/lib/flowplayer.controls.swf
Binary files differ
diff --git a/lib/flowplayer.js b/lib/flowplayer.js
index 3bbdc1d3..f26be10f 100644
--- a/lib/flowplayer.js
+++ b/lib/flowplayer.js
@@ -42,23 +42,22 @@ return ret;}
return self;}});};function Player(wrapper,params,conf){var self=this,api=null,isUnloading=false,html,commonClip,playlist=[],plugins={},listeners={},playerId,apiId,playerIndex,activeIndex,swfHeight,wrapperHeight;extend(self,{id:function(){return playerId;},isLoaded:function(){return(api!==null&&api.fp_play!==undefined&&!isUnloading);},getParent:function(){return wrapper;},hide:function(all){if(all){wrapper.style.height="0px";}
if(self.isLoaded()){api.style.height="0px";}
return self;},show:function(){wrapper.style.height=wrapperHeight+"px";if(self.isLoaded()){api.style.height=swfHeight+"px";}
-return self;},isHidden:function(){return self.isLoaded()&&parseInt(api.style.height,10)===0;},load:function(fn){if(!self.isLoaded()&&self._fireEvent("onBeforeLoad")!==false){var onPlayersUnloaded=function(){html=wrapper.innerHTML;if(html&&!flashembed.isSupported(params.version)){wrapper.innerHTML="";}
+return self;},isHidden:function(){return self.isLoaded()&&parseInt(api.style.height,10)===0;},load:function(fn){if(!self.isLoaded()&&self._fireEvent("onBeforeLoad")!==false){var onPlayersUnloaded=function(){if(html&&!flashembed.isSupported(params.version)){wrapper.innerHTML="";}
if(fn){fn.cached=true;bind(listeners,"onLoad",fn);}
flashembed(wrapper,params,{config:conf});};var unloadedPlayersNb=0;each(players,function(){this.unload(function(wasUnloaded){if(++unloadedPlayersNb==players.length){onPlayersUnloaded();}});});}
-return self;},unload:function(fn){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(fn){fn(false);}
+return self;},unload:function(fn){if(html.replace(/\s/g,'')!==''){if(self._fireEvent("onBeforeUnload")===false){if(fn){fn(false);}
return self;}
-if(html.replace(/\s/g,'')!==''){if(self._fireEvent("onBeforeUnload")===false){if(fn){fn(false);}
-return self;}
-isUnloading=true;try{if(api){api.fp_close();self._fireEvent("onUnload");}}catch(error){}
-var clean=function(){api=null;wrapper.innerHTML=html;isUnloading=false;if(fn){fn(true);}};setTimeout(clean,50);}
+isUnloading=true;try{if(api){if(api.fp_isFullscreen()){api.fp_toggleFullscreen();}
+api.fp_close();self._fireEvent("onUnload");}}catch(error){}
+var clean=function(){api=null;wrapper.innerHTML=html;isUnloading=false;if(fn){fn(true);}};if(/WebKit/i.test(navigator.userAgent)&&!/Chrome/i.test(navigator.userAgent)){setTimeout(clean,0);}else{clean();}}
else if(fn){fn(false);}
return self;},getClip:function(index){if(index===undefined){index=activeIndex;}
return playlist[index];},getCommonClip:function(){return commonClip;},getPlaylist:function(){return playlist;},getPlugin:function(name){var plugin=plugins[name];if(!plugin&&self.isLoaded()){var json=self._api().fp_getPlugin(name);if(json){plugin=new Plugin(name,json,self);plugins[name]=plugin;}}
return plugin;},getScreen:function(){return self.getPlugin("screen");},getControls:function(){return self.getPlugin("controls")._fireEvent("onUpdate");},getLogo:function(){try{return self.getPlugin("logo")._fireEvent("onUpdate");}catch(ignored){}},getPlay:function(){return self.getPlugin("play")._fireEvent("onUpdate");},getConfig:function(copy){return copy?clone(conf):conf;},getFlashParams:function(){return params;},loadPlugin:function(name,url,props,fn){if(typeof props=='function'){fn=props;props={};}
var fnId=fn?makeId():"_";self._api().fp_loadPlugin(name,url,props,fnId);var arg={};arg[fnId]=fn;var p=new Plugin(name,null,self,arg);plugins[name]=p;return p;},getState:function(){return self.isLoaded()?api.fp_getState():-1;},play:function(clip,instream){var p=function(){if(clip!==undefined){self._api().fp_play(clip,instream);}else{self._api().fp_play();}};if(self.isLoaded()){p();}else if(isUnloading){setTimeout(function(){self.play(clip,instream);},50);}else{self.load(function(){p();});}
-return self;},getVersion:function(){var js="flowplayer.js 3.2.6";if(self.isLoaded()){var ver=api.fp_getVersion();ver.push(js);return ver;}
+return self;},getVersion:function(){var js="flowplayer.js 3.2.11";if(self.isLoaded()){var ver=api.fp_getVersion();ver.push(js);return ver;}
return js;},_api:function(){if(!self.isLoaded()){throw"Flowplayer "+self.id()+" not loaded when calling an API method";}
-return api;},setClip:function(clip){self.setPlaylist([clip]);return self;},getIndex:function(){return playerIndex;},_swfHeight:function(){return api.clientHeight;}});each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var name="on"+this;if(name.indexOf("*")!=-1){name=name.slice(0,name.length-1);var name2="onBefore"+name.slice(2);self[name2]=function(fn){bind(listeners,name2,fn);return self;};}
+return api;},setClip:function(clip){each(clip,function(key,val){if(typeof val=='function'){bind(listeners,key,val);delete clip[key];}else if(key=='onCuepoint'){$f(wrapper).getCommonClip().onCuepoint(clip[key][0],clip[key][1]);}});self.setPlaylist([clip]);return self;},getIndex:function(){return playerIndex;},bufferAnimate:function(enable){api.fp_bufferAnimate(enable===undefined||enable);return self;},_swfHeight:function(){return api.clientHeight;}});each(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var name="on"+this;if(name.indexOf("*")!=-1){name=name.slice(0,name.length-1);var name2="onBefore"+name.slice(2);self[name2]=function(fn){bind(listeners,name2,fn);return self;};}
self[name]=function(fn){bind(listeners,name,fn);return self;};});each(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var name=this;self[name]=function(a1,a2){if(!self.isLoaded()){return self;}
var ret=null;if(a1!==undefined&&a2!==undefined){ret=api["fp_"+name](a1,a2);}else{ret=(a1===undefined)?api["fp_"+name]():api["fp_"+name](a1);}
return ret==='undefined'||ret===undefined?self:ret;};});self._fireEvent=function(a){if(typeof a=='string'){a=[a];}
@@ -77,28 +76,28 @@ if(!clip||ret!==false){ret=commonClip._fireEvent(evt,arg1,arg2,clip);}}
each(listeners[evt],function(){ret=this.call(self,arg0,arg1);if(this.cached){listeners[evt].splice(i,1);}
if(ret===false){return false;}
i++;});return ret;};function init(){if($f(wrapper)){$f(wrapper).getParent().innerHTML="";playerIndex=$f(wrapper).getIndex();players[playerIndex]=self;}else{players.push(self);playerIndex=players.length-1;}
-wrapperHeight=parseInt(wrapper.style.height,10)||wrapper.clientHeight;playerId=wrapper.id||"fp"+makeId();apiId=params.id||playerId+"_api";params.id=apiId;conf.playerId=playerId;if(typeof conf=='string'){conf={clip:{url:conf}};}
-if(typeof conf.clip=='string'){conf.clip={url:conf.clip};}
-conf.clip=conf.clip||{};if(wrapper.getAttribute("href",2)&&!conf.clip.url){conf.clip.url=wrapper.getAttribute("href",2);}
+wrapperHeight=parseInt(wrapper.style.height,10)||wrapper.clientHeight;playerId=wrapper.id||"fp"+makeId();apiId=params.id||playerId+"_api";params.id=apiId;html=wrapper.innerHTML;if(typeof conf=='string'){conf={clip:{url:conf}};}
+conf.playerId=playerId;conf.clip=conf.clip||{};if(wrapper.getAttribute("href",2)&&!conf.clip.url){conf.clip.url=wrapper.getAttribute("href",2);}
commonClip=new Clip(conf.clip,-1,self);conf.playlist=conf.playlist||[conf.clip];var index=0;each(conf.playlist,function(){var clip=this;if(typeof clip=='object'&&clip.length){clip={url:""+clip};}
each(conf.clip,function(key,val){if(val!==undefined&&clip[key]===undefined&&typeof val!='function'){clip[key]=val;}});conf.playlist[index]=clip;clip=new Clip(clip,index,self);playlist.push(clip);index++;});each(conf,function(key,val){if(typeof val=='function'){if(commonClip[key]){commonClip[key](val);}else{bind(listeners,key,val);}
delete conf[key];}});each(conf.plugins,function(name,val){if(val){plugins[name]=new Plugin(name,val,self);}});if(!conf.plugins||conf.plugins.controls===undefined){plugins.controls=new Plugin("controls",null,self);}
-plugins.canvas=new Plugin("canvas",null,self);html=wrapper.innerHTML;function doClick(e){var hasiPadSupport=self.hasiPadSupport&&self.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(playlist[0].url)&&!hasiPadSupport){return true;}
+plugins.canvas=new Plugin("canvas",null,self);html=wrapper.innerHTML;function doClick(e){if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(playlist[0].url)&&!checkForIpadSupport()){return true;}
if(!self.isLoaded()&&self._fireEvent("onBeforeClick")!==false){self.load();}
return stopEvent(e);}
-function installPlayer(){if(html.replace(/\s/g,'')!==''){if(wrapper.addEventListener){wrapper.addEventListener("click",doClick,false);}else if(wrapper.attachEvent){wrapper.attachEvent("onclick",doClick);}}else{if(wrapper.addEventListener){wrapper.addEventListener("click",stopEvent,false);}
+function checkForIpadSupport(){return self.hasiPadSupport&&self.hasiPadSupport();}
+function installPlayer(){if(html.replace(/\s/g,'')!==''){if(wrapper.addEventListener){wrapper.addEventListener("click",doClick,false);}else if(wrapper.attachEvent){wrapper.attachEvent("onclick",doClick);}}else{if(wrapper.addEventListener&&!checkForIpadSupport()){wrapper.addEventListener("click",stopEvent,false);}
self.load();}}
setTimeout(installPlayer,0);}
if(typeof wrapper=='string'){var node=el(wrapper);if(!node){throw"Flowplayer cannot access element: "+wrapper;}
wrapper=node;init();}else{init();}}
-var players=[];function Iterator(arr){this.length=arr.length;this.each=function(fn){each(arr,fn);};this.size=function(){return arr.length;};}
+var players=[];function Iterator(arr){this.length=arr.length;this.each=function(fn){each(arr,fn);};this.size=function(){return arr.length;};var self=this;for(name in Player.prototype){self[name]=function(){var args=arguments;self.each(function(){this[name].apply(this,args);});};}}
window.flowplayer=window.$f=function(){var instance=null;var arg=arguments[0];if(!arguments.length){each(players,function(){if(this.isLoaded()){instance=this;return false;}});return instance||players[0];}
if(arguments.length==1){if(typeof arg=='number'){return players[arg];}else{if(arg=='*'){return new Iterator(players);}
each(players,function(){if(this.id()==arg.id||this.id()==arg||this.getParent()==arg){instance=this;return false;}});return instance;}}
if(arguments.length>1){var params=arguments[1],conf=(arguments.length==3)?arguments[2]:{};if(typeof params=='string'){params={src:params};}
-params=extend({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:false},params);if(typeof arg=='string'){if(arg.indexOf(".")!=-1){var instances=[];each(select(arg),function(){instances.push(new Player(this,clone(params),clone(conf)));});return new Iterator(instances);}else{var node=el(arg);return new Player(node!==null?node:arg,params,conf);}}else if(arg){return new Player(arg,params,conf);}}
+params=extend({bgcolor:"#000000",version:[10,1],expressInstall:"http://releases.flowplayer.org/swf/expressinstall.swf",cachebusting:false},params);if(typeof arg=='string'){if(arg.indexOf(".")!=-1){var instances=[];each(select(arg),function(){instances.push(new Player(this,clone(params),clone(conf)));});return new Iterator(instances);}else{var node=el(arg);return new Player(node!==null?node:clone(arg),clone(params),clone(conf));}}else if(arg){return new Player(arg,clone(params),clone(conf));}}
return null;};extend(window.$f,{fireEvent:function(){var a=[].slice.call(arguments);var p=$f(a[0]);return p?p._fireEvent(a.slice(1)):null;},addPlugin:function(name,fn){Player.prototype[name]=fn;return $f;},each:each,extend:extend});if(typeof jQuery=='function'){jQuery.fn.flowplayer=function(params,conf){if(!arguments.length||typeof arguments[0]=='number'){var arr=[];this.each(function(){var p=$f(this);if(p){arr.push(p);}});return arguments.length?arr[arguments[0]]:new Iterator(arr);}
-return this.each(function(){$f(this,clone(params),conf?clone(conf):{});});};}})();(function(){var IE=document.all,URL='http://www.adobe.com/go/getflashplayer',JQUERY=typeof jQuery=='function',RE=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,GLOBAL_OPTS={width:'100%',height:'100%',id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:'always',quality:'high',version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}
+return this.each(function(){$f(this,clone(params),conf?clone(conf):{});});};}})();(function(){var IE=document.all,URL='http://get.adobe.com/flashplayer',JQUERY=typeof jQuery=='function',RE=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,GLOBAL_OPTS={width:'100%',height:'100%',id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:'always',quality:'high',version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}
function extend(to,from){if(from){for(var key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}
return to;}
function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}
@@ -107,29 +106,27 @@ window.flashembed=function(root,opts,conf){if(typeof root=='string'){root=docume
if(!root){return;}
if(typeof opts=='string'){opts={src:opts};}
return new Flash(root,extend(extend({},GLOBAL_OPTS),opts),conf);};var f=extend(window.flashembed,{conf:GLOBAL_OPTS,getVersion:function(){var fo,ver;try{ver=navigator.plugins["Shockwave Flash"].description.slice(16);}catch(e){try{fo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");ver=fo&&fo.GetVariable("$version");}catch(err){try{fo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");ver=fo&&fo.GetVariable("$version");}catch(err2){}}}
-ver=RE.exec(ver);return ver?[ver[1],ver[3]]:[0,0];},asString:function(obj){if(obj===null||obj===undefined){return null;}
+ver=RE.exec(ver);return ver?[1*ver[1],1*ver[(ver[1]*1>9?2:3)]*1]:[0,0];},asString:function(obj){if(obj===null||obj===undefined){return null;}
var type=typeof obj;if(type=='object'&&obj.push){type='array';}
-switch(type){case'string':return string2JsonString(obj);case'array':return'['+map(obj,function(el){return f.asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+f.asString(obj[prop]));}}
+switch(type){case'string':obj=obj.replace(new RegExp('(["\\\\])','g'),'\\$1');obj=obj.replace(/^\s?(\d+\.?\d*)%/,"$1pct")
+return'"'+obj+'"';case'array':return'['+map(obj,function(el){return f.asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+f.asString(obj[prop]));}}
return'{'+str.join(',')+'}';}
return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");},getHTML:function(opts,conf){opts=extend({},opts);var html='<object width="'+opts.width+'" height="'+opts.height+'" id="'+opts.id+'" name="'+opts.id+'"';if(opts.cachebusting){opts.src+=((opts.src.indexOf("?")!=-1?"&":"?")+Math.random());}
if(opts.w3c||!IE){html+=' data="'+opts.src+'" type="application/x-shockwave-flash"';}else{html+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';}
html+='>';if(opts.w3c||IE){html+='<param name="movie" value="'+opts.src+'" />';}
opts.width=opts.height=opts.id=opts.w3c=opts.src=null;opts.onFail=opts.version=opts.expressInstall=null;for(var key in opts){if(opts[key]){html+='<param name="'+key+'" value="'+opts[key]+'" />';}}
-var vars="";if(conf){for(var k in conf){if(conf[k]){var val=conf[k];vars+=encodeURIComponent(k)+'='
-+encodeURIComponent(/function|object/.test(typeof val)?f.asString(val):val)
-+'&';}}
-vars=vars.slice(0,-1);html+='<param name="flashvars" value="'+vars+'" />';}
-html+="</object>";return html;},isSupported:function(ver){return VERSION[0]>ver[0]||VERSION[0]==ver[0]&&VERSION[1]>=ver[1];}});var VERSION=f.getVersion();function Flash(root,opts,conf){if(f.isSupported(opts.version)){root.innerHTML=f.getHTML(opts,conf);}else if(opts.expressInstall&&f.isSupported([6,65])){root.innerHTML=f.getHTML(extend(opts,{src:opts.expressInstall}),{MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title});}else{if(!root.innerHTML.replace(/\s/g,'')){root.innerHTML="<h2>Flash version "+opts.version+" or greater is required</h2>"+"<h3>"+
+var vars="";if(conf){for(var k in conf){if(conf[k]){var val=conf[k];vars+=k+'='+(/function|object/.test(typeof val)?f.asString(val):val)+'&';}}
+vars=vars.slice(0,-1);html+='<param name="flashvars" value=\''+vars+'\' />';}
+html+="</object>";return html;},isSupported:function(ver){return VERSION[0]>ver[0]||VERSION[0]==ver[0]&&VERSION[1]>=ver[1];}});var VERSION=f.getVersion();function Flash(root,opts,conf){if(f.isSupported(opts.version)){root.innerHTML=f.getHTML(opts,conf);}else if(opts.expressInstall&&f.isSupported([6,65])){root.innerHTML=f.getHTML(extend(opts,{src:opts.expressInstall}),{MMredirectURL:encodeURIComponent(location.href),MMplayerType:'PlugIn',MMdoctitle:document.title});}else{if(!root.innerHTML.replace(/\s/g,'')){root.innerHTML="<h2>Flash version "+opts.version+" or greater is required</h2>"+"<h3>"+
(VERSION[0]>0?"Your version is "+VERSION:"You have no flash plugin installed")+"</h3>"+
-(root.tagName=='A'?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+URL+"'>here</a></p>");if(root.tagName=='A'){root.onclick=function(){location.href=URL;};}}
+(root.tagName=='A'?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+URL+"'>here</a></p>");if(root.tagName=='A'||root.tagName=="DIV"){root.onclick=function(){location.href=URL;};}}
if(opts.onFail){var ret=opts.onFail.call(this);if(typeof ret=='string'){root.innerHTML=ret;}}}
if(IE){window[opts.id]=document.getElementById(opts.id);}
extend(this,{getRoot:function(){return root;},getOptions:function(){return opts;},getConf:function(){return conf;},getApi:function(){return root.firstChild;}});}
-var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function string2JsonString(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
-if(JQUERY){jQuery.tools=jQuery.tools||{version:'3.2.6'};jQuery.tools.flashembed={conf:GLOBAL_OPTS};jQuery.fn.flashembed=function(opts,conf){return this.each(function(){jQuery(this).data("flashembed",flashembed(this,opts,conf));});};}})();$f.addPlugin("ipad",function(options){var STATE_UNLOADED=-1;var STATE_LOADED=0;var STATE_UNSTARTED=1;var STATE_BUFFERING=2;var STATE_PLAYING=3;var STATE_PAUSED=4;var STATE_ENDED=5;var self=this;var currentVolume=1;var onStartFired=false;var stopping=false;var playAfterSeek=false;var activeIndex=0;var activePlaylist=[];var clipDefaults={accelerated:false,autoBuffering:false,autoPlay:true,baseUrl:null,bufferLength:3,connectionProvider:null,cuepointMultiplier:1000,cuepoints:[],controls:{},duration:0,extension:'',fadeInSpeed:1000,fadeOutSpeed:1000,image:false,linkUrl:null,linkWindow:'_self',live:false,metaData:{},originalUrl:null,position:0,playlist:[],provider:'http',scaling:'scale',seekableOnBegin:false,start:0,url:null,urlResolvers:[]};var currentState=STATE_UNLOADED;var previousState=STATE_UNLOADED;var isiDevice=/iPad|iPhone|iPod/i.test(navigator.userAgent);var video=null;function extend(to,from,includeFuncs){if(from){for(key in from){if(key){if(from[key]&&typeof from[key]=="function"&&!includeFuncs)
-continue;if(from[key]&&typeof from[key]=="object"&&from[key].length==undefined){var cp={};extend(cp,from[key]);to[key]=cp;}else{to[key]=from[key];}}}}
+if(JQUERY){jQuery.tools=jQuery.tools||{version:'3.2.11'};jQuery.tools.flashembed={conf:GLOBAL_OPTS};jQuery.fn.flashembed=function(opts,conf){return this.each(function(){$(this).data("flashembed",flashembed(this,opts,conf));});};}})();$f.addPlugin("ipad",function(options){var STATE_UNLOADED=-1;var STATE_LOADED=0;var STATE_UNSTARTED=1;var STATE_BUFFERING=2;var STATE_PLAYING=3;var STATE_PAUSED=4;var STATE_ENDED=5;var self=this;var currentVolume=1;var onStartFired=false;var stopping=false;var playAfterSeek=false;var activeIndex=0;var activePlaylist=[];var lastSecondTimer;var endTime=null;var startTime=0;var clipDefaults={accelerated:false,autoBuffering:false,autoPlay:true,baseUrl:null,bufferLength:3,connectionProvider:null,cuepointMultiplier:1000,cuepoints:[],controls:{},duration:0,extension:'',fadeInSpeed:1000,fadeOutSpeed:1000,image:false,linkUrl:null,linkWindow:'_self',live:false,metaData:{},originalUrl:null,position:0,playlist:[],provider:'http',scaling:'scale',seekableOnBegin:false,start:0,url:null,urlResolvers:[]};var currentState=STATE_UNLOADED;var previousState=STATE_UNLOADED;var isiDevice=/iPad|iPhone|iPod/i.test(navigator.userAgent);var video=null;function extend(to,from,includeFuncs){if(from){for(key in from){if(key){if(from[key]&&typeof from[key]=="function"&&!includeFuncs)
+continue;if(from[key]&&typeof from[key]=="object"&&from[key].length===undefined){var cp={};extend(cp,from[key]);to[key]=cp;}else{to[key]=from[key];}}}}
return to;}
-var opts={simulateiDevice:false,controlsSizeRatio:1.5,controls:true,debug:false,validExtensions:/mov|m4v|mp4|avi/gi};extend(opts,options);function log(){if(opts.debug){if(isiDevice){var str=[].splice.call(arguments,0).join(', ');console.log.apply(console,[str]);}else{console.log.apply(console,arguments);}}}
+var opts={simulateiDevice:false,controlsSizeRatio:1.5,controls:true,debug:false,validExtensions:'mov|m4v|mp4|avi|mp3|m4a|aac|m3u8|m3u|pls',posterExtensions:'png|jpg'};extend(opts,options);var validExtensions=new RegExp('^\.('+opts.validExtensions+')$','i');var posterExtensions=new RegExp('^\.('+opts.posterExtensions+')$','i');function log(){if(opts.debug){if(isiDevice){var str=[].splice.call(arguments,0).join(', ');console.log.apply(console,[str]);}else{console.log.apply(console,arguments);}}}
function stateDescription(state){switch(state){case-1:return"UNLOADED";case 0:return"LOADED";case 1:return"UNSTARTED";case 2:return"BUFFERING";case 3:return"PLAYING";case 4:return"PAUSED";case 5:return"ENDED";}
return"UNKOWN";}
function actionAllowed(eventName){var ret=$f.fireEvent(self.id(),"onBefore"+eventName,activeIndex);return ret!==false;}
@@ -142,25 +139,29 @@ var _playTimeTracker=null;function startPlayTimeTracker(){if(_playTimeTracker)
return;console.log("starting tracker");_playTimeTracker=setInterval(onTimeTracked,100);onTimeTracked();}
function stopPlayTimeTracker(){clearInterval(_playTimeTracker);_playTimeTracker=null;}
function onTimeTracked(){var currentTime=Math.floor(video.fp_getTime()*10)*100;var duration=Math.floor(video.duration*10)*100;var fireTime=(new Date()).time;function fireCuePointsIfNeeded(time,cues){time=time>=0?time:duration-Math.abs(time);for(var i=0;i<cues.length;i++){if(cues[i].lastTimeFired>fireTime){cues[i].lastTimeFired=-1;}else if(cues[i].lastTimeFired+500>fireTime){continue;}else{if(time==currentTime||(currentTime-500<time&&currentTime>time)){cues[i].lastTimeFired=fireTime;$f.fireEvent(self.id(),'onCuepoint',activeIndex,cues[i].fnId,cues[i].parameters);}}}}
-$f.each(self.getCommonClip()._cuepoints,fireCuePointsIfNeeded);$f.each(activePlaylist[activeIndex]._cuepoints,fireCuePointsIfNeeded);}
+$f.each(self.getCommonClip().cuepoints,fireCuePointsIfNeeded);$f.each(activePlaylist[activeIndex].cuepoints,fireCuePointsIfNeeded);}
function replay(){resetState();playAfterSeek=true;video.fp_seek(0);}
function scaleVideo(clip){}
-function addAPI(){function fixClip(clip){var extendedClip={};extend(extendedClip,clipDefaults);extend(extendedClip,self.getCommonClip());extend(extendedClip,clip);if(extendedClip.ipadUrl)
+function addAPI(){console.log(video);function fixClip(clip){var extendedClip={};extend(extendedClip,clipDefaults);extend(extendedClip,self.getCommonClip());extend(extendedClip,clip);if(extendedClip.ipadUrl)
url=decodeURIComponent(extendedClip.ipadUrl);else if(extendedClip.url)
-url=extendedClip.url;if(url&&url.indexOf('://')==-1&&extendedClip.baseUrl)
-url=extendedClip.baseUrl+'/'+url;extendedClip.originalUrl=extendedClip.url;extendedClip.completeUrl=url;extendedClip.extension=extendedClip.completeUrl.substr(extendedClip.completeUrl.lastIndexOf('.'));extendedClip.type='video';delete extendedClip.index;log("fixed clip",extendedClip);return extendedClip;}
-video.fp_play=function(clip,inStream,forcePlay){var url=null;var autoBuffering=true;var autoPlay=true;log("Calling play() "+clip,clip);if(inStream){log("ERROR: inStream clips not yet supported");return;}
+url=extendedClip.url;if(url&&url.indexOf('://')==-1&&extendedClip.ipadBaseUrl)
+url=extendedClip.ipadBaseUrl+'/'+url;else if(url&&url.indexOf('://')==-1&&extendedClip.baseUrl)
+url=extendedClip.baseUrl+'/'+url;extendedClip.originalUrl=extendedClip.url;extendedClip.completeUrl=url;extendedClip.extension=extendedClip.completeUrl.substr(extendedClip.completeUrl.lastIndexOf('.'));var queryIndex=extendedClip.extension.indexOf('?');if(queryIndex>-1)
+extendedClip.extension=extendedClip.extension.substr(0,queryIndex);extendedClip.type='video';delete extendedClip.index;log("fixed clip",extendedClip);return extendedClip;}
+video.fp_play=function(clip,inStream,forcePlay,poster){var url=null;var autoBuffering=true;var autoPlay=true;log("Calling play() "+clip,clip);if(inStream){log("ERROR: inStream clips not yet supported");return;}
if(clip!==undefined){if(typeof clip=="number"){if(activeIndex>=activePlaylist.length)
return;activeIndex=clip;clip=activePlaylist[activeIndex];}else{if(typeof clip=="string"){clip={url:clip};}
video.fp_setPlaylist(clip.length!==undefined?clip:[clip]);}
-if(!opts.validExtensions.test(activePlaylist[activeIndex].extension)){if(activePlaylist.length>1&&activeIndex<(activePlaylist.length-1)){log("Not last clip in the playlist, moving to next one");video.fp_play(++activeIndex,false,true);}
+if(!validExtensions.test(activePlaylist[activeIndex].extension)){if(activePlaylist.length>1&&activeIndex<activePlaylist.length-1){var poster;if(posterExtensions.test(activePlaylist[activeIndex].extension)){poster=activePlaylist[activeIndex].url;console.log("Poster image available with url "+poster);}
+++activeIndex;console.log("Not last clip in the playlist, moving to next one");video.fp_play(activeIndex,false,true,poster);}
return;}
clip=activePlaylist[activeIndex];url=clip.completeUrl;if(clip.autoBuffering!==undefined&&clip.autoBuffering===false)
-autoBuffering=false;if(clip.autoPlay===undefined||clip.autoPlay===true||forcePlay===true){autoBuffering=true;autoPlay=true;}else{autoPlay=false;}}else{log("clip was not given, simply calling video.play, if not already buffering");if(currentState!=STATE_BUFFERING)
-video.play();return;}
+autoBuffering=false;if(clip.autoPlay===undefined||clip.autoPlay===true||forcePlay===true){autoBuffering=true;autoPlay=true;}else{autoPlay=false;}}else{log("clip was not given, simply calling video.play, if not already buffering");if(currentState!=STATE_BUFFERING){video.play();}
+return;}
log("about to play "+url,autoBuffering,autoPlay);resetState();if(url){log("Changing SRC attribute"+url);video.setAttribute('src',url);}
if(autoBuffering){if(!actionAllowed('Begin'))
-return false;$f.fireEvent(self.id(),'onBegin',activeIndex);log("calling video.load()");video.load();}
+return false;if(poster){autoPlay=clip.autoPlay;video.setAttribute('poster',poster);video.setAttribute('preload',"none");}
+$f.fireEvent(self.id(),'onBegin',activeIndex);log("calling video.load()");video.load();}
if(autoPlay){log("calling video.play()");video.play();}}
video.fp_pause=function(){log("pause called");if(!actionAllowed('Pause'))
return false;video.pause();};video.fp_resume=function(){log("resume called");if(!actionAllowed('Resume'))
@@ -182,26 +183,30 @@ video.fp_isFullscreen=function(){return false;}
video.fp_toggleFullscreen=function(){if(video.fp_isFullscreen())
video.webkitExitFullscreen();else
video.webkitEnterFullscreen();}
-video.fp_addCuepoints=function(points,index,fnId){var clip=index==-1?self.getCommonClip():activePlaylist[index];clip._cuepoints=clip._cuepoints||{};points=points instanceof Array?points:[points];for(var i=0;i<points.length;i++){var time=typeof points[i]=="object"?(points[i]['time']||null):points[i];if(time==null)continue;time=Math.floor(time/100)*100;var parameters=time;if(typeof points[i]=="object"){parameters=extend({},points[i],false);if(parameters['time']!=undefined)delete parameters['time'];if(parameters['parameters']!=undefined){extend(parameters,parameters['parameters'],false);delete parameters['parameters'];}}
-clip._cuepoints[time]=clip._cuepoints[time]||[];clip._cuepoints[time].push({fnId:fnId,lastTimeFired:-1,parameters:parameters});}}
+video.fp_addCuepoints=function(points,index,fnId){var clip=index==-1?self.getCommonClip():activePlaylist[index];clip.cuepoints=clip.cuepoints||{};points=points instanceof Array?points:[points];for(var i=0;i<points.length;i++){var time=typeof points[i]=="object"?(points[i]['time']||null):points[i];if(time==null)continue;time=Math.floor(time/100)*100;var parameters=time;if(typeof points[i]=="object"){parameters=extend({},points[i],false);if(parameters['time']===undefined)delete parameters['time'];if(parameters['parameters']!==undefined){extend(parameters,parameters['parameters'],false);delete parameters['parameters'];}}
+clip.cuepoints[time]=clip.cuepoints[time]||[];clip.cuepoints[time].push({fnId:fnId,lastTimeFired:-1,parameters:parameters});}}
$f.each(("toggleFullscreen,stopBuffering,reset,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled,css,animate,showPlugin,hidePlugin,togglePlugin,fadeTo,invoke,loadPlugin").split(","),function(){var name=this;video["fp_"+name]=function(){log("ERROR: unsupported API on iDevices "+name);return false;};});}
function addListeners(){var events=['abort','canplay','canplaythrough','durationchange','emptied','ended','error','loadeddata','loadedmetadata','loadstart','pause','play','playing','progress','ratechange','seeked','seeking','stalled','suspend','volumechange','waiting'];var eventsLogger=function(e){log("Got event "+e.type,e);}
for(var i=0;i<events.length;i++)
video.addEventListener(events[i],eventsLogger,false);var onBufferEmpty=function(e){log("got onBufferEmpty event "+e.type)
setState(STATE_BUFFERING);$f.fireEvent(self.id(),'onBufferEmpty',activeIndex);};video.addEventListener('emptied',onBufferEmpty,false);video.addEventListener('waiting',onBufferEmpty,false);var onBufferFull=function(e){if(previousState==STATE_UNSTARTED||previousState==STATE_BUFFERING){}else{log("Restoring old state "+stateDescription(previousState));setState(previousState);}
-$f.fireEvent(self.id(),'onBufferFull',activeIndex);};video.addEventListener('canplay',onBufferFull,false);video.addEventListener('canplaythrough',onBufferFull,false);var onMetaData=function(e){video.fp_updateClip({duration:video.duration,metaData:{duration:video.duration}},activeIndex);activePlaylist[activeIndex].duration=video.duration;$f.fireEvent(self.id(),'onMetaData',activeIndex,activePlaylist[activeIndex]);};video.addEventListener('loadedmetadata',onMetaData,false);video.addEventListener('durationchange',onMetaData,false);var onStart=function(e){if(currentState==STATE_PAUSED){if(!actionAllowed('Resume')){log("Resume disallowed, pausing");video.fp_pause();return stopEvent(e);}
+$f.fireEvent(self.id(),'onBufferFull',activeIndex);};video.addEventListener('canplay',onBufferFull,false);video.addEventListener('canplaythrough',onBufferFull,false);var onMetaData=function(e){var clipDuration;startTime=activePlaylist[activeIndex].start;if(activePlaylist[activeIndex].duration>0){clipDuration=activePlaylist[activeIndex].duration;endTime=clipDuration+startTime;}else{clipDuration=video.duration;endTime=null;}
+video.fp_updateClip({duration:clipDuration,metaData:{duration:video.duration}},activeIndex);activePlaylist[activeIndex].duration=video.duration;activePlaylist[activeIndex].metaData={duration:video.duration};$f.fireEvent(self.id(),'onMetaData',activeIndex,activePlaylist[activeIndex]);};video.addEventListener('loadedmetadata',onMetaData,false);video.addEventListener('durationchange',onMetaData,false);var onTimeUpdate=function(e){if(endTime&&video.currentTime>endTime){video.fp_seek(startTime);resetState();return stopEvent(e);}};video.addEventListener("timeupdate",onTimeUpdate,false);var onStart=function(e){if(currentState==STATE_PAUSED){if(!actionAllowed('Resume')){log("Resume disallowed, pausing");video.fp_pause();return stopEvent(e);}
$f.fireEvent(self.id(),'onResume',activeIndex);}
-setState(STATE_PLAYING);if(!onStartFired){onStartFired=true;$f.fireEvent(self.id(),'onStart',activeIndex);}};video.addEventListener('playing',onStart,false);var onFinish=function(e){if(!actionAllowed('Finish')){if(activePlaylist.length==1){log("Active playlist only has one clip, onBeforeFinish returned false. Replaying");replay();}else if(activeIndex!=(activePlaylist.length-1)){log("Not the last clip in the playlist, but onBeforeFinish returned false. Returning to the beginning of current clip");video.fp_seek(0);}else{log("Last clip in playlist, but onBeforeFinish returned false, start again from the beginning");video.fp_play(0);}
+setState(STATE_PLAYING);if(!onStartFired){onStartFired=true;$f.fireEvent(self.id(),'onStart',activeIndex);}};video.addEventListener('playing',onStart,false);var onPlay=function(e){startLastSecondTimer();}
+video.addEventListener('play',onPlay,false);var onFinish=function(e){if(!actionAllowed('Finish')){if(activePlaylist.length==1){log("Active playlist only has one clip, onBeforeFinish returned false. Replaying");replay();}else if(activeIndex!=(activePlaylist.length-1)){log("Not the last clip in the playlist, but onBeforeFinish returned false. Returning to the beginning of current clip");video.fp_seek(0);}else{log("Last clip in playlist, but onBeforeFinish returned false, start again from the beginning");video.fp_play(0);}
return stopEvent(e);}
setState(STATE_ENDED);$f.fireEvent(self.id(),'onFinish',activeIndex);if(activePlaylist.length>1&&activeIndex<(activePlaylist.length-1)){log("Not last clip in the playlist, moving to next one");video.fp_play(++activeIndex,false,true);}};video.addEventListener('ended',onFinish,false);var onError=function(e){setState(STATE_LOADED,true);$f.fireEvent(self.id(),'onError',activeIndex,201);if(opts.onFail&&opts.onFail instanceof Function)
opts.onFail.apply(self,[]);};video.addEventListener('error',onError,false);var onPause=function(e){log("got pause event from player"+self.id());if(stopping)
return;if(currentState==STATE_BUFFERING&&previousState==STATE_UNSTARTED){log("forcing play");setTimeout(function(){video.play();},0);return;}
if(!actionAllowed('Pause')){video.fp_resume();return stopEvent(e);}
-setState(STATE_PAUSED);$f.fireEvent(self.id(),'onPause',activeIndex);}
+stopLastSecondTimer();setState(STATE_PAUSED);$f.fireEvent(self.id(),'onPause',activeIndex);}
video.addEventListener('pause',onPause,false);var onSeek=function(e){$f.fireEvent(self.id(),'onBeforeSeek',activeIndex);};video.addEventListener('seeking',onSeek,false);var onSeekDone=function(e){if(stopping){stopping=false;$f.fireEvent(self.id(),'onStop',activeIndex);}
else
$f.fireEvent(self.id(),'onSeek',activeIndex);log("seek done, currentState",stateDescription(currentState));if(playAfterSeek){playAfterSeek=false;video.fp_play();}else if(currentState!=STATE_PLAYING)
video.fp_pause();};video.addEventListener('seeked',onSeekDone,false);var onVolumeChange=function(e){$f.fireEvent(self.id(),'onVolume',video.fp_getVolume());};video.addEventListener('volumechange',onVolumeChange,false);}
+function startLastSecondTimer(){lastSecondTimer=setInterval(function(){if(video.fp_getTime()>=video.duration-1){$f.fireEvent(self.id(),'onLastSecond',activeIndex);stopLastSecondTimer();}},100);}
+function stopLastSecondTimer(){clearInterval(lastSecondTimer);}
function onPlayerLoaded(){video.fp_play(0);}
function installControlbar(){}
if(isiDevice||opts.simulateiDevice){if(!window.flashembed.__replaced){var realFlashembed=window.flashembed;window.flashembed=function(root,opts,conf){if(typeof root=='string'){root=document.getElementById(root.replace("#",""));}
diff --git a/lib/flowplayer.pseudostreaming-byterange.swf b/lib/flowplayer.pseudostreaming-byterange.swf
new file mode 100644
index 00000000..04e85fec
--- /dev/null
+++ b/lib/flowplayer.pseudostreaming-byterange.swf
Binary files differ
diff --git a/lib/flowplayer.pseudostreaming.swf b/lib/flowplayer.pseudostreaming.swf
index 28f5d72a..77b23fc8 100644
--- a/lib/flowplayer.pseudostreaming.swf
+++ b/lib/flowplayer.pseudostreaming.swf
Binary files differ
diff --git a/lib/flowplayer.swf b/lib/flowplayer.swf
index 20a41193..df499cc7 100644
--- a/lib/flowplayer.swf
+++ b/lib/flowplayer.swf
Binary files differ
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index be1968dc..1a7ed53c 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -36,7 +36,7 @@ class comment_rss_Core {
}
if ($item && comment_rss::feed_visible("per_item")) {
- $feeds["comment/item/$item->id"] =
+ $feeds["comment/per_item/$item->id"] =
t("Comments on %title", array("title" => html::purify($item->title)));
}
return $feeds;
diff --git a/modules/gallery/controllers/admin_advanced_settings.php b/modules/gallery/controllers/admin_advanced_settings.php
index 1ce47529..752a2e81 100644
--- a/modules/gallery/controllers/admin_advanced_settings.php
+++ b/modules/gallery/controllers/admin_advanced_settings.php
@@ -30,24 +30,28 @@ class Admin_Advanced_Settings_Controller extends Admin_Controller {
}
public function edit($module_name, $var_name) {
- $value = module::get_var($module_name, $var_name);
- $form = new Forge("admin/advanced_settings/save/$module_name/$var_name", "", "post");
- $group = $form->group("edit_var")->label(t("Edit setting"));
- $group->input("module_name")->label(t("Module"))->value($module_name)->disabled(1);
- $group->input("var_name")->label(t("Setting"))->value($var_name)->disabled(1);
- $group->textarea("value")->label(t("Value"))->value($value);
- $group->submit("")->value(t("Save"));
- print $form;
+ if (module::is_installed($module_name)) {
+ $value = module::get_var($module_name, $var_name);
+ $form = new Forge("admin/advanced_settings/save/$module_name/$var_name", "", "post");
+ $group = $form->group("edit_var")->label(t("Edit setting"));
+ $group->input("module_name")->label(t("Module"))->value($module_name)->disabled(1);
+ $group->input("var_name")->label(t("Setting"))->value($var_name)->disabled(1);
+ $group->textarea("value")->label(t("Value"))->value($value);
+ $group->submit("")->value(t("Save"));
+ print $form;
+ }
}
public function save($module_name, $var_name) {
access::verify_csrf();
- module::set_var($module_name, $var_name, Input::instance()->post("value"));
- message::success(
- t("Saved value for %var (%module_name)",
- array("var" => $var_name, "module_name" => $module_name)));
+ if (module::is_installed($module_name)) {
+ module::set_var($module_name, $var_name, Input::instance()->post("value"));
+ message::success(
+ t("Saved value for %var (%module_name)",
+ array("var" => $var_name, "module_name" => $module_name)));
- json::reply(array("result" => "success"));
+ json::reply(array("result" => "success"));
+ }
}
}
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index e1e4e7a9..e556b49a 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -313,7 +313,7 @@ class gallery_installer {
module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
module::set_var("gallery", "timezone", null);
- module::set_version("gallery", 49);
+ module::set_version("gallery", 50);
}
static function upgrade($version) {
@@ -405,7 +405,7 @@ class gallery_installer {
// for now because we don't want a lengthy operation here.
$db->query("UPDATE {items} SET `slug` = `name`");
- // Flush all path caches becuase we're going to start urlencoding them.
+ // Flush all path caches because we're going to start urlencoding them.
$db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL");
module::set_version("gallery", $version = 12);
}
@@ -692,6 +692,27 @@ class gallery_installer {
module::set_var("gallery", "timezone", null);
module::set_version("gallery", $version = 49);
}
+
+ if ($version == 49) {
+ // In v49 we changed the Item_Model validation code to disallow files with two dots in them,
+ // but we didn't rename any files which fail to validate, so as soon as you do anything to
+ // change those files (eg. as a side effect of getting the url or file path) it fails to
+ // validate. Fix those here. This might be slow, but if it times out it can just pick up
+ // where it left off.
+ foreach (db::build()
+ ->from("items")
+ ->select("id")
+ ->where("type", "<>", "album")
+ ->where(db::expr("`name` REGEXP '\\\\..*\\\\.'"), "=", 1)
+ ->order_by("id", "asc")
+ ->execute() as $row) {
+ set_time_limit(30);
+ $item = ORM::factory("item", $row->id);
+ $item->name = legal_file::smash_extensions($item->name);
+ $item->save();
+ }
+ module::set_version("gallery", $version = 50);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index 9a35ce67..65a72884 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -26,9 +26,11 @@ class gallery_task_Core {
const FIX_STATE_RUN_DUPE_SLUGS = 5;
const FIX_STATE_START_DUPE_NAMES = 6;
const FIX_STATE_RUN_DUPE_NAMES = 7;
- const FIX_STATE_START_MISSING_ACCESS_CACHES = 8;
- const FIX_STATE_RUN_MISSING_ACCESS_CACHES = 9;
- const FIX_STATE_DONE = 10;
+ const FIX_STATE_START_REBUILD_ITEM_CACHES = 8;
+ const FIX_STATE_RUN_REBUILD_ITEM_CACHES = 9;
+ const FIX_STATE_START_MISSING_ACCESS_CACHES = 10;
+ const FIX_STATE_RUN_MISSING_ACCESS_CACHES = 11;
+ const FIX_STATE_DONE = 12;
static function available_tasks() {
$dirty_count = graphics::find_dirty_images_query()->count_records();
@@ -337,10 +339,15 @@ class gallery_task_Core {
$total = $task->get("total");
if (empty($total)) {
+ $item_count = db::build()->count_records("items");
+ $total = 0;
+
// mptt: 2 operations for every item
- $total = 2 * db::build()->count_records("items");
+ $total += 2 * $item_count;
+
// album audit (permissions and bogus album covers): 1 operation for every album
$total += db::build()->where("type", "=", "album")->count_records("items");
+
// one operation for each missing slug, name and access cache
foreach (array("find_dupe_slugs", "find_dupe_names", "find_missing_access_caches") as $func) {
foreach (self::$func() as $row) {
@@ -348,6 +355,9 @@ class gallery_task_Core {
}
}
+ // one operation to rebuild path and url caches;
+ $total += 1 * $item_count;
+
$task->set("total", $total);
$task->set("state", $state = self::FIX_STATE_START_MPTT);
$task->set("ptr", 1);
@@ -556,37 +566,76 @@ class gallery_task_Core {
$completed++;
if (empty($stack)) {
- $state = self::FIX_STATE_START_MISSING_ACCESS_CACHES;
+ $state = self::FIX_STATE_START_REBUILD_ITEM_CACHES;
}
break;
- case self::FIX_STATE_START_MISSING_ACCESS_CACHES:
+ case self::FIX_STATE_START_REBUILD_ITEM_CACHES:
$stack = array();
- foreach (self::find_missing_access_caches() as $row) {
+ foreach (self::find_empty_item_caches(500) as $row) {
$stack[] = $row->id;
}
- if ($stack) {
+ $task->set("stack", implode(" ", $stack));
+ $state = self::FIX_STATE_RUN_REBUILD_ITEM_CACHES;
+ break;
+
+ case self::FIX_STATE_RUN_REBUILD_ITEM_CACHES:
+ $stack = explode(" ", $task->get("stack"));
+ if (!empty($stack)) {
+ $id = array_pop($stack);
+ $item = ORM::factory("item", $id);
+ $item->relative_path(); // this rebuilds the cache and saves the item as a side-effect
$task->set("stack", implode(" ", $stack));
- $state = self::FIX_STATE_RUN_MISSING_ACCESS_CACHES;
- } else {
- $state = self::FIX_STATE_DONE;
+ $completed++;
+ }
+
+ if (empty($stack)) {
+ // Try refilling the stack
+ foreach (self::find_empty_item_caches(500) as $row) {
+ $stack[] = $row->id;
+ }
+ $task->set("stack", implode(" ", $stack));
+
+ if (empty($stack)) {
+ $state = self::FIX_STATE_START_MISSING_ACCESS_CACHES;
+ }
+ }
+ break;
+
+ case self::FIX_STATE_START_MISSING_ACCESS_CACHES:
+ $stack = array();
+ foreach (self::find_missing_access_caches_limited(500) as $row) {
+ $stack[] = $row->id;
}
+ $task->set("stack", implode(" ", $stack));
+ $state = self::FIX_STATE_RUN_MISSING_ACCESS_CACHES;
break;
case self::FIX_STATE_RUN_MISSING_ACCESS_CACHES:
$stack = explode(" ", $task->get("stack"));
- $id = array_pop($stack);
- $access_cache = ORM::factory("access_cache");
- $access_cache->item_id = $id;
- $access_cache->save();
- $task->set("stack", implode(" ", $stack));
- $completed++;
+ if (!empty($stack)) {
+ $id = array_pop($stack);
+ $access_cache = ORM::factory("access_cache");
+ $access_cache->item_id = $id;
+ $access_cache->save();
+ $task->set("stack", implode(" ", $stack));
+ $completed++;
+ }
+
if (empty($stack)) {
- // The new cache rows are there, but they're incorrectly populated so we have to fix
- // them. If this turns out to be too slow, we'll have to refactor
- // access::recalculate_permissions to allow us to do it in slices.
- access::recalculate_album_permissions(item::root());
- $state = self::FIX_STATE_DONE;
+ // Try refilling the stack
+ foreach (self::find_missing_access_caches_limited(500) as $row) {
+ $stack[] = $row->id;
+ }
+ $task->set("stack", implode(" ", $stack));
+
+ if (empty($stack)) {
+ // The new cache rows are there, but they're incorrectly populated so we have to fix
+ // them. If this turns out to be too slow, we'll have to refactor
+ // access::recalculate_permissions to allow us to do it in slices.
+ access::recalculate_album_permissions(item::root());
+ $state = self::FIX_STATE_DONE;
+ }
}
break;
}
@@ -632,12 +681,27 @@ class gallery_task_Core {
->execute();
}
+ static function find_empty_item_caches($limit) {
+ return db::build()
+ ->select("items.id")
+ ->from("items")
+ ->where("relative_path_cache", "is", null)
+ ->or_where("relative_url_cache", "is", null)
+ ->limit($limit)
+ ->execute();
+ }
+
static function find_missing_access_caches() {
+ return self::find_missing_access_caches_limited(1 << 16);
+ }
+
+ static function find_missing_access_caches_limited($limit) {
return db::build()
->select("items.id")
->from("items")
->join("access_caches", "items.id", "access_caches.item_id", "left")
->where("access_caches.id", "is", null)
+ ->limit($limit)
->execute();
}
} \ No newline at end of file
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 903dadad..931da382 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -806,7 +806,7 @@ class Item_Model_Core extends ORM_MPTT {
// Do not accept files with double extensions, they can cause problems on some
// versions of Apache.
- if (substr_count($this->name, ".") > 1) {
+ if (!$this->is_album() && substr_count($this->name, ".") > 1) {
$v->add_error("name", "illegal_data_file_extension");
}
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 42345531..a905a241 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,6 +1,6 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 49
+version = 50
author_name = "Gallery Team"
author_url = "http://codex.gallery2.org/Gallery:Team"
info_url = "http://codex.gallery2.org/Gallery3:Modules:gallery"
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index 876fc137..8ae8a5dd 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -520,4 +520,10 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$this->assert_true(false, "Shouldn't get here");
}
}
+
+ public function albums_can_have_two_dots_in_name_test() {
+ $album = test::random_album_unsaved(item::root());
+ $album->name = $album->name . ".foo.bar";
+ $album->save();
+ }
}
diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php
index 8d21d890..6745f0df 100644
--- a/modules/gallery/views/admin_advanced_settings.html.php
+++ b/modules/gallery/views/admin_advanced_settings.html.php
@@ -19,7 +19,7 @@
</tr>
<? foreach ($vars as $var): ?>
<tr class="setting-row <?= text::alternate("g-odd", "g-even") ?>">
- <td> <?= $var->module_name ?> </td>
+ <td> <?= html::clean($var->module_name) ?> </td>
<td> <?= html::clean($var->name) ?> </td>
<td>
<a href="<?= url::site("admin/advanced_settings/edit/$var->module_name/" . html::clean($var->name)) ?>"
diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php
index 96d6532c..343eafe8 100644
--- a/modules/gallery/views/movieplayer.html.php
+++ b/modules/gallery/views/movieplayer.html.php
@@ -14,7 +14,7 @@
},
plugins: {
pseudostreaming: {
- url: "<?= url::abs_file("lib/flowplayer.pseudostreaming.swf") ?>"
+ url: "<?= url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf") ?>"
},
controls: {
autoHide: 'always',
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index d2757219..b54fbfb9 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -126,7 +126,8 @@ class tag_event_Core {
.gallery_autocomplete(
'$autocomplete_url',
{max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}
- )
+ );
+ $('input[name=tags]')
.change(function (event) {
$('#g-uploadify').uploadifySettings('scriptData', {'tags': $(this).val()});
});");