NextGEN Gallery – WordPress Gallery Plugin - Version 1.3.2

Version Description

Download this release

Release Info

Developer alexrabe
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

admin/addgallery.php CHANGED
@@ -46,9 +46,8 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
46
 
47
  if ($_POST['uploadimage']){
48
  check_admin_referer('ngg_addgallery');
49
- if ($_FILES['MF__F_0_0']['error'] == 0) {
50
  $messagetext = nggAdmin::upload_images();
51
- }
52
  else
53
  nggGallery::show_error( __('Upload failed!','nggallery') );
54
  }
@@ -152,7 +151,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
152
  jQuery(document).ready(function(){
153
  jQuery('#imagefiles').MultiFile({
154
  STRING: {
155
- remove:'<?php _e('remove', 'nggallery') ;?>'
156
  }
157
  });
158
  });
@@ -266,7 +265,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
266
  <table class="form-table">
267
  <tr valign="top">
268
  <th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
269
- <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles" id="imagefiles" size="35" class="imagefiles"/></td>
270
  </tr>
271
  <tr valign="top">
272
  <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
46
 
47
  if ($_POST['uploadimage']){
48
  check_admin_referer('ngg_addgallery');
49
+ if ( $_FILES['imagefiles']['error'][0] == 0 )
50
  $messagetext = nggAdmin::upload_images();
 
51
  else
52
  nggGallery::show_error( __('Upload failed!','nggallery') );
53
  }
151
  jQuery(document).ready(function(){
152
  jQuery('#imagefiles').MultiFile({
153
  STRING: {
154
+ remove:'[<?php _e('remove', 'nggallery') ;?>]'
155
  }
156
  });
157
  });
265
  <table class="form-table">
266
  <tr valign="top">
267
  <th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
268
+ <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
269
  </tr>
270
  <tr valign="top">
271
  <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
admin/functions.php CHANGED
@@ -691,54 +691,59 @@ class nggAdmin{
691
  // read list of images
692
  $dirlist = nggAdmin::scandir(WINABSPATH.$gallerypath);
693
 
694
- foreach ($_FILES as $key => $value) {
695
-
696
- // look only for uploded files
697
- if ($_FILES[$key]['error'] == 0) {
698
- $temp_file = $_FILES[$key]['tmp_name'];
699
- $filepart = pathinfo ( strtolower($_FILES[$key]['name']) );
700
- // required until PHP 5.2.0
701
- $filepart['filename'] = substr($filepart["basename"],0 ,strlen($filepart["basename"]) - (strlen($filepart["extension"]) + 1) );
702
-
703
- $filename = sanitize_title($filepart['filename']) . '.' . $filepart['extension'];
704
-
705
- // check for allowed extension and if it's an image file
706
- $ext = array('jpeg', 'jpg', 'png', 'gif');
707
- if ( !in_array($filepart['extension'], $ext) || !@getimagesize($temp_file) ){
708
- nggGallery::show_error('<strong>'.$_FILES[$key]['name'].' </strong>'.__('is no valid image file!','nggallery'));
709
- continue;
710
- }
711
-
712
- // check if this filename already exist in the folder
713
- $i = 0;
714
- while (in_array($filename,$dirlist)) {
715
- $filename = sanitize_title($filepart['filename']) . '_' . $i++ . '.' .$filepart['extension'];
716
- }
717
-
718
- $dest_file = WINABSPATH . $gallerypath . '/' . $filename;
719
-
720
- //check for folder permission
721
- if (!is_writeable(WINABSPATH.$gallerypath)) {
722
- $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), WINABSPATH.$gallerypath);
723
- nggGallery::show_error($message);
724
- return;
725
- }
726
-
727
- // save temp file to gallery
728
- if (!@move_uploaded_file($_FILES[$key]['tmp_name'], $dest_file)){
729
- nggGallery::show_error(__('Error, the file could not moved to : ','nggallery').$dest_file);
730
- nggAdmin::check_safemode(WINABSPATH.$gallerypath);
731
- continue;
732
- }
733
- if (!nggAdmin::chmod ($dest_file)) {
734
- nggGallery::show_error(__('Error, the file permissions could not set','nggallery'));
735
- continue;
 
 
 
 
 
 
 
 
 
 
736
  }
737
-
738
- // add to imagelist & dirlist
739
- $imageslist[] = $filename;
740
- $dirlist[] = $filename;
741
-
742
  }
743
  }
744
 
691
  // read list of images
692
  $dirlist = nggAdmin::scandir(WINABSPATH.$gallerypath);
693
 
