Merge tag 'upstream/3.0.6'

Upstream version 3.0.6
This commit is contained in:
Anthony Callegaro 2013-04-04 10:26:00 +00:00
commit 0e61a6e88b
41 changed files with 156 additions and 163 deletions

41
README
View File

@ -1,14 +1,18 @@
Gallery 3.0.5 (Daydreaming)
Gallery 3.0.6 (Rive Gauche)
===========================
About
-----
ABOUT:
Gallery 3 is a web based software product that lets you manage your
photos on your own website. You must have your own website with PHP
and database support in order to install and use it. With Gallery you
can easily create and share albums of photos via an intuitive
interface.
Intended Audience
-----------------
INTENDED AUDIENCE:
This version is intended for anybody who has a website. We stand
ready to support the product and help you to make the most of it. We
welcome theme and module developers to play with this release and
@ -17,16 +21,18 @@ questions or problems, you can get help in the Gallery forums:
http://galleryproject.org/forum/96
Security
--------
SECURITY:
We've contracted a professional security audit, received their results
and resolved all the issues they found.
Did you find a security flaw? Please email security@galleryproject.org
with the details and we'll fix it ASAP!
Supported Configuration
-----------------------
SUPPORTED CONFIGURATION:
- Platform: Linux / Unix.
- Web server: Apache 2.2 and newer.
- PHP 5.2.3 and newer (PHP's safe_mode must be disabled and simplexml,
@ -34,41 +40,46 @@ SUPPORTED CONFIGURATION:
- Database: MySQL 5 and newer.
For complete system requirements, please refer to:
http://codex.galleryproject.org/Gallery3:Requirements
Installing and Upgrading Instructions
-------------------------------------
INSTALLING AND UPGRADING INSTRUCTIONS:
For comprehensive instructions, The online User Guide is your best resource:
http://codex.galleryproject.org/Gallery3:User_guide
There are also simple instructions below. NOTE: You can upgrade from
beta 1 and beyond, but not from alpha releases.
INSTALLATION VIA THE WEB
INSTALLATION VIA THE WEB:
- Point your web browser at gallery3/installer/ and follow the
instructions.
Point your web browser at gallery3/installer/ and follow the
instructions.
INSTALLATION FROM THE COMMAND LINE
INSTALLATION FROM THE COMMAND LINE:
- php installer/index.php [-h host] [-u user] [-p pass] [-d dbname]
php installer/index.php [-h host] [-u user] [-p pass] [-d dbname]
Command line parameters:
-h Database host (default: localhost)
-u Database user (default: root)
-p Database user password (default: )
-d Database name (default: gallery3)
-x Table prefix (default: )
Bugs?
-----
BUGS?
Go to http://apps.sourceforge.net/trac/gallery/ click the "login" link
and log in with your SourceForge username and password, then click the
"new ticket" button.
Questions, Problems
-------------------
QUESTIONS, PROBLEMS:
- Check out the gallery3 FAQ http://codex.galleryproject.org/Gallery3:FAQ
- Check out the Gallery 3 FAQ: http://codex.galleryproject.org/Gallery3:FAQ
- Post to the Gallery 3 forums: http://galleryproject.org/forum/96
- Email gallery-devel@lists.sourceforge.net

View File

@ -35,7 +35,7 @@ require SYSPATH.'core/Event'.EXT;
final class Event extends Event_Core {}
require SYSPATH.'core/Kohana'.EXT;
require MODPATH.'gallery/libraries/MY_Kohana'.EXT;
final class Kohana extends Kohana_Core {}
require SYSPATH.'core/Kohana_Exception'.EXT;
require MODPATH.'gallery/libraries/MY_Kohana_Exception'.EXT;

View File

@ -93,7 +93,7 @@ if (PHP_SAPI == "cli") {
default:
print "To install:\n";
print " php index.php install -d database -h host -u user -p password -x table_prefix \n\n";
print " php index.php install -d database -h host -u user -p password -x table_prefix -g3p gallery3_admin_password \n\n";
print "To upgrade:\n";
print " php index.php upgrade\n\n";
print "Developer-only features:\n";

View File

@ -90,6 +90,7 @@ function parse_cli_params() {
"password" => "",
"dbname" => "gallery3",
"prefix" => "",
"g3_password" => "",
"type" => function_exists("mysqli_set_charset") ? "mysqli" : "mysql");
$argv = $_SERVER["argv"];
@ -110,6 +111,9 @@ function parse_cli_params() {
case "-x":
$config["prefix"] = $argv[++$i];
break;
case "-g3p":
$config["g3_password"] = $argv[++$i];
break;
}
}

View File

@ -245,7 +245,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',56,1);
INSERT INTO {modules} VALUES (1,1,'gallery',57,1);
INSERT INTO {modules} VALUES (2,1,'user',4,2);
INSERT INTO {modules} VALUES (3,1,'comment',7,3);
INSERT INTO {modules} VALUES (4,1,'organize',4,4);

View File

@ -138,7 +138,9 @@ class installer {
$char += ($char > 90) ? 13 : ($char > 57) ? 7 : 0;
$salt .= chr($char);
}
$password = substr(md5(time() . mt_rand()), 0, 6);
if (!$password = $config["g3_password"]) {
$password = substr(md5(time() . mt_rand()), 0, 6);
}
// Escape backslash in preparation for our UPDATE statement.
$hashed_password = str_replace("\\", "\\\\", $salt . md5($salt . $password));
$sql = self::prepend_prefix($config["prefix"],

Binary file not shown.

View File

@ -1,5 +1,4 @@
(function(){function log(args){console.log("$f.fireEvent",[].slice.call(args));}
!function(){function log(args){console.log("$f.fireEvent",[].slice.call(args));}
function clone(obj){if(!obj||typeof obj!='object'){return obj;}
var temp=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key)){temp[key]=clone(obj[key]);}}
return temp;}
@ -14,6 +13,7 @@ function select(query){var index=query.indexOf(".");if(index!=-1){var tag=query.
function stopEvent(e){e=e||window.event;if(e.preventDefault){e.stopPropagation();e.preventDefault();}else{e.returnValue=false;e.cancelBubble=true;}
return false;}
function bind(to,evt,fn){to[evt]=to[evt]||[];to[evt].push(fn);}
function queryescape(url){return url.replace(/&/g,'%26').replace(/&/g,'%26').replace(/=/g,'%3D');}
function makeId(){return"_"+(""+Math.random()).slice(2,10);}
var Clip=function(json,index,player){var self=this,cuepoints={},listeners={};self.index=index;if(typeof json=='string'){json={url:json};}
extend(this,json,true);each(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var evt="on"+this;if(evt.indexOf("*")!=-1){evt=evt.slice(0,evt.length-1);var before="onBefore"+evt.slice(2);self[before]=function(fn){bind(listeners,before,fn);return self;};}
@ -55,7 +55,7 @@ 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.11";if(self.isLoaded()){var ver=api.fp_getVersion();ver.push(js);return ver;}
return self;},getVersion:function(){var js="flowplayer.js 3.2.12";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){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;}
@ -78,7 +78,9 @@ 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;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);}
if(conf.clip.url){conf.clip.url=queryescape(conf.clip.url);}
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};}
if(clip.url){clip.url=queryescape(clip.url);}
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){if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(playlist[0].url)&&!checkForIpadSupport()){return true;}
@ -97,7 +99,7 @@ each(players,function(){if(this.id()==arg.id||this.id()==arg||this.getParent()==
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:[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://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(){};});}
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]);}}
@ -108,25 +110,27 @@ 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?[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':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]));}}
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]));}}
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+=k+'='+(/function|object/.test(typeof val)?f.asString(val):val)+'&';}}
vars=vars.slice(0,-1);html+='<param name="flashvars" value=\''+vars+'\' />';}
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: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.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;}});}
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)
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:'@VERSION'};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|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);}}}
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=opts.validExtensions?new RegExp('^\.('+opts.validExtensions+')$','i'):null;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;}
@ -152,9 +156,8 @@ video.fp_play=function(clip,inStream,forcePlay,poster){var url=null;var autoBuff
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(!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;}
if(activeIndex==0&&activePlaylist.length>1&&posterExtensions.test(activePlaylist[activeIndex].extension)){var 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;}
if(validExtensions&&!validExtensions.test(activePlaylist[activeIndex].extension)){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;}
@ -179,7 +182,8 @@ log("ERROR: no support for "+name+" plugin on iDevices");return null;};video.fp_
return{bufferStart:bufferStart,bufferEnd:bufferEnd,state:currentState,time:video.fp_getTime(),muted:video.muted,volume:video.fp_getVolume()};};video.fp_getState=function(){return currentState;};video.fp_startBuffering=function(){if(currentState==STATE_UNSTARTED)
video.load();};video.fp_setPlaylist=function(playlist){log("Setting playlist");activeIndex=0;for(var i=0;i<playlist.length;i++)
playlist[i]=fixClip(playlist[i]);activePlaylist=playlist;$f.fireEvent(self.id(),'onPlaylistReplace',playlist);};video.fp_addClip=function(clip,index){clip=fixClip(clip);activePlaylist.splice(index,0,clip);$f.fireEvent(self.id(),'onClipAdd',clip,index);};video.fp_updateClip=function(clip,index){extend(activePlaylist[index],clip);return activePlaylist[index];};video.fp_getVersion=function(){return'3.2.3';}
video.fp_isFullscreen=function(){return false;}
video.fp_isFullscreen=function(){var isfullscreen=video.webkitDisplayingFullscreen;if(isfullscreen!==undefined)
return isfullscreen;return false;}
video.fp_toggleFullscreen=function(){if(video.fp_isFullscreen())
video.webkitExitFullscreen();else
video.webkitEnterFullscreen();}