694
+ $imagefiles = $_FILES['imagefiles'];
695
+
696
+ if (is_array($imagefiles)) {
697
+ foreach ($imagefiles['name'] as $key => $value) {
698
+
699
+ // look only for uploded files
700
+ if ($imagefiles['error'][$key] == 0) {
701
+
702
+ $temp_file = $imagefiles['tmp_name'][$key];
703
+ $filepart = pathinfo ( strtolower($imagefiles['name'][$key]) );
704
+ // required until PHP 5.2.0
705
+ $filepart['filename'] = substr($filepart["basename"],0 ,strlen($filepart["basename"]) - (strlen($filepart["extension"]) + 1) );
706
+
707
+ $filename = sanitize_title($filepart['filename']) . '.' . $filepart['extension'];
708
+
709
+ // check for allowed extension and if it's an image file
710
+ $ext = array('jpeg', 'jpg', 'png', 'gif');
711
+ if ( !in_array($filepart['extension'], $ext) || !@getimagesize($temp_file) ){
712
+ nggGallery::show_error('<strong>' . $imagefiles['name'][$key] . ' </strong>'.__('is no valid image file!','nggallery'));
713
+ continue;
714
+ }
715
+
716
+ // check if this filename already exist in the folder
717
+ $i = 0;
718
+ while (in_array($filename,$dirlist)) {
719
+ $filename = sanitize_title($filepart['filename']) . '_' . $i++ . '.' .$filepart['extension'];
720
+ }
721
+
722
+ $dest_file = WINABSPATH . $gallerypath . '/' . $filename;
723
+
724
+ //check for folder permission
725
+ if (!is_writeable(WINABSPATH.$gallerypath)) {
726
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), WINABSPATH.$gallerypath);
727
+ nggGallery::show_error($message);
728
+ return;
729
+ }
730
+
731
+ // save temp file to gallery
732
+ if (!@move_uploaded_file($temp_file, $dest_file)){
733
+ nggGallery::show_error(__('Error, the file could not moved to : ','nggallery') . $dest_file);
734
+ nggAdmin::check_safemode(WINABSPATH.$gallerypath);
735
+ continue;
736
+ }
737
+ if (!nggAdmin::chmod ($dest_file)) {
738
+ nggGallery::show_error(__('Error, the file permissions could not set','nggallery'));
739
+ continue;
740
+ }
741
+
742
+ // add to imagelist & dirlist
743
+ $imageslist[] = $filename;
744
+ $dirlist[] = $filename;
745
+
746
  }
 
 
 
 
 
747
  }
748
  }
749
 
admin/js/jquery.MultiFile.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- ### jQuery Multiple File Upload Plugin v1.44 - 2009-04-08 ###
3
  * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
  * Code: http://code.google.com/p/jquery-multifile-plugin/
5
  *
@@ -104,7 +104,7 @@
104
  //===
105
 
106
  // APPLY CONFIGURATION
107
- $.extend(MultiFile, o || {});
108
  MultiFile.STRING = $.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);
109
 
110
  //===
@@ -131,6 +131,7 @@
131
  // Setup dynamic regular expression for extension validation
132
  // - thanks to John-Paul Bader: http://smyck.de/2006/08/11/javascript-dynamic-regular-expresions/
133
  if(String(MultiFile.accept).length>1){
 
134
  MultiFile.rxAccept = new RegExp('\\.('+(MultiFile.accept?MultiFile.accept:'')+')$','gi');
135
  };
136
 
@@ -392,41 +393,42 @@
392
  * @example $.fn.MultiFile.disableEmpty();
393
  * @param String class (optional) A string specifying a class to be applied to all affected elements - Default: 'mfD'.
394
  */
395
- disableEmpty: function(klass){ klass = String(klass || 'mfD');
396
  var o = [];
397
- $('input:file').each(function(){ if($(this).val()=='') o[o.length] = this; });
398
  return $(o).each(function(){ this.disabled = true }).addClass(klass);
399
  },
400
 
401
 
402
- /**
403
- * This method re-enables 'empty' file elements that were disabled (and marked) with the $.fn.MultiFile.disableEmpty method.
404
- *
405
- * Returns a jQuery collection of all affected elements.
406
- *
407
- * @name reEnableEmpty
408
- * @type jQuery
409
- * @cat Plugins/MultiFile
410
- * @author Diego A. (http://www.fyneworks.com/)
411
- *
412
- * @example $.fn.MultiFile.reEnableEmpty();
413
- * @param String klass (optional) A string specifying the class that was used to mark affected elements - Default: 'mfD'.
414
- */
415
- reEnableEmpty: function(klass){ klass = String(klass || 'mfD');
416
  return $('input:file.'+klass).removeClass(klass).each(function(){ this.disabled = false });
417
  },
418
 
419
 
420
- /**
421
- * This method will intercept other jQuery plugins and disable empty file input elements prior to form submission
422
- *
423
- * @name intercept
424
- * @cat Plugins/MultiFile
425
- * @author Diego A. (http://www.fyneworks.com/)
426
- *
427
- * @example $.fn.MultiFile.intercept();
428
- * @param Array methods (optional) Array of method names to be intercepted
429
- */
 
430
  intercepted: {},
431
  intercept: function(methods, context, args){
432
  var method, value; args = args || [];
@@ -434,7 +436,8 @@
434
  if(typeof(methods)=='function'){
435
  $.fn.MultiFile.disableEmpty();
436
  value = methods.apply(context || window, args);
437
- $.fn.MultiFile.reEnableEmpty();
 
438
  return value;
439
  };
440
  if(methods.constructor.toString().indexOf("Array")<0) methods = [methods];
@@ -445,7 +448,8 @@
445
  $.fn[method] = function(){
446
  $.fn.MultiFile.disableEmpty();
447
  value = $.fn.MultiFile.intercepted[method].apply(this, arguments);
448
- $.fn.MultiFile.reEnableEmpty();
 
449
  return value;
450
  }; // interception
451
  })(method); // MAKE SURE THAT method IS ISOLATED for the interception
@@ -478,7 +482,7 @@
478
 
479
  // name of methods that should be automcatically intercepted so the plugin can disable
480
  // extra file elements that are empty before execution and automatically re-enable them afterwards
481
- autoIntercept: [ 'submit', 'ajaxSubmit', 'validate' /* array of methods to intercept */ ],
482
 
483
  // error handling function
484
  error: function(s){
1
  /*
2
+ ### jQuery Multiple File Upload Plugin v1.46 - 2009-05-12 ###
3
  * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
  * Code: http://code.google.com/p/jquery-multifile-plugin/
5
  *
104
  //===
105
 
106
  // APPLY CONFIGURATION
107
+ $.extend(MultiFile, o || {});
108
  MultiFile.STRING = $.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);
109
 
110
  //===
131
  // Setup dynamic regular expression for extension validation
132
  // - thanks to John-Paul Bader: http://smyck.de/2006/08/11/javascript-dynamic-regular-expresions/
133
  if(String(MultiFile.accept).length>1){
134
+ MultiFile.accept = MultiFile.accept.replace(/\W+/g,'|').replace(/^\W|\W$/g,'');
135
  MultiFile.rxAccept = new RegExp('\\.('+(MultiFile.accept?MultiFile.accept:'')+')$','gi');
136
  };
137
 
393
  * @example $.fn.MultiFile.disableEmpty();
394
  * @param String class (optional) A string specifying a class to be applied to all affected elements - Default: 'mfD'.
395
  */
396
+ disableEmpty: function(klass){ klass = (typeof(klass)=='string'?klass:'')||'mfD';
397
  var o = [];
398
+ $('input:file.MultiFile').each(function(){ if($(this).val()=='') o[o.length] = this; });
399
  return $(o).each(function(){ this.disabled = true }).addClass(klass);
400
  },
401
 
402
 
403
+ /**
404
+ * This method re-enables 'empty' file elements that were disabled (and marked) with the $.fn.MultiFile.disableEmpty method.
405
+ *
406
+ * Returns a jQuery collection of all affected elements.
407
+ *
408
+ * @name reEnableEmpty
409
+ * @type jQuery
410
+ * @cat Plugins/MultiFile
411
+ * @author Diego A. (http://www.fyneworks.com/)
412
+ *
413
+ * @example $.fn.MultiFile.reEnableEmpty();
414
+ * @param String klass (optional) A string specifying the class that was used to mark affected elements - Default: 'mfD'.
415
+ */
416
+ reEnableEmpty: function(klass){ klass = (typeof(klass)=='string'?klass:'')||'mfD';
417
  return $('input:file.'+klass).removeClass(klass).each(function(){ this.disabled = false });
418
  },
419
 
420
 
421
+ /**
422
+ * This method will intercept other jQuery plugins and disable empty file input elements prior to form submission
423
+ *
424
+
425
+ * @name intercept
426
+ * @cat Plugins/MultiFile
427
+ * @author Diego A. (http://www.fyneworks.com/)
428
+ *
429
+ * @example $.fn.MultiFile.intercept();
430
+ * @param Array methods (optional) Array of method names to be intercepted
431
+ */
432
  intercepted: {},
433
  intercept: function(methods, context, args){
434
  var method, value; args = args || [];
436
  if(typeof(methods)=='function'){
437
  $.fn.MultiFile.disableEmpty();
438
  value = methods.apply(context || window, args);
439
+ //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27
440
+ setTimeout(function(){ $.fn.MultiFile.reEnableEmpty() },1000);
441
  return value;
442
  };
443
  if(methods.constructor.toString().indexOf("Array")<0) methods = [methods];
448
  $.fn[method] = function(){
449
  $.fn.MultiFile.disableEmpty();
450
  value = $.fn.MultiFile.intercepted[method].apply(this, arguments);
451
+ //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27
452
+ setTimeout(function(){ $.fn.MultiFile.reEnableEmpty() },1000);
453
  return value;
454
  }; // interception
455
  })(method); // MAKE SURE THAT method IS ISOLATED for the interception
482
 
483
  // name of methods that should be automcatically intercepted so the plugin can disable
484
  // extra file elements that are empty before execution and automatically re-enable them afterwards
485
+ autoIntercept: [ 'submit', 'ajaxSubmit', 'ajaxForm', 'validate' /* array of methods to intercept */ ],
486
 
487
  // error handling function