Binary file not shown.

Binary file not shown.

View File

@ -141,7 +141,7 @@
list.hide();
hover_target.hover(
function() {
list.stop(true, true).slideDown("fast");
list.stop(false, true).slideDown("fast");
$(this).find(".g-dialog-link").gallery_dialog();
$(this).find(".g-ajax-link").gallery_ajax();
},

View File

@ -1055,7 +1055,7 @@ class g2_import_Core {
if (@copy(g2($derivative->fetchPath()), $item->thumb_path())) {
$item->thumb_height = $derivative->getHeight();
$item->thumb_width = $derivative->getWidth();
$item->thumb_dirty = false;
$item->thumb_dirty = 0;
}
}
@ -1066,7 +1066,7 @@ class g2_import_Core {
if (@copy(g2($derivative->fetchPath()), $item->resize_path())) {
$item->resize_height = $derivative->getHeight();
$item->resize_width = $derivative->getWidth();
$item->resize_dirty = false;
$item->resize_dirty = 0;
}
}
}

View File

@ -55,7 +55,7 @@ class Admin_Controller extends Controller {
$method = "index";
}
if (!method_exists($controller_name, $method)) {
if (!class_exists($controller_name) || !method_exists($controller_name, $method)) {
throw new Kohana_404_Exception();
}

View File

@ -55,6 +55,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
->where("expiration", "<>", 0)
->where("expiration", "<=", time())
->execute();
module::deactivate_missing_modules();
}
/**

View File

@ -34,7 +34,6 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
$thumb_size = $form->edit_theme->thumb_size->value;
$thumb_dirty = false;
if (module::get_var("gallery", "thumb_size") != $thumb_size) {
graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
graphics::add_rule(
@ -45,7 +44,6 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
}
$resize_size = $form->edit_theme->resize_size->value;
$resize_dirty = false;
if (module::get_var("gallery", "resize_size") != $resize_size) {
graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
graphics::add_rule(

View File

@ -162,7 +162,6 @@ class File_Proxy_Controller extends Controller {
// going to buffer up whatever file we're proxying (and it may be very large). This may
// affect embedding or systems with PHP's output_buffering enabled.
while (ob_get_level()) {
Kohana_Log::add("error","".print_r(ob_get_level(),1));
if (!@ob_end_clean()) {
// ob_end_clean() can return false if the buffer can't be removed for some reason
// (zlib output compression buffers sometimes cause problems).

View File

@ -35,7 +35,7 @@ class block_manager_Core {
static function activate_blocks($module_name) {
$block_class = "{$module_name}_block";
if (method_exists($block_class, "get_site_list")) {
if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::add("site_sidebar", $module_name, $block_id);
@ -61,14 +61,14 @@ class block_manager_Core {
static function deactivate_blocks($module_name) {
$block_class = "{$module_name}_block";
if (method_exists($block_class, "get_site_list")) {
if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::remove_blocks_for_module("site_sidebar", $module_name);
}
}
if (method_exists($block_class, "get_admin_list")) {
if (class_exists($block_class) && method_exists($block_class, "get_admin_list")) {
$blocks = call_user_func(array($block_class, "get_admin_list"));
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
block_manager::remove_blocks_for_module($location, $module_name);
@ -89,7 +89,7 @@ class block_manager_Core {
foreach (module::active() as $module) {
$class_name = "{$module->name}_block";
if (method_exists($class_name, $function)) {
if (class_exists($class_name) && method_exists($class_name, $function)) {
foreach (call_user_func(array($class_name, $function)) as $id => $title) {
$blocks["{$module->name}:$id"] = $title;
}
@ -102,7 +102,7 @@ class block_manager_Core {
$active = block_manager::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
if (method_exists("$desc[0]_block", "get")) {
if (class_exists("$desc[0]_block") && method_exists("$desc[0]_block", "get")) {
$block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $theme);
if (!empty($block)) {
$block->id = $id;

View File

@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class gallery_Core {
const VERSION = "3.0.5";
const CODE_NAME = "Daydreaming";
const VERSION = "3.0.6";
const CODE_NAME = "Rive Gauche";
const RELEASE_CHANNEL = "release";
const RELEASE_BRANCH = "3.0.x";

View File

@ -797,6 +797,18 @@ class gallery_installer {
module::set_var("gallery", "movie_allow_uploads", "autodetect");
module::set_version("gallery", $version = 56);
}
if ($version == 56) {
// Cleanup possible instances where resize_dirty of albums or movies was set to 0. This is
// unlikely to have occurred, and doesn't currently matter much since albums and movies don't
// have resize images anyway. However, it may be useful to be consistent here going forward.
db::build()
->update("items")
->set("resize_dirty", 1)
->where("type", "<>", "photo")
->execute();
module::set_version("gallery", $version = 57);
}
}
static function uninstall() {

View File

@ -121,12 +121,6 @@ class graphics_Core {
if ($item->resize_dirty && $item->is_photo()) {
$ops["resize"] = $item->resize_path();
}
if (empty($ops)) {
$item->thumb_dirty = 0;
$item->resize_dirty = 0;
$item->save();
return;
}
try {
foreach ($ops as $target => $output_file) {

View File

@ -141,7 +141,7 @@ class module_Core {
$messages = array();
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "can_activate")) {
if (class_exists($installer_class) && method_exists($installer_class, "can_activate")) {
$messages = call_user_func(array($installer_class, "can_activate"));
}
@ -173,7 +173,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "install")) {
if (class_exists($installer_class) && method_exists($installer_class, "install")) {
call_user_func_array(array($installer_class, "install"), array());
}
module::set_version($module_name, module::available()->$module_name->code_version);
@ -226,7 +226,7 @@ class module_Core {
$version_before = module::get_version($module_name);
$installer_class = "{$module_name}_installer";
$available = module::available();
if (method_exists($installer_class, "upgrade")) {
if (class_exists($installer_class) && method_exists($installer_class, "upgrade")) {
call_user_func_array(array($installer_class, "upgrade"), array($version_before));
} else {
if (isset($available->$module_name->code_version)) {
@ -261,7 +261,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "activate")) {
if (class_exists($installer_class) && method_exists($installer_class, "activate")) {
call_user_func_array(array($installer_class, "activate"), array());
}
@ -288,7 +288,7 @@ class module_Core {
*/
static function deactivate($module_name) {
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "deactivate")) {
if (class_exists($installer_class) && method_exists($installer_class, "deactivate")) {
call_user_func_array(array($installer_class, "deactivate"), array());
}
@ -303,8 +303,25 @@ class module_Core {
block_manager::deactivate_blocks($module_name);
log::success(
"module", t("Deactivated module %module_name", array("module_name" => $module_name)));
if (module::info($module_name)) {
log::success(
"module", t("Deactivated module %module_name", array("module_name" => $module_name)));
} else {
log::success(
"module", t("Deactivated missing module %module_name", array("module_name" => $module_name)));
}
}
/**
* Deactivate modules that are unavailable or missing, yet still active.
* This happens when a user deletes a module without deactivating it.
*/
static function deactivate_missing_modules() {
foreach (self::$modules as $module_name => $module) {
if (module::is_active($module_name) && !module::info($module_name)) {
module::deactivate($module_name);
}
}
}
/**
@ -314,7 +331,7 @@ class module_Core {
*/
static function uninstall($module_name) {
$installer_class = "{$module_name}_installer";
if (method_exists($installer_class, "uninstall")) {
if (class_exists($installer_class) && method_exists($installer_class, "uninstall")) {
call_user_func(array($installer_class, "uninstall"));
}
@ -403,7 +420,7 @@ class module_Core {
continue;
}
$class = "{$module->name}_event";
if (method_exists($class, $function)) {
if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@ -411,7 +428,7 @@ class module_Core {
// Give the admin theme a chance to respond, if we're in admin mode.
if (theme::$is_admin) {
$class = theme::$admin_theme_name . "_event";
if (method_exists($class, $function)) {
if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@ -419,7 +436,7 @@ class module_Core {
// Give the site theme a chance to respond as well. It gets a chance even in admin mode, as
// long as the theme has an admin subdir.
$class = theme::$site_theme_name . "_event";
if (method_exists($class, $function)) {
if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@ -553,6 +570,9 @@ class module_Core {
$obsolete_modules = array("videos" => 4, "noffmpeg" => 1, "videodimensions" => 1,
"digibug" => 2);
// Before we check the active modules, deactivate any that are missing.
module::deactivate_missing_modules();
$modules_found = array();
foreach ($obsolete_modules as $module => $version) {
if (module::is_active($module) && (module::get_version($module) <= $version)) {

View File

@ -138,7 +138,8 @@ class movie_Core {
* Return the path to the ffmpeg binary if one exists and is executable, or null.
*/
static function find_ffmpeg() {
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) ||
!@is_executable($ffmpeg_path)) {
$ffmpeg_path = system::find_binary(
"ffmpeg", module::get_var("gallery", "graphics_toolkit_path"));
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);

View File

@ -47,6 +47,7 @@ class system_Core {
explode(":", module::get_var("gallery", "extra_binary_paths")));
foreach ($paths as $path) {
$path = rtrim($path, "/");
$candidate = "$path/$binary";
// @suppress errors below to avoid open_basedir issues
if (@file_exists($candidate)) {

View File

@ -25,7 +25,7 @@ class task_Core {
$tasks = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_task";
if (method_exists($class_name, "available_tasks")) {
if (class_exists($class_name) && method_exists($class_name, "available_tasks")) {
foreach (call_user_func(array($class_name, "available_tasks")) as $task) {
$tasks[$task->callback] = $task;
}

View File

@ -95,7 +95,7 @@ class Admin_View_Core extends Gallery_View {
$blocks = array();
foreach (module::active() as $module) {
$helper_class = "{$module->name}_theme";
if (method_exists($helper_class, $function)) {
if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));

View File

@ -81,7 +81,8 @@ class IdentityProvider_Core {
module::set_var("gallery", "identity_provider", $new_provider);
if (method_exists("{$new_provider}_installer", "initialize")) {
if (class_exists("{$new_provider}_installer") &&
method_exists("{$new_provider}_installer", "initialize")) {
call_user_func("{$new_provider}_installer::initialize");
}

View File

@ -1,45 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2013 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
final class Kohana extends Kohana_Core {
/**
* Wrapper function for Kohana::auto_load that provides compatibility with Zend Guard Loader's
* code obfuscation. Zend Guard is enabled by default on many PHP 5.3+ installations and can
* cause problems with Kohana 2.4. When a class is not found, Zend Guard Loader may continue to
* try and load the class, eventually leading to a seg fault.
*
* Instead, if we can't find the class and we can see that code obfuscation is at level 3+, let's
* load a dummy class. This does not change the return value, so Kohana still knows that
* there is no class.
*
* This is based on the patch described here: http://blog.teatime.com.tw/1/post/403
*/
public static function auto_load($class) {
$found = parent::auto_load($class);
if (!$found && function_exists("zend_current_obfuscation_level") &&
(zend_current_obfuscation_level() >= 3)) {
// Load a dummy class instead.
eval("class $class {}");
}
// Return the same result.
return $found;
}
}

View File

@ -153,7 +153,7 @@ class SafeString_Core {
* Purify the string, removing any potentially malicious or unsafe HTML / JavaScript.
*/
private static function _purify_for_html($dirty_html) {
if (method_exists("purifier", "purify")) {
if (class_exists("purifier") && method_exists("purifier", "purify")) {
return purifier::purify($dirty_html);
} else {
return self::_escape_for_html($dirty_html);

View File

@ -89,7 +89,7 @@ class Theme_View_Core extends Gallery_View {
public function siblings($limit=null, $offset=null) {
return call_user_func_array(
$this->siblings_callback[0],
array_merge($this->siblings_callback[1], array($offset, $limit)));
array_merge($this->siblings_callback[1], array($limit, $offset)));
}
public function tag() {
@ -239,7 +239,7 @@ class Theme_View_Core extends Gallery_View {
continue;
}
$helper_class = "{$module->name}_theme";
if (method_exists($helper_class, $function)) {
if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
@ -247,7 +247,7 @@ class Theme_View_Core extends Gallery_View {
}
$helper_class = theme::$site_theme_name . "_theme";
if (method_exists($helper_class, $function)) {
if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));

View File

@ -416,7 +416,7 @@ class Item_Model_Core extends ORM_MPTT {
module::event("item_created", $this);
} else {
// Update an existing item
module::event("item_before_update", $item);
module::event("item_before_update", $this);
// If any significant fields have changed, load up a copy of the original item and
// keep it around.
@ -769,6 +769,7 @@ class Item_Model_Core extends ORM_MPTT {
$movie_img->height = $height;
$movie_img->attrs = $attrs;
$movie_img->url = $this->file_url(true);
$movie_img->filename = $this->name;
$movie_img->fp_params = array(); // additional Flowplayer params values (will be json encoded)
$movie_img->fp_config = array(); // additional Flowplayer config values (will be json encoded)
$movie_img->view = array();
@ -781,7 +782,7 @@ class Item_Model_Core extends ORM_MPTT {
// View NOT generated - see if filetype supported by Flowplayer v3
// Note that the extension list below is hard-coded and doesn't use the legal_file helper
// since anything else will not work in Flowplayer v3.
if (in_array(strtolower(pathinfo($this->name, PATHINFO_EXTENSION)),
if (in_array(strtolower(pathinfo($movie_img->filename, PATHINFO_EXTENSION)),
array("flv", "mp4", "m4v", "mov", "f4v"))) {
// Filetype supported by Flowplayer v3 - use it (default)
$view = new View("movieplayer.html");

View File

@ -1,6 +1,6 @@
name = "Gallery 3"
description = "Gallery core application"
version = 56
version = 57
author_name = "Gallery Team"
author_url = "http://codex.galleryproject.org/Gallery:Team"
info_url = "http://codex.galleryproject.org/Gallery3:Modules:gallery"

View File

@ -21,7 +21,7 @@
<div class="g-available">
<h2> <?= t("Current configuration") ?> </h2>
<div id="g-ffmpeg" class="g-block">
<img class="logo" width="284" height="70" src="<?= url::file("modules/gallery/images/ffmpeg.png"); ?>" alt="<? t("Visit the FFmpeg project site") ?>" />
<img class="logo" width="284" height="70" src="<?= url::file("modules/gallery/images/ffmpeg.png") ?>" alt="<? t("Visit the FFmpeg project site") ?>" />
<p>
<?= t("FFmpeg is a cross-platform standalone audio/video program.") ?><br/>
<?= t("Please refer to the <a href=\"%url\">FFmpeg website</a> for more information.", array("url" => "http://ffmpeg.org")) ?>

View File

@ -98,7 +98,7 @@ class Rest_Controller extends Controller {
$handler_class = "{$function}_rest";
$handler_method = $request->method;
if (!method_exists($handler_class, $handler_method)) {
if (!class_exists($handler_class) || !method_exists($handler_class, $handler_method)) {
throw new Rest_Exception("Bad Request", 400);
}

View File

@ -141,7 +141,7 @@ class rest_Core {
}
$class = "$components[1]_rest";
if (!method_exists($class, "resolve")) {
if (!class_exists($class) || !method_exists($class, "resolve")) {
throw new Kohana_404_Exception($url);
}
@ -158,7 +158,7 @@ class rest_Core {
$resource_type = array_shift($args);
$class = "{$resource_type}_rest";
if (!method_exists($class, "url")) {
if (!class_exists($class) || !method_exists($class, "url")) {
throw new Rest_Exception("Bad Request", 400);
}
@ -178,7 +178,7 @@ class rest_Core {
foreach (module::active() as $module) {
foreach (glob(MODPATH . "{$module->name}/helpers/*_rest.php") as $filename) {
$class = str_replace(".php", "", basename($filename));
if (method_exists($class, "relationships")) {
if (class_exists($class) && method_exists($class, "relationships")) {
if ($tmp = call_user_func(array($class, "relationships"), $resource_type, $resource)) {
$results = array_merge($results, $tmp);
}

View File

@ -32,7 +32,7 @@ class Rss_Controller extends Controller {
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
if (method_exists($class_name, "feed")) {
if (class_exists($class_name) && method_exists($class_name, "feed")) {
$feed = call_user_func(
array($class_name, "feed"), $feed_id,
($page - 1) * $page_size, $page_size, $id);

View File

@ -29,7 +29,7 @@ class rss_block_Core {
$feeds = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_rss";
if (method_exists($class_name, "available_feeds")) {
if (class_exists($class_name) && method_exists($class_name, "available_feeds")) {
$feeds = array_merge($feeds,
call_user_func(array($class_name, "available_feeds"), $theme->item(), $theme->tag()));
}

View File

@ -42,8 +42,8 @@ class search_Core {
$db = Database::instance();
$query = self::_build_query_base($q, $album) .
"ORDER BY `score` DESC " .
"LIMIT $limit OFFSET " . (int)$offset;
" ORDER BY `score` DESC" .
" LIMIT $limit OFFSET " . (int)$offset;
$data = $db->query($query);
$count = $db->query("SELECT FOUND_ROWS() as c")->current()->c;
@ -68,7 +68,7 @@ class search_Core {
$album_sql = "";
} else {
$album_sql =
" AND {items}.left_ptr > " .$db->escape($album->left_ptr) .
" AND {items}.left_ptr > " . $db->escape($album->left_ptr) .
" AND {items}.right_ptr <= " . $db->escape($album->right_ptr);
}
@ -76,11 +76,10 @@ class search_Core {
"SELECT SQL_CALC_FOUND_ROWS {items}.*, " .
" MATCH({search_records}.`data`) AGAINST ('$q') AS `score` " .
"FROM {items} JOIN {search_records} ON ({items}.`id` = {search_records}.`item_id`) " .
"WHERE MATCH({search_records}.`data`) AGAINST ('$q' IN BOOLEAN MODE) " .
"WHERE MATCH({search_records}.`data`) AGAINST ('$q' IN BOOLEAN MODE)" .
$album_sql .
(empty($where) ? "" : " AND " . join(" AND ", $where)) .
$access_sql .
" ";
$access_sql;
}
/**
@ -133,7 +132,7 @@ class search_Core {
static function get_position_within_album($item, $q, $album) {
$page_size = module::get_var("gallery", "page_size", 9);
$query = self::_build_query_base($q, $album, array("{items}.id = " . $item->id)) .
"ORDER BY `score` DESC ";
" ORDER BY `score` DESC";
$db = Database::instance();
// Truncate the score by two decimal places as this resolves the issues
@ -153,7 +152,7 @@ class search_Core {
// Redo the query but only look for results greater than or equal to our current location
// then seek backwards until we find our item.
$data = $db->query(self::_build_query_base($q, $album) . " HAVING `score` >= " . $score .
"ORDER BY `score` DESC ");
" ORDER BY `score` DESC");
$data->seek($data->count() - 1);
while ($data->get("id") != $item->id && $data->prev()->valid()) {

View File

@ -62,7 +62,9 @@ class url_Core {
if ($site_domain === '' OR $site_domain[0] === '/')
{
// Guess the server name if the domain starts with slash
$base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?$_SERVER['SERVER_NAME']:$_SERVER['HTTP_HOST']).$site_domain;
$port = $_SERVER['SERVER_PORT'];
$port = ((($port == 80) && ($protocol == 'http')) || (($port == 443) && ($protocol == 'https')) || !$port) ? '' : ":$port";
$base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?($_SERVER['SERVER_NAME'].$port):$_SERVER['HTTP_HOST']).$site_domain;
}
else
{

View File

@ -470,6 +470,7 @@ td {
}
#g-content .g-photo h2,
#g-content .g-movie h2,
#g-content .g-item .g-metadata {
display: none;
margin-bottom: .6em;

View File

@ -49,48 +49,35 @@ $(document).ready(function() {
// Album and search results views
if ($("#g-album-grid").length) {
// Set equal height for album items and vertically align thumbnails/metadata
$('.g-item').equal_heights().gallery_valign();
$(".g-item").equal_heights().gallery_valign();
// Store the resulting item height. Storing this here for the whole grid as opposed to in the
// hover event as an attr for each item is more efficient and ensures IE6-8 compatibility.
var item_height = $(".g-item").height();
// Initialize thumbnail hover effect
$(".g-item").hover(
function() {
// Insert a placeholder to hold the item's position in the grid
var placeHolder = $(this).clone().attr("id", "g-place-holder");
$(this).after($(placeHolder));
var place_holder = $(this).clone().attr("id", "g-place-holder");
$(this).after($(place_holder));
// Style and position the hover item
var position = $(this).position();
$(this).css("top", position.top).css("left", position.left);
$(this).addClass("g-hover-item");
// Initialize the contextual menu
// Initialize the contextual menu. Note that putting it here delays execution until needed.
$(this).gallery_context_menu();
// Set the hover item's height
// Set the hover item's height. Use "li a" on the context menu so we get the height of the
// collapsed menu and avoid problems with incomplete slideUp/Down animations.
$(this).height("auto");
var context_menu = $(this).find(".g-context-menu");
var adj_height = $(this).height() + context_menu.height();
if ($(this).next().height() > $(this).height()) {
$(this).height($(this).next().height());
} else if ($(this).prev().height() > $(this).height()) {
$(this).height($(this).prev().height());
} else {
$(this).height(adj_height);
}
$(this).height(Math.max($(this).height(), item_height) +
$(this).find(".g-context-menu li a").height());
},
function() {
// Reset item height and position
if ($(this).next().height()) {
var sib_height = $(this).next().height();
} else {
var sib_height = $(this).prev().height();
}
if ($.browser.msie && $.browser.version <= 8) {
sib_height = sib_height + 1;
}
$(this).css("height", sib_height);
$(this).css("position", "relative");
$(this).css("top", 0).css("left", 0);
$(this).height(item_height);
$(this).css("top", "").css("left", "");
// Remove the placeholder and hover class from the item
$(this).removeClass("g-hover-item");
$(this).gallery_valign();
$("#g-place-holder").remove();
}
);
@ -98,7 +85,7 @@ $(document).ready(function() {
// Realign any thumbnails that change so that when we rotate a thumb it stays centered.
$(".g-item").bind("gallery.change", function() {
$(".g-item").each(function() {
$(this).height($(this).find("img").height() + 2);
$(this).height($(this).find("img").height() + 2);
});
$(".g-item").equal_heights().gallery_valign();
});