488
  error: function(s){
admin/js/jquery.MultiFile.pack.js CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- ### jQuery Multiple File Upload Plugin v1.44 - 2009-04-08 ###
3
  * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
  * Code: http://code.google.com/p/jquery-multifile-plugin/
5
  *
@@ -8,4 +8,4 @@
8
  * http://www.gnu.org/licenses/gpl.html
9
  ###
10
  */
11
- eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(Q.1w)(6($){$.7.2=6(h){3(5.U==0)8 5;3(18 T[0]==\'1J\'){3(5.U>1){l i=T;8 5.L(6(){$.7.2.10($(5),i)})};$.7.2[T[0]].10(5,$.28(T).1Z(1)||[]);8 5};l h=$.O({},$.7.2.I,h||{});$(\'1X\').1l(\'2-R\').S(\'2-R\').1k($.7.2.12);3($.7.2.I.13){$.7.2.1i($.7.2.I.13);$.7.2.I.13=W};5.1l(\'.2-16\').S(\'2-16\').L(6(){Q.2=(Q.2||0)+1;l e=Q.2;l g={e:5,E:$(5),N:$(5).N()};3(18 h==\'26\')h={k:h};l o=$.O({},$.7.2.I,h||{},($.1D?g.E.1D():($.1Q?g.E.Y():W))||{},{});3(!(o.k>0)){o.k=g.E.H(\'1N\');3(!(o.k>0)){o.k=(q(g.e.1I.B(/\\b(k|1S)\\-([0-9]+)\\b/t)||[\'\']).B(/[0-9]+/t)||[\'\'])[0];3(!(o.k>0))o.k=-1;2o o.k=q(o.k).B(/[0-9]+/t)[0]}};o.k=1e 25(o.k);o.p=o.p||g.E.H(\'p\')||\'\';3(!o.p){o.p=(g.e.1I.B(/\\b(p\\-[\\w\\|]+)\\b/t))||\'\';o.p=1e q(o.p).y(/^(p|1b)\\-/i,\'\')};$.O(g,o||{});g.A=$.O({},$.7.2.I.A,g.A);$.O(g,{n:0,J:[],2a:[],1f:g.e.K||\'2\'+q(e),1g:6(z){8 g.1f+(z>0?\'1L\'+q(z):\'\')},F:6(a,b){l c=g[a],j=$(b).H(\'j\');3(c){l d=c(b,j,g);3(d!=W)8 d}8 1d}});3(q(g.p).U>1){g.1m=1e 2b(\'\\\\.(\'+(g.p?g.p:\'\')+\')$\',\'t\')};g.P=g.1f+\'1K\';g.E.1z(\'<M V="2-1z" K="\'+g.P+\'"></M>\');g.1C=$(\'#\'+g.P+\'\');g.e.D=g.e.D||\'m\'+e+\'[]\';3(!g.G){g.1C.1c(\'<M V="2-G" K="\'+g.P+\'1h"></M>\');g.G=$(\'#\'+g.P+\'1h\')};g.G=$(g.G);g.11=6(c,d){g.n++;c.2=g;3(d>0)c.K=c.D=\'\';3(d>0)c.K=g.1g(d);c.D=q(g.1j.y(/\\$D/t,$(g.N).H(\'D\')).y(/\\$K/t,$(g.N).H(\'K\')).y(/\\$g/t,e).y(/\\$i/t,d));3((g.k>0)&&((g.n-1)>(g.k)))c.Z=1d;g.X=g.J[d]=c;c=$(c);c.17(\'\').H(\'j\',\'\')[0].j=\'\';c.S(\'2-16\');c.1T(6(){$(5).1V();3(!g.F(\'1W\',5,g))8 u;l a=\'\',v=q(5.j||\'\');3(g.p&&v&&!v.B(g.1m))a=g.A.1n.y(\'$1b\',q(v.B(/\\.\\w{1,4}$/t)));1o(l f 29 g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].j==v)a=g.A.1p.y(\'$m\',v.B(/[^\\/\\\\]+$/t));l b=$(g.N).N();b.S(\'2\');3(a!=\'\'){g.1q(a);g.n--;g.11(b[0],d);c.1r().2t(b);c.C();8 u};$(5).1s({1t:\'1M\',1u:\'-1O\'});c.1P(b);g.1v(5,d);g.11(b[0],d+1);3(!g.F(\'1R\',5,g))8 u});$(c).Y(\'2\',g)};g.1v=6(c,d){3(!g.F(\'2u\',c,g))8 u;l r=$(\'<M V="2-1U"></M>\'),v=q(c.j||\'\'),a=$(\'<1x V="2-1y" 1y="\'+g.A.14.y(\'$m\',v)+\'">\'+g.A.m.y(\'$m\',v.B(/[^\\/\\\\]+$/t)[0])+\'</1x>\'),b=$(\'<a V="2-C" 1Y="#\'+g.P+\'">\'+g.A.C+\'</a>\');g.G.1c(r.1c(b,\' \',a));b.1A(6(){3(!g.F(\'20\',c,g))8 u;g.n--;g.X.Z=u;g.J[d]=W;$(c).C();$(5).1r().C();$(g.X).1s({1t:\'\',1u:\'\'});$(g.X).15().17(\'\').H(\'j\',\'\')[0].j=\'\';3(!g.F(\'22\',c,g))8 u;8 u});3(!g.F(\'23\',c,g))8 u};3(!g.2)g.11(g.e,0);g.n++;g.E.Y(\'2\',g)})};$.O($.7.2,{15:6(){l a=$(5).Y(\'2\');3(a)a.G.24(\'a.2-C\').1A();8 $(5)},12:6(a){a=q(a||\'1B\');l o=[];$(\'1a:m\').L(6(){3($(5).17()==\'\')o[o.U]=5});8 $(o).L(6(){5.Z=1d}).S(a)},19:6(a){a=q(a||\'1B\');8 $(\'1a:m.\'+a).27(a).L(6(){5.Z=u})},R:{},1i:6(b,c,d){l e,j;d=d||[];3(d.1E.1F().1G("1H")<0)d=[d];3(18(b)==\'6\'){$.7.2.12();j=b.10(c||Q,d);$.7.2.19();8 j};3(b.1E.1F().1G("1H")<0)b=[b];1o(l i=0;i<b.U;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.R[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.12();j=$.7.2.R[a].10(5,T);$.7.2.19();8 j}})(e)}}});$.7.2.I={p:\'\',k:-1,1j:\'$D\',A:{C:\'x\',1n:\'2c 2d 2e a $1b m.\\2f 2g...\',m:\'$m\',14:\'2h 14: $m\',1p:\'2i m 2j 2k 2l 14:\\n$m\'},13:[\'1k\',\'2m\',\'2n\'],1q:6(s){2p(s)}};$.7.15=6(){8 5.L(6(){2q{5.15()}2r(e){}})};$(6(){$("1a[2s=m].21").2()})})(1w);',62,155,'||MultiFile|if||this|function|fn|return|||||||||||value|max|var|file|||accept|String|||gi|false||||replace||STRING|match|remove|name||trigger|list|attr|options|slaves|id|each|div|clone|extend|wrapID|window|intercepted|addClass|arguments|length|class|null|current|data|disabled|apply|addSlave|disableEmpty|autoIntercept|selected|reset|applied|val|typeof|reEnableEmpty|input|ext|append|true|new|instanceKey|generateID|_list|intercept|namePattern|submit|not|rxAccept|denied|for|duplicate|error|parent|css|position|top|addToList|jQuery|span|title|wrap|click|mfD|wrapper|metadata|constructor|toString|indexOf|Array|className|string|_wrap|_F|absolute|maxlength|3000px|after|meta|afterFileSelect|limit|change|label|blur|onFileSelect|form|href|slice|onFileRemove|multi|afterFileRemove|afterFileAppend|find|Number|number|removeClass|makeArray|in|files|RegExp|You|cannot|select|nTry|again|File|This|has|already|been|ajaxSubmit|validate|else|alert|try|catch|type|prepend|onFileAppend'.split('|'),0,{}))
1
  /*
2
+ ### jQuery Multiple File Upload Plugin v1.46 - 2009-05-12 ###
3
  * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
  * Code: http://code.google.com/p/jquery-multifile-plugin/
5
  *
8
  * http://www.gnu.org/licenses/gpl.html
9
  ###
10
  */
11
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(U.1u)(6($){$.7.2=6(h){3(5.V==0)8 5;3(T S[0]==\'19\'){3(5.V>1){m i=S;8 5.M(6(){$.7.2.13($(5),i)})};$.7.2[S[0]].13(5,$.1N(S).27(1)||[]);8 5};m h=$.N({},$.7.2.F,h||{});$(\'2d\').1B(\'2-R\').Q(\'2-R\').1n($.7.2.Z);3($.7.2.F.15){$.7.2.1M($.7.2.F.15);$.7.2.F.15=10};5.1B(\'.2-1e\').Q(\'2-1e\').M(6(){U.2=(U.2||0)+1;m e=U.2;m g={e:5,E:$(5),L:$(5).L()};3(T h==\'21\')h={l:h};m o=$.N({},$.7.2.F,h||{},($.1m?g.E.1m():($.1S?g.E.17():10))||{},{});3(!(o.l>0)){o.l=g.E.D(\'28\');3(!(o.l>0)){o.l=(u(g.e.1D.B(/\\b(l|23)\\-([0-9]+)\\b/q)||[\'\']).B(/[0-9]+/q)||[\'\'])[0];3(!(o.l>0))o.l=-1;2b o.l=u(o.l).B(/[0-9]+/q)[0]}};o.l=18 2f(o.l);o.j=o.j||g.E.D(\'j\')||\'\';3(!o.j){o.j=(g.e.1D.B(/\\b(j\\-[\\w\\|]+)\\b/q))||\'\';o.j=18 u(o.j).t(/^(j|1d)\\-/i,\'\')};$.N(g,o||{});g.A=$.N({},$.7.2.F.A,g.A);$.N(g,{n:0,J:[],2c:[],1c:g.e.I||\'2\'+u(e),1i:6(z){8 g.1c+(z>0?\'1Z\'+u(z):\'\')},G:6(a,b){m c=g[a],k=$(b).D(\'k\');3(c){m d=c(b,k,g);3(d!=10)8 d}8 1a}});3(u(g.j).V>1){g.j=g.j.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');g.1k=18 2t(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'q\')};g.O=g.1c+\'1P\';g.E.1l(\'<P X="2-1l" I="\'+g.O+\'"></P>\');g.1q=$(\'#\'+g.O+\'\');g.e.H=g.e.H||\'p\'+e+\'[]\';3(!g.K){g.1q.1g(\'<P X="2-K" I="\'+g.O+\'1F"></P>\');g.K=$(\'#\'+g.O+\'1F\')};g.K=$(g.K);g.16=6(c,d){g.n++;c.2=g;3(d>0)c.I=c.H=\'\';3(d>0)c.I=g.1i(d);c.H=u(g.1j.t(/\\$H/q,$(g.L).D(\'H\')).t(/\\$I/q,$(g.L).D(\'I\')).t(/\\$g/q,e).t(/\\$i/q,d));3((g.l>0)&&((g.n-1)>(g.l)))c.14=1a;g.Y=g.J[d]=c;c=$(c);c.1b(\'\').D(\'k\',\'\')[0].k=\'\';c.Q(\'2-1e\');c.1V(6(){$(5).1X();3(!g.G(\'1Y\',5,g))8 y;m a=\'\',v=u(5.k||\'\');3(g.j&&v&&!v.B(g.1k))a=g.A.1o.t(\'$1d\',u(v.B(/\\.\\w{1,4}$/q)));1p(m f 2a g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].k==v)a=g.A.1r.t(\'$p\',v.B(/[^\\/\\\\]+$/q));m b=$(g.L).L();b.Q(\'2\');3(a!=\'\'){g.1s(a);g.n--;g.16(b[0],d);c.1t().2e(b);c.C();8 y};$(5).1v({1w:\'1O\',1x:\'-1Q\'});c.1R(b);g.1y(5,d);g.16(b[0],d+1);3(!g.G(\'1T\',5,g))8 y});$(c).17(\'2\',g)};g.1y=6(c,d){3(!g.G(\'1U\',c,g))8 y;m r=$(\'<P X="2-1W"></P>\'),v=u(c.k||\'\'),a=$(\'<1z X="2-1A" 1A="\'+g.A.12.t(\'$p\',v)+\'">\'+g.A.p.t(\'$p\',v.B(/[^\\/\\\\]+$/q)[0])+\'</1z>\'),b=$(\'<a X="2-C" 2y="#\'+g.O+\'">\'+g.A.C+\'</a>\');g.K.1g(r.1g(b,\' \',a));b.1C(6(){3(!g.G(\'22\',c,g))8 y;g.n--;g.Y.14=y;g.J[d]=10;$(c).C();$(5).1t().C();$(g.Y).1v({1w:\'\',1x:\'\'});$(g.Y).11().1b(\'\').D(\'k\',\'\')[0].k=\'\';3(!g.G(\'24\',c,g))8 y;8 y});3(!g.G(\'25\',c,g))8 y};3(!g.2)g.16(g.e,0);g.n++;g.E.17(\'2\',g)})};$.N($.7.2,{11:6(){m a=$(5).17(\'2\');3(a)a.K.26(\'a.2-C\').1C();8 $(5)},Z:6(a){a=(T(a)==\'19\'?a:\'\')||\'1E\';m o=[];$(\'1h:p.2\').M(6(){3($(5).1b()==\'\')o[o.V]=5});8 $(o).M(6(){5.14=1a}).Q(a)},1f:6(a){a=(T(a)==\'19\'?a:\'\')||\'1E\';8 $(\'1h:p.\'+a).29(a).M(6(){5.14=y})},R:{},1M:6(b,c,d){m e,k;d=d||[];3(d.1G.1H().1I("1J")<0)d=[d];3(T(b)==\'6\'){$.7.2.Z();k=b.13(c||U,d);1K(6(){$.7.2.1f()},1L);8 k};3(b.1G.1H().1I("1J")<0)b=[b];1p(m i=0;i<b.V;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.R[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.Z();k=$.7.2.R[a].13(5,S);1K(6(){$.7.2.1f()},1L);8 k}})(e)}}});$.7.2.F={j:\'\',l:-1,1j:\'$H\',A:{C:\'x\',1o:\'2g 2h 2i a $1d p.\\2j 2k...\',p:\'$p\',12:\'2l 12: $p\',1r:\'2m p 2n 2o 2p 12:\\n$p\'},15:[\'1n\',\'2q\',\'2r\',\'2s\'],1s:6(s){2u(s)}};$.7.11=6(){8 5.M(6(){2v{5.11()}2w(e){}})};$(6(){$("1h[2x=p].20").2()})})(1u);',62,159,'||MultiFile|if||this|function|fn|return|||||||||||accept|value|max|var|||file|gi|||replace|String||||false||STRING|match|remove|attr||options|trigger|name|id|slaves|list|clone|each|extend|wrapID|div|addClass|intercepted|arguments|typeof|window|length||class|current|disableEmpty|null|reset|selected|apply|disabled|autoIntercept|addSlave|data|new|string|true|val|instanceKey|ext|applied|reEnableEmpty|append|input|generateID|namePattern|rxAccept|wrap|metadata|submit|denied|for|wrapper|duplicate|error|parent|jQuery|css|position|top|addToList|span|title|not|click|className|mfD|_list|constructor|toString|indexOf|Array|setTimeout|1000|intercept|makeArray|absolute|_wrap|3000px|after|meta|afterFileSelect|onFileAppend|change|label|blur|onFileSelect|_F|multi|number|onFileRemove|limit|afterFileRemove|afterFileAppend|find|slice|maxlength|removeClass|in|else|files|form|prepend|Number|You|cannot|select|nTry|again|File|This|has|already|been|ajaxSubmit|ajaxForm|validate|RegExp|alert|try|catch|type|href'.split('|'),0,{}))
admin/js/sorter.js CHANGED
@@ -239,7 +239,7 @@
239
  serial = serial + "sortArray[]=" + objects[no].id;
240
  }
241
  }
242
- jQuery('input[@name=sortorder]').val(serial);
243
  // debug( 'This is the new order of the images(IDs) : <br>' + orderString );
244
 
245
  }
239
  serial = serial + "sortArray[]=" + objects[no].id;
240
  }
241
  }
242
+ jQuery('input[name=sortorder]').val(serial);
243
  // debug( 'This is the new order of the images(IDs) : <br>' + orderString );
244
 
245
  }
admin/manage-galleries.php CHANGED
@@ -7,6 +7,9 @@ function nggallery_manage_gallery_main() {
7
 
8
  global $wpdb, $ngg, $nggdb, $wp_query;
9
 
 
 
 
10
  if (isset ($_POST['addgallery']) && isset ($_POST['galleryname'])){
11
  check_admin_referer('ngg_addgallery');
12
  $newgallery = attribute_escape( $_POST['galleryname']);
@@ -28,8 +31,7 @@ function nggallery_manage_gallery_main() {
28
  'total' => $nggdb->paged['max_objects_per_page'],
29
  'current' => $_GET['paged']
30
  ));
31
-
32
- $defaultpath = $ngg->options['gallerypath'];
33
  ?>
34
  <script type="text/javascript">
35
  <!--
7
 
8
  global $wpdb, $ngg, $nggdb, $wp_query;
9
 
10
+ // get the default path for a new gallery
11
+ $defaultpath = $ngg->options['gallerypath'];
12
+
13
  if (isset ($_POST['addgallery']) && isset ($_POST['galleryname'])){
14
  check_admin_referer('ngg_addgallery');
15
  $newgallery = attribute_escape( $_POST['galleryname']);
31
  'total' => $nggdb->paged['max_objects_per_page'],
32
  'current' => $_GET['paged']
33
  ));
34
+
 
35
  ?>
36
  <script type="text/javascript">
37
  <!--
admin/manage-sort.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  /**
4
  * @author Alex Rabe
5
- * @copyright 2008
6
  */
7
 
8
  function nggallery_sortorder($galleryID = 0){
9
- global $wpdb, $ngg;
10
 
11
  if ($galleryID == 0) return;
12
 
@@ -31,27 +31,19 @@ function nggallery_sortorder($galleryID = 0){
31
  }
32
  }
33
 
34
- //TODO:A unique gallery call must provide me with this information, like $gallery = new nggGallery($id);
35
-
36
- // get gallery values
37
- $act_gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
38
-
39
- // set gallery url
40
- $act_gallery_url = get_option ('siteurl')."/".$act_gallery->path."/";
41
- $act_thumbnail_url = get_option ('siteurl')."/".$act_gallery->path.nggGallery::get_thumbnail_folder($act_gallery->path, FALSE);
42
-
43
  // look for presort args
44
  $presort = $_GET['presort'];
45
  $dir = ( $_GET['dir'] == 'DESC' ) ? 'DESC' : 'ASC';
46
  $sortitems = array('pid', 'filename', 'alttext', 'imagedate');
47
  // ensure that nobody added some evil sorting :-)
48
  if (in_array( $presort, $sortitems) )
49
- $picturelist = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' ORDER BY {$presort} {$dir}");
50
  else
51
- $picturelist = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' ORDER BY sortorder {$dir}");
52
-
53
  //this is the url without any presort variable
54
  $clean_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
 
55
  // In the case somebody presort, then we take this url
56
  if ( isset($_GET['dir']) || isset($_GET['presort']) )
57
  $base_url = $_SERVER['REQUEST_URI'];
@@ -90,7 +82,7 @@ function nggallery_sortorder($galleryID = 0){
90
  foreach($picturelist as $picture) {
91
  ?>
92
  <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
93
- <div class="imageBox_theImage" style="background-image:url('<?php echo $act_thumbnail_url ."thumbs_" .$picture->filename ?>')"></div>
94
  <div class="imageBox_label"><span><?php echo stripslashes($picture->alttext) ?></span></div>
95
  </div>
96
  <?php
2
 
3
  /**
4
  * @author Alex Rabe
5
+ * @copyright 2008-2009
6
  */
7
 
8
  function nggallery_sortorder($galleryID = 0){
9
+ global $wpdb, $ngg, $nggdb;
10
 
11
  if ($galleryID == 0) return;
12
 
31
  }
32
  }
33
 
 
 
 
 
 
 
 
 
 
34
  // look for presort args
35
  $presort = $_GET['presort'];
36
  $dir = ( $_GET['dir'] == 'DESC' ) ? 'DESC' : 'ASC';
37
  $sortitems = array('pid', 'filename', 'alttext', 'imagedate');
38
  // ensure that nobody added some evil sorting :-)
39
  if (in_array( $presort, $sortitems) )
40
+ $picturelist = $nggdb->get_gallery($galleryID, $presort, $dir, false);
41
  else
42
+ $picturelist = $nggdb->get_gallery($galleryID, 'sortorder', $dir, false);
43
+
44
  //this is the url without any presort variable
45
  $clean_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
46
+
47
  // In the case somebody presort, then we take this url
48
  if ( isset($_GET['dir']) || isset($_GET['presort']) )
49
  $base_url = $_SERVER['REQUEST_URI'];
82
  foreach($picturelist as $picture) {
83
  ?>
84
  <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
85
+ <div class="imageBox_theImage" style="background-image:url('<?php echo $picture->thumbURL; ?>')"></div>
86
  <div class="imageBox_label"><span><?php echo stripslashes($picture->alttext) ?></span></div>
87
  </div>
88
  <?php
changelog.txt CHANGED
@@ -1,7 +1,16 @@
1
  NextGEN Gallery
2
  by Alex Rabe & NextGEN DEV Team
3
 
4
- V1.3.1
 
 
 
 
 
 
 
 
 
5
  - Bugfix : Fixed ZIP upload, wrong variable used
6
  - Bugfix : Check for array before foreach in album missing
7
 
1
  NextGEN Gallery
2
  by Alex Rabe & NextGEN DEV Team
3
 
4
+ V1.3.2 - 10.06.2009
5
+ - Changed : Resize maximum to 1280 x 1280 with nggshow (THX to onezero)
6
+ - Bugfix : Bugfix for Multifile upload
7
+ - Bugfix : Bugfix for sortorder under jQuery 1.3
8
+ - Bugfix : Workaround for more albums per page, need more rework
9
+ - Bugfix : AJAX reload didn't work if slideshow is shown by default
10
+ - Bugfix : Redirect links didn't work if permalinks are deactivates
11
+ - Bugfix : Add new gallery in manage-overview didn't use defaultpath
12
+
13
+ V1.3.1 - 07.06.2009
14
  - Bugfix : Fixed ZIP upload, wrong variable used
15
  - Bugfix : Check for array before foreach in album missing
16
 
lib/rewrite.php CHANGED
@@ -114,8 +114,11 @@ class nggRewrite {
114
 
115
  if (($show_on_front == 'page') && ($page_on_front == get_the_ID()))
116
  $args['page_id'] = get_the_ID();
117
-
118
- $query = htmlspecialchars( add_query_arg($args, get_permalink( get_the_ID() )) );
 
 
 
119
 
120
  return $query;
121
  }
@@ -265,4 +268,4 @@ class nggRewrite {
265
 
266
  } // of nggRewrite CLASS
267
 
268
- ?>
114
 
115
  if (($show_on_front == 'page') && ($page_on_front == get_the_ID()))
116
  $args['page_id'] = get_the_ID();
117
+
118
+ if ( !is_singular() )
119
+ $query = htmlspecialchars( add_query_arg($args, get_permalink( get_the_ID() )) );
120
+ else
121
+ $query = htmlspecialchars( add_query_arg( $args ) );
122
 
123
  return $query;
124
  }
268
 
269
  } // of nggRewrite CLASS
270
 
271
+ ?>
nggajax.php CHANGED
@@ -13,6 +13,7 @@ switch ($_GET['type']) {
13
 
14
  // get the current page/post id
15
  set_query_var('pageid', intval($_GET['p']));
 
16
  $GLOBALS['id'] = intval($_GET['p']);
17
 
18
  echo nggShowGallery( intval($_GET['galleryid']) );
13
 
14
  // get the current page/post id
15
  set_query_var('pageid', intval($_GET['p']));
16
+ set_query_var('show', 'gallery');
17
  $GLOBALS['id'] = intval($_GET['p']);
18
 
19
  echo nggShowGallery( intval($_GET['galleryid']) );
nggallery.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: NextGEN Gallery
4
  Plugin URI: http://alexrabe.boelinger.com/?page_id=80
5
  Description: A NextGENeration Photo gallery for the Web 2.0.
6
  Author: Alex Rabe
7
- Version: 1.3.1
8
 
9
  Author URI: http://alexrabe.boelinger.com/
10
 
@@ -44,7 +44,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
44
  if (!class_exists('nggLoader')) {
45
  class nggLoader {
46
 
47
- var $version = '1.3.1';
48
  var $dbversion = '1.3.1';
49
  var $minium_WP = '2.7';
50
  var $minium_WPMU = '2.7';
4
  Plugin URI: http://alexrabe.boelinger.com/?page_id=80
5
  Description: A NextGENeration Photo gallery for the Web 2.0.
6
  Author: Alex Rabe
7
+ Version: 1.3.2
8
 
9
  Author URI: http://alexrabe.boelinger.com/
10
 
44
  if (!class_exists('nggLoader')) {
45
  class nggLoader {
46
 
47
+ var $version = '1.3.2';
48
  var $dbversion = '1.3.1';
49
  var $minium_WP = '2.7';
50
  var $minium_WPMU = '2.7';
nggfunctions.php CHANGED
@@ -283,14 +283,26 @@ function nggShowAlbum($albumID, $template = 'extend') {
283
  // first look for gallery variable
284
  if (!empty( $gallery )) {
285
 
 
 
 
 
 
 
 
286
  // if gallery is is submit , then show the gallery instead
287
  $out = nggShowGallery( intval($gallery) );
288
  return $out;
289
  }
290
 
291
- //redirect to subalbum
292
- if (!empty( $album ))
293
- $albumID = $album;
 
 
 
 
 
294
 
295
  // lookup in the database
296
  $album = nggdb::find_album( $albumID );
283
  // first look for gallery variable
284
  if (!empty( $gallery )) {
285
 
286
+ // subalbum support only one instance, you cam't use more of them in one post
287
+ if ( isset($GLOBALS['subalbum']) )
288
+ return;
289
+
290
+ if ( ($albumID != $album) && ($albumID != 'all') )
291
+ $GLOBALS['subalbum'] = true;
292
+
293
  // if gallery is is submit , then show the gallery instead
294
  $out = nggShowGallery( intval($gallery) );
295
  return $out;
296
  }
297
 
298
+ if ( (empty( $gallery )) && (isset($GLOBALS['subalbum'])) )
299
+ return;
300
+
301
+ //redirect to subalbum only one time
302
+ if (!empty( $album )) {
303
+ $GLOBALS['subalbum'] = true;
304
+ $albumID = $album;
305
+ }
306
 
307
  // lookup in the database
308
  $album = nggdb::find_album( $albumID );
nggshow.php CHANGED
@@ -18,8 +18,15 @@ $picture = nggdb::find_image( $pictureID );
18
  $thumb = new ngg_Thumbnail( $picture->imagePath );
19
 
20
  // Resize if necessary
21
- if ( !empty($_GET['width']) || !empty($_GET['height']) )
22
- $thumb->resize( intval($_GET['width']), intval($_GET['height']) );
 
 
 
 
 
 
 
23
 
24
  // Apply effects according to the mode parameter
25
  if ($mode == 'watermark') {
18
  $thumb = new ngg_Thumbnail( $picture->imagePath );
19
 
20
  // Resize if necessary
21
+ if ( !empty($_GET['width']) || !empty($_GET['height']) ) {
22
+ // Sanitize
23
+ $w = ( !empty($_GET['width'])) ? intval($_GET['width']) : 0;
24
+ $h = ( !empty($_GET['height'])) ? intval($_GET['height']) : 0;
25
+ // limit the maxium size, prevent server memory overload
26
+ if ($w > 1280) $w = 1280;
27
+ if ($h > 1280) $h = 1280;
28
+ $thumb->resize( $w, $h );
29
+ }
30
 
31
  // Apply effects according to the mode parameter
32
  if ($mode == 'watermark') {