NextGEN Gallery – WordPress Gallery Plugin - Version 1.9.5

Version Description

  • 18.07.2012 =
  • Changed: Branding changes following Photocrati acquisition (removed donation messages and updated links)
  • Secured: Use WordPress-bundled JavaScript libraries for swfobject and swfupload instead of bundling our own
  • Bugfix: Adjusted thickbox effect styling to ensure that the lightbox is always displayed in the foreground
  • Bugfix: Fixed compatibility issues with Contact Form 7 and other plugins by following WordPress Plugin conventions
  • Bugfix: Fixed network-wide activation in WordPress 3.4
  • Bugfix: Plugin is no longer dependent on it's folder name
Download this release

Release Info

Developer photocrati
Plugin Icon 128x128 NextGEN Gallery – WordPress Gallery Plugin
Version 1.9.5
Comparing to
See all releases

Code changes from version 1.9.3 to 1.9.5

Files changed (54) hide show
  1. admin/about.php +168 -183
  2. admin/addgallery.php +543 -541
  3. admin/admin.php +477 -529
  4. admin/ajax.php +450 -450
  5. admin/album.php +596 -595
  6. admin/css/menu.css +0 -11
  7. admin/css/ngg_social_media.css +31 -0
  8. admin/edit-thumbnail.php +170 -170
  9. admin/functions.php +1501 -1501
  10. admin/images/facebook.png +0 -0
  11. admin/images/googleplus.png +0 -0
  12. admin/images/twitter.png +0 -0
  13. admin/install.php +291 -291
  14. admin/js/jquery.MultiFile.js +535 -535
  15. admin/js/jquery.MultiFile.pack.js +10 -10
  16. admin/js/ngg.ajax.js +118 -117
  17. admin/js/ngg.autocomplete.js +2 -1
  18. admin/js/ngg.progressbar.js +96 -95
  19. admin/js/ngg_news_notice.js +13 -0
  20. admin/js/ngg_social_media.js +8 -0
  21. admin/js/sorter.js +294 -294
  22. admin/js/swfupload.handler.js +153 -153
  23. admin/manage-galleries.php +426 -425
  24. admin/manage-images.php +710 -709
  25. admin/manage-sort.php +107 -107
  26. admin/manage.php +656 -656
  27. admin/media-upload.php +282 -282
  28. admin/overview.php +854 -848
  29. admin/roles.php +139 -138
  30. admin/rotate.php +93 -93
  31. admin/settings.php +837 -837
  32. admin/setup.php +58 -58
  33. admin/showmeta.php +123 -123
  34. admin/style.php +251 -251
  35. admin/tags.php +291 -290
  36. admin/templates/facebook_like_button.php +2 -0
  37. admin/templates/latest_news_notice.php +14 -0
  38. admin/templates/social_media_buttons.php +4 -0
  39. admin/templates/twitter_follow_link.php +8 -0
  40. admin/tinymce/editor_plugin.js +77 -77
  41. admin/tinymce/tinymce.js +75 -75
  42. admin/tinymce/tinymce.php +102 -101
  43. admin/tinymce/window.php +145 -145
  44. admin/upgrade.php +479 -479
  45. admin/upload.php +40 -48
  46. admin/wpmu.php +117 -131
  47. changelog.txt +718 -710
  48. css/Black_Minimalism.css +374 -374
  49. css/hovereffect.css +424 -424
  50. css/ngg_dkret3.css +318 -318
  51. css/ngg_k2.css +330 -330
  52. css/ngg_shadow.css +370 -370
  53. css/ngg_shadow2.css +378 -378
  54. css/nggallery.css +0 -63
admin/about.php CHANGED
@@ -1,183 +1,168 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- function nggallery_admin_about() {
5
-
6
- ?>
7
-
8
- <div class="wrap">
9
- <?php screen_icon( 'nextgen-gallery' ); ?>
10
- <h2><?php _e('Copyright notes / Credits', 'nggallery') ;?></h2>
11
- <div id="poststuff">
12
- <div class="postbox">
13
- <h3 class="hndle"><span><?php _e('NextGEN DEV Team', 'nggallery'); ?></span></h3>
14
- <div class="inside">
15
- <p><?php _e('This plugin is primarily developed, maintained, supported, documented by', 'nggallery'); ?> <a href="http://alexrabe.de" target="_blank">Alex Rabe</a>. <?php _e('There are many other folks who have made contributions to this project :', 'nggallery') ;?></p>
16
- <p><?php ngg_list_contributors(); ?></p>
17
- </div>
18
- </div>
19
- <div class="postbox">
20
- <h3 class="hndle"><span><?php _e('Contributors / Tribute to', 'nggallery'); ?></span></h3>
21
- <div class="inside">
22
- <p><?php _e('If you study the code of this plugin, you will find out that we mixed a lot of good already existing code and ideas together.', 'nggallery') ;?>
23
- <?php _e('So, we would like to thank the following people for their pioneer work (without this work it\'s impossible to create such a plugin so fast)', 'nggallery') ;?></p>
24
- <ul class="ngg-list">
25
- <li><a href="http://wordpress.org" target="_blank">The WordPress Team</a> <?php _e('for their great documented code', 'nggallery') ;?></li>
26
- <li><a href="http://jquery.com" target="_blank">The jQuery Team</a> <?php _e('for jQuery, which is the best Web2.0 framework', 'nggallery') ;?></li>
27
- <li><a href="http://www.gen-x-design.com" target="_blank">Ian Selby</a> <?php _e('for the fantastic PHP Thumbnail Class', 'nggallery') ;?></li>
28
- <li><a href="http://www.lesterchan.net/" target="_blank">GaMerZ</a> <?php _e('for a lot of very useful plugins and ideas', 'nggallery') ;?></li>
29
- <li><a href="http://www.laptoptips.ca/" target="_blank">Andrew Ozz</a> <?php _e('for Shutter Reloaded, a real lightweight image effect', 'nggallery') ;?></li>
30
- <li><a href="http://www.jeroenwijering.com/" target="_blank">Jeroen Wijering</a> <?php _e('for the best Media Flash Scripts on earth', 'nggallery') ;?></li>
31
- <li><a href="http://field2.com" target="_blank">Ben Dunkle</a> <?php _e('for the Gallery Icon', 'nggallery') ;?></li>
32
- <li><a href="http://watermark.malcherek.com/" target="_blank">Marek Malcherek</a> <?php _e('for the Watermark plugin', 'nggallery') ;?></li>
33
- </ul>
34
- <p><?php _e('If you didn\'t find your name on this list and there is some code which I integrate in my plugin, don\'t hesitate to send me a mail.', 'nggallery') ;?></p>
35
- </div>
36
- </div>
37
- <div class="postbox">
38
- <h3 class="hndle"><span><?php _e('How to support ?', 'nggallery'); ?></span></h3>
39
- <div class="inside">
40
- <p><?php _e('There exist several ways to contribute, help or support us in this work. Non of them are mandatory.', 'nggallery') ;?></p>
41
- <ul class="ngg-list">
42
- <li><strong><?php _e('Send us bugfixes / code changes', 'nggallery') ;?></strong><br /><?php _e('The most motivated support for this plugin are your ideas and brain work', 'nggallery') ;?></li>
43
- <li><strong><?php _e('Translate the plugin', 'nggallery') ;?></strong><br /><?php _e('To help people to work with this plugin, I would like to have it in all available languages', 'nggallery') ;?></li>
44
- <li><strong><?php _e('Donate the work via paypal', 'nggallery') ;?></strong><br />
45
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" >
46
- <input type="hidden" name="cmd" value="_xclick"/>
47
- <input type="hidden" name="business" value="alter.ego@boelinger.com"/>
48
- <input type="hidden" name="item_name" value="NextGEN Gallery plugin"/>
49
- <input type="hidden" name="no_shipping" value="1"/>
50
- <input type="hidden" name="return" value="http://alexrabe.de/" />
51
- <input type="hidden" name="cancel_return" value="http://alexrabe.de/"/>
52
- <input type="hidden" name="lc" value="US" />
53
- <input type="hidden" name="currency_code" value="EUR"/>
54
- <input type="hidden" name="tax" value="0"/>
55
- <input type="hidden" name="bn" value="PP-DonationsBF"/>
56
- <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" style="border: none;"/>
57
- </form><?php _e('No doubt a very useful and easy motivation :-)', 'nggallery') ;?>
58
- </li>
59
- <li><strong><?php _e('Place a link to the plugin in your blog/webpage', 'nggallery') ;?></strong><br /><?php _e('Yes, share and trackback is also a good support for this work ', 'nggallery') ;?></li>
60
- </ul>
61
- </div>
62
- </div>
63
- <div class="postbox" id="donators">
64
- <h3 class="hndle"><span><?php _e('Thanks!', 'nggallery'); ?></span></h3>
65
- <div class="inside">
66
- <p><?php _e('We would like to thank this people which support us in the work :', 'nggallery'); ?></p>
67
- <p><a href="http://www.boelinger.com/heike/" target="_blank">HEIKE</a>, <?php ngg_list_support(); ?></p>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
-
73
- <?php
74
- }
75
-
76
- function ngg_list_contributors() {
77
- /* The list of my contributors. Thanks to all of them !*/
78
-
79
- $contributors = array(
80
- 'Anty (Code contributor)' => 'http://www.anty.at/',
81
- 'Bjoern von Prollius (Code contributor)' => 'http://www.prollius.de/',
82
- 'Simone Fumagalli (Code contributor)' => 'http://www.iliveinperego.com/',
83
- 'Vincent Prat (Code contributor)' => 'http://www.vincentprat.info',
84
- 'Frederic De Ranter (AJAX code contributor)' => 'http://li.deranter.com/',
85
- 'Christian Arnold (Code contributor)' => 'http://blog.arctic-media.de/',
86
- 'Thomas Matzke (Album code contributor)' => 'http://mufuschnu.mu.funpic.de/',
87
- 'KeViN (Sidebar Widget developer)' => 'http://www.kev.hu/',
88
- 'Lazy (German Translation)' => 'http://www.lazychris.de/',
89
- 'Lise (French Translation)' => 'http://liseweb.fr/',
90
- 'Anja (Dutch Translation)' => 'http://www.werkgroepen.net/wordpress',
91
- 'Adrian (Indonesian Translation)' => 'http://adrian.web.id/',
92
- 'Gaspard Tseng / SillyCCSmile (Chinese Translation)' => '',
93
- 'Mika Pennanen (Finnish Translation)' => 'http://kapsi.fi/~penni',
94
- 'Wojciech Owczarek (Polish Translation)' => 'http://www.owczi.net',
95
- 'Dilip Ramirez (Spanish Translation)' => 'http://jmtd.110mb.com/blog',
96
- 'Oleinikov Vedmak Evgeny (Russian Translation)' => 'http://ka-2-03.mirea.org/',
97
- 'Sebastien MALHERBE (Logo design)' => 'http://www.7vision.com/',
98
- 'Claudia (German documentation)' => 'http://www.blog-werkstatt.de/',
99
- 'Robert (German documentation)' => 'http://www.curlyrob.de/',
100
- 'Pierpaolo Mannone (Italian Translation)' => 'http://www.interscambiocasa.com/',
101
- 'Mattias Tengblad (Swedish Translation)' => 'http://wp-support.se/',
102
- 'M&uuml;fit Kiper (Swedish Translation)' => 'http://www.kiper.se/',
103
- 'Gil Yaker (Documentation)' => 'http://bamboosoup.com/',
104
- 'Morten Johansen (Danish Translation)' => 'http://www.fr3ak.dk/',
105
- 'Vidar Seland (Norwegian Translation)' => 'http://www.viidar.net/',
106
- 'Emre G&uuml;ler (Turkish Translation)' => 'http://www.emreguler.com/',
107
- 'Emilio Lauretti (Italian Translation)' => '',
108
- 'Jan Angelovic (Czech Translation)' => 'http://www.angelovic.cz/',
109
- 'Laki (Slovak Translation)' => 'http://www.laki.sk/',
110
- 'Rowan Crane (WPMU support)' => 'http://blog.rowancrane.com/',
111
- 'Kuba Zwolinski (Polish Translation)' => 'http://kubazwolinski.com/',
112
- 'Rina Jiang (Chinese Translation)' => 'http://http://mysticecho.net/',
113
- 'Anthony (Chinese Translation)' => 'http://www.angryouth.com/',
114
- 'Milan Vasicek (Czech Translation)' => 'http://www.NoWorkTeam.cz/',
115
- 'Joo Gi-young (Korean Translation)' => 'http://lombric.linuxstudy.pe.kr/wp/',
116
- 'Oleg A. Safonov (Russian Translation)' => 'http://blog.olart.ru',
117
- 'AleXander Kirichev (Bulgarian Translation)' => 'http://xsakex.art-bg.org/',
118
- 'Richer Yang (Chinese Translation)' => 'http://fantasyworld.idv.tw/',
119
- 'Bill Jones (Forums contributor)' => 'http://jonesphoto.bluehorizoninternet.com/',
120
- 'TheDonSansone (Forums contributor)' => 'http://abseiling.200blogs.co.uk/',
121
- 'Komyshov (Russian Translation)' => 'http://kf-web.ru/',
122
- 'aleX Zhang (Chinese Translation)' => 'http://zhangfei.info/',
123
- 'TheSoloist (Chinese Translation)' => 'http://www.soloist-ic.cn/',
124
- 'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
125
- 'Zdenek Hatas (Czech Translation)' => '',
126
- 'David Potter (Documentation and Help)' => 'http://dpotter.net/',
127
- 'Carlale Chen (Chinese Translation)' => 'http://0-o-0.cc/',
128
- 'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
129
- 'Igor Shevkoplyas (Russian Translation)' => 'http://www.russian-translation-matters.com',
130
- 'Alexandr Kindras (Code contributor)' => 'http://www.fixdev.com',
131
- 'Manabu Togawa (Japanese Translation)' => 'http://www.churadesign.com/',
132
- 'Serhiy Tretyak (Ukrainian Translation)' => 'http://designpoint.com.ua/',
133
- 'Janis Grinvalds (Latvian Translation)' => 'http://riga.bmxrace.lv/',
134
- 'Kristoffer Th&oslash;ring (Norwegian Translation)' => '',
135
- 'Flactarus (Italian Translation)' => 'http://www.giroevago.it',
136
- 'Felip Alfred Galit&oacute; i Trilla (Catalan Translation)' => 'http://www.bratac.cat',
137
- 'Luka Komac (Slovenian Translation)' => 'http://www.komac.biz',
138
- 'Dimitris Ikonomou / Nikos Mouratidis (Greek Translation)' => 'http://www.kepik.gr'
139
- );
140
-
141
- ksort($contributors);
142
- $i = count($contributors);
143
- foreach ($contributors as $name => $url)
144
- {
145
- if ($url)
146
- echo "<a href=\"$url\">$name</a>";
147
- else
148
- echo $name;
149
- $i--;
150
- if ($i == 1)
151
- echo " & ";
152
- elseif ($i)
153
- echo ", ";
154
- }
155
- }
156
-
157
- function ngg_list_support() {
158
- /* The list of my supporters. Thanks to all of them !*/
159
-
160
- global $ngg;
161
-
162
- $supporter = nggAdminPanel::get_remote_array($ngg->donators);
163
-
164
- // Ensure that this is a array
165
- if ( !is_array($supporter) )
166
- return _e('and all donators...', 'nggallery');
167
-
168
- ksort($supporter);
169
- $i = count($supporter);
170
- foreach ($supporter as $name => $url)
171
- {
172
- if ($url)
173
- echo "<a href=\"$url\">$name</a>";
174
- else
175
- echo $name;
176
- $i--;
177
- if ($i == 1)
178
- echo " & ";
179
- elseif ($i)
180
- echo ", ";
181
- }
182
- }
183
- ?>
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ function nggallery_admin_about() {
5
+
6
+ ?>
7
+
8
+ <div class="wrap">
9
+ <?php include('templates/social_media_buttons.php'); ?>
10
+ <?php screen_icon( 'nextgen-gallery' ); ?>
11
+ <h2><?php _e('Copyright notes / Credits', 'nggallery') ;?></h2>
12
+ <div id="poststuff">
13
+ <div class="postbox">
14
+ <h3 class="hndle"><span><?php _e('NextGEN DEV Team', 'nggallery'); ?></span></h3>
15
+ <div class="inside">
16
+ <p><?php _e('NextGEN Gallery is primarily developed, maintained, supported and documented by <a href="http://www.photocrati.com" target="_blank">Photocrati Media</a>. We\'d like to offer a special thanks to Alex Rabe, who first developed the plugin and maintained it through 2011. There are many others who have made contributions:', 'nggallery') ;?></p>
17
+ <p><?php ngg_list_contributors(); ?></p>
18
+ </div>
19
+ </div>
20
+ <div class="postbox">
21
+ <h3 class="hndle"><span><?php _e('Contributors / Tribute to', 'nggallery'); ?></span></h3>
22
+ <div class="inside">
23
+ <p><?php _e('If you study the code of this plugin, you\'ll find we\'ve included a lot of good, existing code and ideas. We\'d like to thank the following people for their work:', 'nggallery') ;?></p>
24
+ <ul class="ngg-list">
25
+ <li><a href="http://wordpress.org" target="_blank">The WordPress Team</a> <?php _e('for their great documented code', 'nggallery') ;?></li>
26
+ <li><a href="http://jquery.com" target="_blank">The jQuery Team</a> <?php _e('for jQuery, which is the best Web2.0 framework', 'nggallery') ;?></li>
27
+ <li><a href="http://www.gen-x-design.com" target="_blank">Ian Selby</a> <?php _e('for the fantastic PHP Thumbnail Class', 'nggallery') ;?></li>
28
+ <li><a href="http://www.lesterchan.net/" target="_blank">GaMerZ</a> <?php _e('for a lot of very useful plugins and ideas', 'nggallery') ;?></li>
29
+ <li><a href="http://www.laptoptips.ca/" target="_blank">Andrew Ozz</a> <?php _e('for Shutter Reloaded, a real lightweight image effect', 'nggallery') ;?></li>
30
+ <li><a href="http://www.jeroenwijering.com/" target="_blank">Jeroen Wijering</a> <?php _e('for the best Media Flash Scripts on earth', 'nggallery') ;?></li>
31
+ <li><a href="http://field2.com" target="_blank">Ben Dunkle</a> <?php _e('for the Gallery Icon', 'nggallery') ;?></li>
32
+ <li><a href="http://watermark.malcherek.com/" target="_blank">Marek Malcherek</a> <?php _e('for the Watermark plugin', 'nggallery') ;?></li>
33
+ </ul>
34
+ <p><?php _e('If you don\'t see your name on this list and we\'ve integrated some of your code into the plugin, don\'t hesitate to email us.', 'nggallery') ;?></p>
35
+ </div>
36
+ </div>
37
+ <div class="postbox">
38
+ <h3 class="hndle"><span><?php _e('How to support ?', 'nggallery'); ?></span></h3>
39
+ <div class="inside">
40
+ <p><?php _e('There are several ways to contribute:', 'nggallery') ;?></p>
41
+ <ul class="ngg-list">
42
+ <li><strong><?php _e('Send us bugfixes / code changes', 'nggallery') ;?></strong><br /><?php _e('The most motivated support for this plugin are your ideas and brain work.', 'nggallery') ;?></li>
43
+ <li><strong><?php _e('Translate the plugin', 'nggallery') ;?></strong><br /><?php _e('To help people to work with this plugin, we would like to have it in all available languages.', 'nggallery') ;?></li>
44
+ <li><strong><?php _e('Place a link to the plugin in your blog/webpage', 'nggallery') ;?></strong><br /><?php _e('Yes, sharing and linking are also supportive and helpful.', 'nggallery') ;?></li>
45
+ </ul>
46
+ </div>
47
+ </div>
48
+ <div class="postbox" id="donators">
49
+ <h3 class="hndle"><span><?php _e('Thanks!', 'nggallery'); ?></span></h3>
50
+ <div class="inside">
51
+ <p><?php _e('We would like to thank the following people who have supported the NextGEN Gallery plugin:', 'nggallery'); ?></p>
52
+ <p><a href="http://www.boelinger.com/heike/" target="_blank">HEIKE</a>, <?php ngg_list_support(); ?></p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+
58
+ <?php
59
+ }
60
+
61
+ function ngg_list_contributors() {
62
+ /* The list of my contributors. Thanks to all of them !*/
63
+
64
+ $contributors = array(
65
+ 'Anty (Code contributor)' => 'http://www.anty.at/',
66
+ 'Bjoern von Prollius (Code contributor)' => 'http://www.prollius.de/',
67
+ 'Simone Fumagalli (Code contributor)' => 'http://www.iliveinperego.com/',
68
+ 'Vincent Prat (Code contributor)' => 'http://www.vincentprat.info',
69
+ 'Frederic De Ranter (AJAX code contributor)' => 'http://li.deranter.com/',
70
+ 'Christian Arnold (Code contributor)' => 'http://blog.arctic-media.de/',
71
+ 'Thomas Matzke (Album code contributor)' => 'http://mufuschnu.mu.funpic.de/',
72
+ 'KeViN (Sidebar Widget developer)' => 'http://www.kev.hu/',
73
+ 'Lazy (German Translation)' => 'http://www.lazychris.de/',
74
+ 'Lise (French Translation)' => 'http://liseweb.fr/',
75
+ 'Anja (Dutch Translation)' => 'http://www.werkgroepen.net/wordpress',
76
+ 'Adrian (Indonesian Translation)' => 'http://adrian.web.id/',
77
+ 'Gaspard Tseng / SillyCCSmile (Chinese Translation)' => '',
78
+ 'Mika Pennanen (Finnish Translation)' => 'http://kapsi.fi/~penni',
79
+ 'Wojciech Owczarek (Polish Translation)' => 'http://www.owczi.net',
80
+ 'Dilip Ramirez (Spanish Translation)' => 'http://jmtd.110mb.com/blog',
81
+ 'Oleinikov Vedmak Evgeny (Russian Translation)' => 'http://ka-2-03.mirea.org/',
82
+ 'Sebastien MALHERBE (Logo design)' => 'http://www.7vision.com/',
83
+ 'Claudia (German documentation)' => 'http://www.blog-werkstatt.de/',
84
+ 'Robert (German documentation)' => 'http://www.curlyrob.de/',
85
+ 'Pierpaolo Mannone (Italian Translation)' => 'http://www.interscambiocasa.com/',
86
+ 'Mattias Tengblad (Swedish Translation)' => 'http://wp-support.se/',
87
+ 'M&uuml;fit Kiper (Swedish Translation)' => 'http://www.kiper.se/',
88
+ 'Gil Yaker (Documentation)' => 'http://bamboosoup.com/',
89
+ 'Morten Johansen (Danish Translation)' => 'http://www.fr3ak.dk/',
90
+ 'Vidar Seland (Norwegian Translation)' => 'http://www.viidar.net/',
91
+ 'Emre G&uuml;ler (Turkish Translation)' => 'http://www.emreguler.com/',
92
+ 'Emilio Lauretti (Italian Translation)' => '',
93
+ 'Jan Angelovic (Czech Translation)' => 'http://www.angelovic.cz/',
94
+ 'Laki (Slovak Translation)' => 'http://www.laki.sk/',
95
+ 'Rowan Crane (WPMU support)' => 'http://blog.rowancrane.com/',
96
+ 'Kuba Zwolinski (Polish Translation)' => 'http://kubazwolinski.com/',
97
+ 'Rina Jiang (Chinese Translation)' => 'http://http://mysticecho.net/',
98
+ 'Anthony (Chinese Translation)' => 'http://www.angryouth.com/',
99
+ 'Milan Vasicek (Czech Translation)' => 'http://www.NoWorkTeam.cz/',
100
+ 'Joo Gi-young (Korean Translation)' => 'http://lombric.linuxstudy.pe.kr/wp/',
101
+ 'Oleg A. Safonov (Russian Translation)' => 'http://blog.olart.ru',
102
+ 'AleXander Kirichev (Bulgarian Translation)' => 'http://xsakex.art-bg.org/',
103
+ 'Richer Yang (Chinese Translation)' => 'http://fantasyworld.idv.tw/',
104
+ 'Bill Jones (Forums contributor)' => 'http://jonesphoto.bluehorizoninternet.com/',
105
+ 'TheDonSansone (Forums contributor)' => 'http://abseiling.200blogs.co.uk/',
106
+ 'Komyshov (Russian Translation)' => 'http://kf-web.ru/',
107
+ 'aleX Zhang (Chinese Translation)' => 'http://zhangfei.info/',
108
+ 'TheSoloist (Chinese Translation)' => 'http://www.soloist-ic.cn/',
109
+ 'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
110
+ 'Zdenek Hatas (Czech Translation)' => '',
111
+ 'David Potter (Documentation and Help)' => 'http://dpotter.net/',
112
+ 'Carlale Chen (Chinese Translation)' => 'http://0-o-0.cc/',
113
+ 'Nica Luigi Cristian (Romanian Translation)' => 'http://www.cristiannica.com/',
114
+ 'Igor Shevkoplyas (Russian Translation)' => 'http://www.russian-translation-matters.com',
115
+ 'Alexandr Kindras (Code contributor)' => 'http://www.fixdev.com',
116
+ 'Manabu Togawa (Japanese Translation)' => 'http://www.churadesign.com/',
117
+ 'Serhiy Tretyak (Ukrainian Translation)' => 'http://designpoint.com.ua/',
118
+ 'Janis Grinvalds (Latvian Translation)' => 'http://riga.bmxrace.lv/',
119
+ 'Kristoffer Th&oslash;ring (Norwegian Translation)' => '',
120
+ 'Flactarus (Italian Translation)' => 'http://www.giroevago.it',
121
+ 'Felip Alfred Galit&oacute; i Trilla (Catalan Translation)' => 'http://www.bratac.cat',
122
+ 'Luka Komac (Slovenian Translation)' => 'http://www.komac.biz',
123
+ 'Dimitris Ikonomou / Nikos Mouratidis (Greek Translation)' => 'http://www.kepik.gr'
124
+ );
125
+
126
+ ksort($contributors);
127
+ $i = count($contributors);
128
+ foreach ($contributors as $name => $url)
129
+ {
130
+ if ($url)
131
+ echo "<a href=\"$url\" target=\"_blank\">$name</a>";
132
+ else
133
+ echo $name;
134
+ $i--;
135
+ if ($i == 1)
136
+ echo " & ";
137
+ elseif ($i)
138
+ echo ", ";
139
+ }
140
+ }
141
+
142
+ function ngg_list_support() {
143
+ /* The list of my supporters. Thanks to all of them !*/
144
+
145
+ global $ngg;
146
+
147
+ $supporter = nggAdminPanel::get_remote_array($ngg->donators);
148
+
149
+ // Ensure that this is a array
150
+ if ( !is_array($supporter) )
151
+ return _e('and all donators...', 'nggallery');
152
+
153
+ ksort($supporter);
154
+ $i = count($supporter);
155
+ foreach ($supporter as $name => $url)
156
+ {
157
+ if ($url)
158
+ echo "<a href=\"$url\" target=\"_blank\">$name</a>";
159
+ else
160
+ echo $name;
161
+ $i--;
162
+ if ($i == 1)
163
+ echo " & ";
164
+ elseif ($i)
165
+ echo ", ";
166
+ }
167
+ }
168
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/addgallery.php CHANGED
@@ -1,541 +1,543 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- class nggAddGallery {
5
-
6
- /**
7
- * PHP4 compatibility layer for calling the PHP5 constructor.
8
- *
9
- */
10
- function nggAddGallery() {
11
- return $this->__construct();
12
- }
13
-
14
- /**
15
- * nggAddGallery::__construct()
16
- *
17
- * @return void
18
- */
19
- function __construct() {
20
-
21
- // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
22
- $this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
23
-
24
- //Look for POST updates
25
- if ( !empty($_POST) )
26
- $this->processor();
27
- }
28
-
29
- /**
30
- * Perform the upload and add a new hook for plugins
31
- *
32
- * @return void
33
- */
34
- function processor() {
35
- global $wpdb, $ngg, $nggdb;
36
-
37
- $defaultpath = $ngg->options['gallerypath'];
38
-
39
- if ( isset($_POST['addgallery']) ){
40
- check_admin_referer('ngg_addgallery');
41
-
42
- if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
43
- wp_die(__('Cheatin&#8217; uh?'));
44
-
45
- $newgallery = esc_attr( $_POST['galleryname']);
46
- if ( !empty($newgallery) )
47
- nggAdmin::create_gallery($newgallery, $defaultpath);
48
- }
49
-
50
- if ( isset($_POST['zipupload']) ){
51
- check_admin_referer('ngg_addgallery');
52
-
53
- if ( !nggGallery::current_user_can( 'NextGEN Upload a zip' ))
54
- wp_die(__('Cheatin&#8217; uh?'));
55
-
56
- if ($_FILES['zipfile']['error'] == 0 || (!empty($_POST['zipurl'])))
57
- nggAdmin::import_zipfile( intval( $_POST['zipgalselect'] ) );
58
- else
59
- nggGallery::show_error( __('Upload failed!','nggallery') );
60
- }
61
-
62
- if ( isset($_POST['importfolder']) ){
63
- check_admin_referer('ngg_addgallery');
64
-
65
- if ( !nggGallery::current_user_can( 'NextGEN Import image folder' ))
66
- wp_die(__('Cheatin&#8217; uh?'));
67
-
68
- $galleryfolder = $_POST['galleryfolder'];
69
- if ( ( !empty($galleryfolder) ) AND ($defaultpath != $galleryfolder) )
70
- nggAdmin::import_gallery($galleryfolder);
71
- }
72
-
73
- if ( isset($_POST['uploadimage']) ){
74
- check_admin_referer('ngg_addgallery');
75
-
76
- if ( !nggGallery::current_user_can( 'NextGEN Upload in all galleries' ))
77
- wp_die(__('Cheatin&#8217; uh?'));
78
-
79
- if ( $_FILES['imagefiles']['error'][0] == 0 )
80
- $messagetext = nggAdmin::upload_images();
81
- else
82
- nggGallery::show_error( __('Upload failed! ' . nggAdmin::decode_upload_error( $_FILES['imagefiles']['error'][0]),'nggallery') );
83
- }
84
-
85
- if ( isset($_POST['swf_callback']) ){
86
- if ($_POST['galleryselect'] == '0' )
87
- nggGallery::show_error(__('No gallery selected !','nggallery'));
88
- else {
89
- if ($_POST['swf_callback'] == '-1' )
90
- nggGallery::show_error( __('Upload failed! ','nggallery') );
91
- else {
92
- $gallery = $nggdb->find_gallery( (int) $_POST['galleryselect'] );
93
- nggAdmin::import_gallery( $gallery->path );
94
- }
95
- }
96
- }
97
-
98
- if ( isset($_POST['disable_flash']) ){
99
- check_admin_referer('ngg_addgallery');
100
- $ngg->options['swfUpload'] = false;
101
- update_option('ngg_options', $ngg->options);
102
- }
103
-
104
- if ( isset($_POST['enable_flash']) ){
105
- check_admin_referer('ngg_addgallery');
106
- $ngg->options['swfUpload'] = true;
107
- update_option('ngg_options', $ngg->options);
108
- }
109
-
110
- do_action( 'ngg_update_addgallery_page' );
111
-
112
- }
113
-
114
- /**
115
- * Render the page content
116
- *
117
- * @return void
118
- */
119
- function controller() {
120
- global $ngg, $nggdb;
121
-
122
- // check for the max image size
123
- $this->maxsize = nggGallery::check_memory_limit();
124
-
125
- //get all galleries (after we added new ones)
126
- $this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
127
-
128
- $this->defaultpath = $ngg->options['gallerypath'];
129
-
130
- // link for the flash file
131
- $swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
132
-
133
- // get list of tabs
134
- $tabs = $this->tabs_order();
135
-
136
- // with this filter you can add custom file types
137
- $file_types = apply_filters( 'ngg_swf_file_types', '*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG' );
138
-
139
- // Set the post params, which plupload will post back with the file, and pass them through a filter.
140
- $post_params = array(
141
- "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]),
142
- "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],
143
- "_wpnonce" => wp_create_nonce('ngg_swfupload'),
144
- "galleryselect" => "0",
145
- );
146
- $p = array();
147
-
148
- foreach ( $post_params as $param => $val ) {
149
- $val = esc_js( $val );
150
- $p[] = "'$param' : '$val'";
151
- }
152
-
153
- $post_params_str = implode( ',', $p ). "\n";
154
-
155
- ?>
156
-
157
- <?php if($ngg->options['swfUpload'] && !empty ($this->gallerylist) ) { ?>
158
- <?php if ( defined('IS_WP_3_3') ) { ?>
159
- <!-- plupload script -->
160
- <script type="text/javascript">
161
- //<![CDATA[
162
- var resize_height = <?php echo (int) $ngg->options['imgHeight']; ?>,
163
- resize_width = <?php echo (int) $ngg->options['imgWidth']; ?>;
164
-
165
- jQuery(document).ready(function($) {
166
- window.uploader = new plupload.Uploader({
167
- runtimes: '<?php echo apply_filters('plupload_runtimes', 'html5,flash,silverlight,html4,'); ?>',
168
- browse_button: 'plupload-browse-button',
169
- container: 'plupload-upload-ui',
170
- drop_element: 'uploadimage',
171
- file_data_name: 'Filedata',
172
- max_file_size: '<?php echo round( (int) wp_max_upload_size() / 1024 ); ?>kb',
173
- url: '<?php echo esc_js( $swf_upload_link ); ?>',
174
- flash_swf_url: '<?php echo esc_js( includes_url('js/plupload/plupload.flash.swf') ); ?>',
175
- silverlight_xap_url: '<?php echo esc_js( includes_url('js/plupload/plupload.silverlight.xap') ); ?>',
176
- filters: [
177
- {title: '<?php echo esc_js( __('Image Files', 'nggallery') ); ?>', extensions: '<?php echo esc_js( str_replace( array('*.', ';'), array('', ','), $file_types) ); ?>'}
178
- ],
179
- multipart: true,
180
- urlstream_upload: true,
181
- multipart_params : {
182
- <?php echo $post_params_str; ?>
183
- },
184
- debug: false,
185
- preinit : {
186
- Init: function(up, info) {
187
- debug('[Init]', 'Info :', info, 'Features :', up.features);
188
- initUploader();
189
- }
190
- },
191
- i18n : {
192
- 'remove' : '<?php _e('remove', 'nggallery') ;?>',
193
- 'browse' : '<?php _e('Browse...', 'nggallery') ;?>',
194
- 'upload' : '<?php _e('Upload images', 'nggallery') ;?>'
195
- }
196
- });
197
-
198
- uploader.bind('FilesAdded', function(up, files) {
199
- $.each(files, function(i, file) {
200
- fileQueued(file);
201
- });
202
-
203
- up.refresh();
204
- });
205
-
206
- uploader.bind('BeforeUpload', function(up, file) {
207
- uploadStart(file);
208
- });
209
-
210
- uploader.bind('UploadProgress', function(up, file) {
211
- uploadProgress(file, file.loaded, file.size);
212
- });
213
-
214
- uploader.bind('Error', function(up, err) {
215
- uploadError(err.file, err.code, err.message);
216
-
217
- up.refresh();
218
- });
219
-
220
- uploader.bind('FileUploaded', function(up, file, response) {
221
- uploadSuccess(file, response);
222
- });
223
-
224
- uploader.bind('UploadComplete', function(up, file) {
225
- uploadComplete(file);
226
- });
227
-
228
- // on load change the upload to plupload
229
- uploader.init();
230
-
231
- nggAjaxOptions = {
232
- header: "<?php _e('Upload images', 'nggallery') ;?>",
233
- maxStep: 100
234
- };
235
-
236
- });
237
- //]]>
238
- </script>
239
- <?php } else { ?>
240
- <!-- SWFUpload script -->
241
- <script type="text/javascript">
242
- var ngg_swf_upload;
243
-
244
- window.onload = function () {
245
- ngg_swf_upload = new SWFUpload({
246
- // Backend settings
247
- upload_url : "<?php echo esc_js( $swf_upload_link ); ?>",
248
- flash_url : "<?php echo NGGALLERY_URLPATH; ?>admin/js/swfupload.swf",
249
-
250
- // Button Settings
251
- button_placeholder_id : "spanButtonPlaceholder",
252
- button_width: 300,
253
- button_height: 27,
254
- button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
255
- button_cursor: SWFUpload.CURSOR.HAND,
256
-
257
- // File Upload Settings
258
- file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
259
- file_types : "<?php echo $file_types; ?>",
260
- file_types_description : "<?php _e('Image Files', 'nggallery') ;?>",
261
-
262
- // Queue handler
263
- file_queued_handler : fileQueued,
264
-
265
- // Upload handler
266
- upload_start_handler : uploadStart,
267
- upload_progress_handler : uploadProgress,
268
- upload_error_handler : uploadError,
269
- upload_success_handler : uploadSuccess,
270
- upload_complete_handler : uploadComplete,
271
-
272
- post_params : {
273
- "auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
274
- "logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
275
- "_wpnonce" : "<?php echo wp_create_nonce('ngg_swfupload'); ?>",
276
- "galleryselect" : "0"
277
- },
278
-
279
- // i18names
280
- custom_settings : {
281
- "remove" : "<?php _e('remove', 'nggallery') ;?>",
282
- "browse" : "<?php _e('Browse...', 'nggallery') ;?>",
283
- "upload" : "<?php _e('Upload images', 'nggallery') ;?>"
284
- },
285
-
286
- // Debug settings
287
- debug: false
288
-
289
- });
290
-
291
- // on load change the upload to swfupload
292
- initSWFUpload();
293
-
294
- nggAjaxOptions = {
295
- header: "<?php _e('Upload images', 'nggallery') ;?>",
296
- maxStep: 100
297
- };
298
-
299
- };
300
- </script>
301
- <?php } ?>
302
- <?php } else { ?>
303
- <!-- MultiFile script -->
304
- <script type="text/javascript">
305
- /* <![CDATA[ */
306
- jQuery(document).ready(function(){
307
- jQuery('#imagefiles').MultiFile({
308
- STRING: {
309
- remove:'[<?php _e('remove', 'nggallery') ;?>]'
310
- }
311
- });
312
- });
313
- /* ]]> */
314
- </script>
315
- <?php } ?>
316
- <!-- jQuery Tabs script -->
317
- <script type="text/javascript">
318
- /* <![CDATA[ */
319
- jQuery(document).ready(function(){
320
- jQuery('html,body').scrollTop(0);
321
- jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
322
- jQuery('#slider').css('display', 'block');
323
- });
324
-
325
- // File Tree implementation
326
- jQuery(function() {
327
- jQuery("span.browsefiles").show().click(function(){
328
- jQuery("#file_browser").fileTree({
329
- script: "admin-ajax.php?action=ngg_file_browser&nonce=<?php echo wp_create_nonce( 'ngg-ajax' ) ;?>",
330
- root: jQuery("#galleryfolder").val()
331
- }, function(folder) {
332
- jQuery("#galleryfolder").val( folder );
333
- });
334
- jQuery("#file_browser").show('slide');
335
- });
336
- });
337
- /* ]]> */
338
- </script>
339
- <div id="slider" class="wrap" style="display: none;">
340
- <ul id="tabs">
341
- <?php
342
- foreach($tabs as $tab_key => $tab_name) {
343
- echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
344
- }
345
- ?>
346
- </ul>
347
- <?php
348
- foreach($tabs as $tab_key => $tab_name) {
349
- echo "\n\t<div id='$tab_key'>\n";
350
- // Looks for the internal class function, otherwise enable a hook for plugins
351
- if ( method_exists( $this, "tab_$tab_key" ))
352
- call_user_func( array( &$this , "tab_$tab_key") );
353
- else
354
- do_action( 'ngg_tab_content_' . $tab_key );
355
- echo "\n\t</div>";
356
- }
357
- ?>
358
- </div>
359
- <?php
360
-
361
- }
362
-
363
- /**
364
- * Create array for tabs and add a filter for other plugins to inject more tabs
365
- *
366
- * @return array $tabs
367
- */
368
- function tabs_order() {
369
-
370
- $tabs = array();
371
-
372
- if ( !empty ($this->gallerylist) )
373
- $tabs['uploadimage'] = __( 'Upload Images', 'nggallery' );
374
-
375
- if ( nggGallery::current_user_can( 'NextGEN Add new gallery' ))
376
- $tabs['addgallery'] = __('Add new gallery', 'nggallery');
377
-
378
- if ( wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can( 'NextGEN Upload a zip' ) )
379
- $tabs['zipupload'] = __('Upload a Zip-File', 'nggallery');
380
-
381
- if ( wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can( 'NextGEN Import image folder' ) )
382
- $tabs['importfolder'] = __('Import image folder', 'nggallery');
383
-
384
- $tabs = apply_filters('ngg_addgallery_tabs', $tabs);
385
-
386
- return $tabs;
387
-
388
- }
389
-
390
- function tab_addgallery() {
391
- ?>
392
- <!-- create gallery -->
393
- <h2><?php _e('Add new gallery', 'nggallery') ;?></h2>
394
- <form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $this->filepath; ?>" accept-charset="utf-8" >
395
- <?php wp_nonce_field('ngg_addgallery') ?>
396
- <table class="form-table">
397
- <tr valign="top">
398
- <th scope="row"><?php _e('New Gallery', 'nggallery') ;?>:</th>
399
- <td><input type="text" size="35" name="galleryname" value="" /><br />
400
- <?php if(!is_multisite()) { ?>
401
- <?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $this->defaultpath ?></strong><br />
402
- <?php } ?>
403
- <i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i></td>
404
- </tr>
405
- <?php do_action('ngg_add_new_gallery_form'); ?>
406
- </table>
407
- <div class="submit"><input class="button-primary" type="submit" name= "addgallery" value="<?php _e('Add gallery', 'nggallery') ;?>"/></div>
408
- </form>
409
- <?php
410
- }
411
-
412
- function tab_zipupload() {
413
- ?>
414
- <!-- zip-file operation -->
415
- <h2><?php _e('Upload a Zip-File', 'nggallery') ;?></h2>
416
- <form name="zipupload" id="zipupload_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#zipupload'; ?>" accept-charset="utf-8" >
417
- <?php wp_nonce_field('ngg_addgallery') ?>
418
- <table class="form-table">
419
- <tr valign="top">
420
- <th scope="row"><?php _e('Select Zip-File', 'nggallery') ;?>:</th>
421
- <td><input type="file" name="zipfile" id="zipfile" size="35" class="uploadform"/><br />
422
- <?php _e('Upload a zip file with images', 'nggallery') ;?></td>
423
- </tr>
424
- <?php if (function_exists('curl_init')) : ?>
425
- <tr valign="top">
426
- <th scope="row"><?php _e('or enter a Zip-File URL', 'nggallery') ;?>:</th>
427
- <td><input type="text" name="zipurl" id="zipurl" size="35" class="uploadform"/><br />
428
- <?php _e('Import a zip file with images from a url', 'nggallery') ;?></td>
429
- </tr>
430
- <?php endif; ?>
431
- <tr valign="top">
432
- <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
433
- <td><select name="zipgalselect">
434
- <option value="0" ><?php _e('a new gallery', 'nggallery') ?></option>
435
- <?php
436
- foreach($this->gallerylist as $gallery) {
437
- if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
438
- continue;
439
- $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
440
- echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr( $name ). '</option>' . "\n";
441
- }
442
- ?>
443
- </select>
444
- <br /><?php echo $this->maxsize; ?>
445
- <br /><?php echo _e('Note : The upload limit on your server is ','nggallery') . "<strong>" . ini_get('upload_max_filesize') . "Byte</strong>\n"; ?>
446
- <br /><?php if ( (is_multisite()) && wpmu_enable_function('wpmuQuotaCheck') ) display_space_usage(); ?></td>
447
- </tr>
448
- </table>
449
- <div class="submit"><input class="button-primary" type="submit" name= "zipupload" value="<?php _e('Start upload', 'nggallery') ;?>"/></div>
450
- </form>
451
- <?php
452
- }
453
-
454
- function tab_importfolder() {
455
- ?>
456
- <!-- import folder -->
457
- <h2><?php _e('Import image folder', 'nggallery') ;?></h2>
458
- <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $this->filepath.'#importfolder'; ?>" accept-charset="utf-8" >
459
- <?php wp_nonce_field('ngg_addgallery') ?>
460
- <table class="form-table">
461
- <tr valign="top">
462
- <th scope="row"><?php _e('Import from Server path:', 'nggallery') ;?></th>
463
- <td><input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $this->defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...', 'nggallery'); ?></span><br />
464
- <div id="file_browser"></div>
465
- <br /><i>( <?php _e('Note : Change the default path in the gallery settings', 'nggallery') ;?> )</i>
466
- <br /><?php echo $this->maxsize; ?>
467
- <?php if (SAFE_MODE) {?><br /><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'nggallery') ;?><?php }; ?></td>
468
- </tr>
469
- </table>
470
- <div class="submit"><input class="button-primary" type="submit" name= "importfolder" value="<?php _e('Import folder', 'nggallery') ;?>"/></div>
471
- </form>
472
- <?php
473
- }
474
-
475
- function tab_uploadimage() {
476
- global $ngg;
477
- // check the cookie for the current setting
478
- $checked = get_user_setting('ngg_upload_resize') ? ' checked="true"' : '';
479
- ?>
480
- <!-- upload images -->
481
- <h2><?php _e('Upload Images', 'nggallery') ;?></h2>
482
- <form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#uploadimage'; ?>" accept-charset="utf-8" >
483
- <?php wp_nonce_field('ngg_addgallery') ?>
484
- <table class="form-table">
485
-
486
- <tr valign="top">
487
- <th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
488
- <?php if ($ngg->options['swfUpload'] && defined('IS_WP_3_3') ) { ?>
489
- <td>
490
- <div id="plupload-upload-ui">
491
- <div>
492
- <?php _e( 'Choose files to upload' ); ?>
493
- <input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" />
494
- </div>
495
- <p class="ngg-dragdrop-info howto" style="display:none;" ><?php _e('Or you can drop the files into this window.'); ?></p>
496
- <div id='uploadQueue'></div>
497
- <p><label><input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> />
498
- <?php printf( __( 'Scale images to max width %1$dpx or max height %2$dpx', 'nggallery' ), (int) $ngg->options['imgWidth' ], (int) $ngg->options[ 'imgHeight' ] ); ?>
499
- <div id='image_resize_pointer'>&nbsp;</div>
500
- </label>
501
- </p>
502
-
503
- </div>
504
- </td>
505
- <?php } else { ?>
506
- <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
507
- <?php } ?>
508
- </tr>
509
- <tr valign="top">
510
- <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
511
- <td><select name="galleryselect" id="galleryselect">
512
- <option value="0" ><?php _e('Choose gallery', 'nggallery') ?></option>
513
- <?php
514
- foreach($this->gallerylist as $gallery) {
515
-
516
- //special case : we check if a user has this cap, then we override the second cap check
517
- if ( !current_user_can( 'NextGEN Upload in all galleries' ) )
518
- if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
519
- continue;
520
-
521
- $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
522
- echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr( $name ) . '</option>' . "\n";
523
- } ?>
524
- </select>
525
- <br /><?php echo $this->maxsize; ?>
526
- <br /><?php if ((is_multisite()) && wpmu_enable_function('wpmuQuotaCheck')) display_space_usage(); ?></td>
527
- </tr>
528
- </table>
529
- <div class="submit">
530
- <?php if ($ngg->options['swfUpload']) { ?>
531
- <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload requires Adobe Flash 10, disable it if you have problems','nggallery') ?>" value="<?php _e('Disable flash upload', 'nggallery') ;?>" />
532
- <?php } else { ?>
533
- <input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog','nggallery') ?>" value="<?php _e('Enable flash based upload', 'nggallery') ;?>" />
534
- <?php } ?>
535
- <input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'nggallery') ;?>" />
536
- </div>
537
- </form>
538
- <?php
539
- }
540
- }
541
- ?>
 
 
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ class nggAddGallery {
5
+
6
+ /**
7
+ * PHP4 compatibility layer for calling the PHP5 constructor.
8
+ *
9
+ */
10
+ function nggAddGallery() {
11
+ return $this->__construct();
12
+ }
13
+
14
+ /**
15
+ * nggAddGallery::__construct()
16
+ *
17
+ * @return void
18
+ */
19
+ function __construct() {
20
+
21
+ // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
22
+ $this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
23
+
24
+ //Look for POST updates
25
+ if ( !empty($_POST) )
26
+ $this->processor();
27
+ }
28
+
29
+ /**
30
+ * Perform the upload and add a new hook for plugins
31
+ *
32
+ * @return void
33
+ */
34
+ function processor() {
35
+ global $wpdb, $ngg, $nggdb;
36
+
37
+ $defaultpath = $ngg->options['gallerypath'];
38
+
39
+ if ( isset($_POST['addgallery']) ){
40
+ check_admin_referer('ngg_addgallery');
41
+
42
+ if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
43
+ wp_die(__('Cheatin&#8217; uh?'));
44
+
45
+ $newgallery = esc_attr( $_POST['galleryname']);
46
+ if ( !empty($newgallery) )
47
+ nggAdmin::create_gallery($newgallery, $defaultpath);
48
+ }
49
+
50
+ if ( isset($_POST['zipupload']) ){
51
+ check_admin_referer('ngg_addgallery');
52
+
53
+ if ( !nggGallery::current_user_can( 'NextGEN Upload a zip' ))
54
+ wp_die(__('Cheatin&#8217; uh?'));
55
+
56
+ if ($_FILES['zipfile']['error'] == 0 || (!empty($_POST['zipurl'])))
57
+ nggAdmin::import_zipfile( intval( $_POST['zipgalselect'] ) );
58
+ else
59
+ nggGallery::show_error( __('Upload failed!','nggallery') );
60
+ }
61
+
62
+ if ( isset($_POST['importfolder']) ){
63
+ check_admin_referer('ngg_addgallery');
64
+
65
+ if ( !nggGallery::current_user_can( 'NextGEN Import image folder' ))
66
+ wp_die(__('Cheatin&#8217; uh?'));
67
+
68
+ $galleryfolder = $_POST['galleryfolder'];
69
+ if ( ( !empty($galleryfolder) ) AND ($defaultpath != $galleryfolder) )
70
+ nggAdmin::import_gallery($galleryfolder);
71
+ }
72
+
73
+ if ( isset($_POST['uploadimage']) ){
74
+ check_admin_referer('ngg_addgallery');
75
+
76
+ if ( !nggGallery::current_user_can( 'NextGEN Upload in all galleries' ))
77
+ wp_die(__('Cheatin&#8217; uh?'));
78
+
79
+ if ( $_FILES['imagefiles']['error'][0] == 0 )
80
+ $messagetext = nggAdmin::upload_images();
81
+ else
82
+ nggGallery::show_error( __('Upload failed! ' . nggAdmin::decode_upload_error( $_FILES['imagefiles']['error'][0]),'nggallery') );
83
+ }
84
+
85
+ if ( isset($_POST['swf_callback']) ){
86
+ if ($_POST['galleryselect'] == '0' )
87
+ nggGallery::show_error(__('No gallery selected !','nggallery'));
88
+ else {
89
+ if ($_POST['swf_callback'] == '-1' )
90
+ nggGallery::show_error( __('Upload failed! ','nggallery') );
91
+ else {
92
+ $gallery = $nggdb->find_gallery( (int) $_POST['galleryselect'] );
93
+ nggAdmin::import_gallery( $gallery->path );
94
+ }
95
+ }
96
+ }
97
+
98
+ if ( isset($_POST['disable_flash']) ){
99
+ check_admin_referer('ngg_addgallery');
100
+ $ngg->options['swfUpload'] = false;
101
+ update_option('ngg_options', $ngg->options);
102
+ }
103
+
104
+ if ( isset($_POST['enable_flash']) ){
105
+ check_admin_referer('ngg_addgallery');
106
+ $ngg->options['swfUpload'] = true;
107
+ update_option('ngg_options', $ngg->options);
108
+ }
109
+
110
+ do_action( 'ngg_update_addgallery_page' );
111
+
112
+ }
113
+
114
+ /**
115
+ * Render the page content
116
+ *
117
+ * @return void
118
+ */
119
+ function controller() {
120
+ global $ngg, $nggdb;
121
+
122
+ // check for the max image size
123
+ $this->maxsize = nggGallery::check_memory_limit();
124
+
125
+ //get all galleries (after we added new ones)
126
+ $this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
127
+
128
+ $this->defaultpath = $ngg->options['gallerypath'];
129
+
130
+ // link for the flash file
131
+ $swf_upload_link = admin_url('/?nggupload');
132
+
133
+ // get list of tabs
134
+ $tabs = $this->tabs_order();
135
+
136
+ // with this filter you can add custom file types
137
+ $file_types = apply_filters( 'ngg_swf_file_types', '*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG' );
138
+
139
+ // Set the post params, which plupload will post back with the file, and pass them through a filter.
140
+ $post_params = array(
141
+ "auth_cookie" => (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]),
142
+ "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE],
143
+ "_wpnonce" => wp_create_nonce('ngg_swfupload'),
144
+ "galleryselect" => "0",
145
+ );
146
+ $p = array();
147
+
148
+ foreach ( $post_params as $param => $val ) {
149
+ $val = esc_js( $val );
150
+ $p[] = "'$param' : '$val'";
151
+ }
152
+
153
+ $post_params_str = implode( ',', $p ). "\n";
154
+ ?>
155
+
156
+ <?php include('templates/social_media_buttons.php'); ?>
157
+
158
+ <?php if($ngg->options['swfUpload'] && !empty ($this->gallerylist) ) { ?>
159
+ <?php if ( defined('IS_WP_3_3') ) { ?>
160
+ <!-- plupload script -->
161
+ <script type="text/javascript">
162
+ //<![CDATA[
163
+ var resize_height = <?php echo (int) $ngg->options['imgHeight']; ?>,
164
+ resize_width = <?php echo (int) $ngg->options['imgWidth']; ?>;
165
+
166
+ jQuery(document).ready(function($) {
167
+ window.uploader = new plupload.Uploader({
168
+ runtimes: '<?php echo apply_filters('plupload_runtimes', 'html5,flash,silverlight,html4,'); ?>',
169
+ browse_button: 'plupload-browse-button',
170
+ container: 'plupload-upload-ui',
171
+ drop_element: 'uploadimage',
172
+ file_data_name: 'Filedata',
173
+ max_file_size: '<?php echo round( (int) wp_max_upload_size() / 1024 ); ?>kb',
174
+ url: '<?php echo esc_js( $swf_upload_link ); ?>',
175
+ flash_swf_url: '<?php echo esc_js( includes_url('js/plupload/plupload.flash.swf') ); ?>',
176
+ silverlight_xap_url: '<?php echo esc_js( includes_url('js/plupload/plupload.silverlight.xap') ); ?>',
177
+ filters: [
178
+ {title: '<?php echo esc_js( __('Image Files', 'nggallery') ); ?>', extensions: '<?php echo esc_js( str_replace( array('*.', ';'), array('', ','), $file_types) ); ?>'}
179
+ ],
180
+ multipart: true,
181
+ urlstream_upload: true,
182
+ multipart_params : {
183
+ <?php echo $post_params_str; ?>
184
+ },
185
+ debug: false,
186
+ preinit : {
187
+ Init: function(up, info) {
188
+ debug('[Init]', 'Info :', info, 'Features :', up.features);
189
+ initUploader();
190
+ }
191
+ },
192
+ i18n : {
193
+ 'remove' : '<?php _e('remove', 'nggallery') ;?>',
194
+ 'browse' : '<?php _e('Browse...', 'nggallery') ;?>',
195
+ 'upload' : '<?php _e('Upload images', 'nggallery') ;?>'
196
+ }
197
+ });
198
+
199
+ uploader.bind('FilesAdded', function(up, files) {
200
+ $.each(files, function(i, file) {
201
+ fileQueued(file);
202
+ });
203
+
204
+ up.refresh();
205
+ });
206
+
207
+ uploader.bind('BeforeUpload', function(up, file) {
208
+ uploadStart(file);
209
+ });
210
+
211
+ uploader.bind('UploadProgress', function(up, file) {
212
+ uploadProgress(file, file.loaded, file.size);
213
+ });
214
+
215
+ uploader.bind('Error', function(up, err) {
216
+ uploadError(err.file, err.code, err.message);
217
+
218
+ up.refresh();
219
+ });
220
+
221
+ uploader.bind('FileUploaded', function(up, file, response) {
222
+ uploadSuccess(file, response);
223
+ });
224
+
225
+ uploader.bind('UploadComplete', function(up, file) {
226
+ uploadComplete(file);
227
+ });
228
+
229
+ // on load change the upload to plupload
230
+ uploader.init();
231
+
232
+ nggAjaxOptions = {
233
+ header: "<?php _e('Upload images', 'nggallery') ;?>",
234
+ maxStep: 100
235
+ };
236
+
237
+ });
238
+ //]]>
239
+ </script>
240
+ <?php } else { ?>
241
+ <!-- SWFUpload script -->
242
+ <script type="text/javascript">
243
+ var ngg_swf_upload;
244
+
245
+ window.onload = function () {
246
+ ngg_swf_upload = new SWFUpload({
247
+ // Backend settings
248
+ upload_url : "<?php echo esc_js( $swf_upload_link ); ?>",
249
+ flash_url : "<?php echo esc_js( includes_url('js/swfupload/swfupload.swf') ); ?>",
250
+
251
+ // Button Settings
252
+ button_placeholder_id : "spanButtonPlaceholder",
253
+ button_width: 300,
254
+ button_height: 27,
255
+ button_text_top_padding: 3,
256
+ button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
257
+ button_cursor: SWFUpload.CURSOR.HAND,
258
+
259
+ // File Upload Settings
260
+ file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
261
+ file_types : "<?php echo $file_types; ?>",
262
+ file_types_description : "<?php _e('Image Files', 'nggallery') ;?>",
263
+
264
+ // Queue handler
265
+ file_queued_handler : fileQueued,
266
+
267
+ // Upload handler
268
+ upload_start_handler : uploadStart,
269
+ upload_progress_handler : uploadProgress,
270
+ upload_error_handler : uploadError,
271
+ upload_success_handler : uploadSuccess,
272
+ upload_complete_handler : uploadComplete,
273
+
274
+ post_params : {
275
+ "auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
276
+ "logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
277
+ "_wpnonce" : "<?php echo wp_create_nonce('ngg_swfupload'); ?>",
278
+ "galleryselect" : "0"
279
+ },
280
+
281
+ // i18names
282
+ custom_settings : {
283
+ "remove" : "<?php _e('remove', 'nggallery') ;?>",
284
+ "browse" : "<?php _e('Browse...', 'nggallery') ;?>",
285
+ "upload" : "<?php _e('Upload images', 'nggallery') ;?>"
286
+ },
287
+
288
+ // Debug settings
289
+ debug: false
290
+
291
+ });
292
+
293
+ // on load change the upload to swfupload
294
+ initSWFUpload();
295
+
296
+ nggAjaxOptions = {
297
+ header: "<?php _e('Upload images', 'nggallery') ;?>",
298
+ maxStep: 100
299
+ };
300
+
301
+ };
302
+ </script>
303
+ <?php } ?>
304
+ <?php } else { ?>
305
+ <!-- MultiFile script -->
306
+ <script type="text/javascript">
307
+ /* <![CDATA[ */
308
+ jQuery(document).ready(function(){
309
+ jQuery('#imagefiles').MultiFile({
310
+ STRING: {
311
+ remove:'[<?php _e('remove', 'nggallery') ;?>]'
312
+ }
313
+ });
314
+ });
315
+ /* ]]> */
316
+ </script>
317
+ <?php } ?>
318
+ <!-- jQuery Tabs script -->
319
+ <script type="text/javascript">
320
+ /* <![CDATA[ */
321
+ jQuery(document).ready(function(){
322
+ jQuery('html,body').scrollTop(0);
323
+ jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
324
+ jQuery('#slider').css('display', 'block');
325
+ });
326
+
327
+ // File Tree implementation
328
+ jQuery(function() {
329
+ jQuery("span.browsefiles").show().click(function(){
330
+ jQuery("#file_browser").fileTree({
331
+ script: "admin-ajax.php?action=ngg_file_browser&nonce=<?php echo wp_create_nonce( 'ngg-ajax' ) ;?>",
332
+ root: jQuery("#galleryfolder").val()
333
+ }, function(folder) {
334
+ jQuery("#galleryfolder").val( folder );
335
+ });
336
+ jQuery("#file_browser").show('slide');
337
+ });
338
+ });
339
+ /* ]]> */
340
+ </script>
341
+ <div id="slider" class="wrap" style="display: none;">
342
+ <ul id="tabs">
343
+ <?php
344
+ foreach($tabs as $tab_key => $tab_name) {
345
+ echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
346
+ }
347
+ ?>
348
+ </ul>
349
+ <?php
350
+ foreach($tabs as $tab_key => $tab_name) {
351
+ echo "\n\t<div id='$tab_key'>\n";
352
+ // Looks for the internal class function, otherwise enable a hook for plugins
353
+ if ( method_exists( $this, "tab_$tab_key" ))
354
+ call_user_func( array( &$this , "tab_$tab_key") );
355
+ else
356
+ do_action( 'ngg_tab_content_' . $tab_key );
357
+ echo "\n\t</div>";
358
+ }
359
+ ?>
360
+ </div>
361
+ <?php
362
+
363
+ }
364
+
365
+ /**
366
+ * Create array for tabs and add a filter for other plugins to inject more tabs
367
+ *
368
+ * @return array $tabs
369
+ */
370
+ function tabs_order() {
371
+
372
+ $tabs = array();
373
+
374
+ if ( !empty ($this->gallerylist) )
375
+ $tabs['uploadimage'] = __( 'Upload Images', 'nggallery' );
376
+
377
+ if ( nggGallery::current_user_can( 'NextGEN Add new gallery' ))
378
+ $tabs['addgallery'] = __('Add new gallery', 'nggallery');
379
+
380
+ if ( wpmu_enable_function('wpmuZipUpload') && nggGallery::current_user_can( 'NextGEN Upload a zip' ) )
381
+ $tabs['zipupload'] = __('Upload a Zip-File', 'nggallery');
382
+
383
+ if ( wpmu_enable_function('wpmuImportFolder') && nggGallery::current_user_can( 'NextGEN Import image folder' ) )
384
+ $tabs['importfolder'] = __('Import image folder', 'nggallery');
385
+
386
+ $tabs = apply_filters('ngg_addgallery_tabs', $tabs);
387
+
388
+ return $tabs;
389
+
390
+ }
391
+
392
+ function tab_addgallery() {
393
+ ?>
394
+ <!-- create gallery -->
395
+ <h2><?php _e('Add new gallery', 'nggallery') ;?></h2>
396
+ <form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $this->filepath; ?>" accept-charset="utf-8" >
397
+ <?php wp_nonce_field('ngg_addgallery') ?>
398
+ <table class="form-table">
399
+ <tr valign="top">
400
+ <th scope="row"><?php _e('New Gallery', 'nggallery') ;?>:</th>
401
+ <td><input type="text" size="35" name="galleryname" value="" /><br />
402
+ <?php if(!is_multisite()) { ?>
403
+ <?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $this->defaultpath ?></strong><br />
404
+ <?php } ?>
405
+ <i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i></td>
406
+ </tr>
407
+ <?php do_action('ngg_add_new_gallery_form'); ?>
408
+ </table>
409
+ <div class="submit"><input class="button-primary" type="submit" name= "addgallery" value="<?php _e('Add gallery', 'nggallery') ;?>"/></div>
410
+ </form>
411
+ <?php
412
+ }
413
+
414
+ function tab_zipupload() {
415
+ ?>
416
+ <!-- zip-file operation -->
417
+ <h2><?php _e('Upload a Zip-File', 'nggallery') ;?></h2>
418
+ <form name="zipupload" id="zipupload_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#zipupload'; ?>" accept-charset="utf-8" >
419
+ <?php wp_nonce_field('ngg_addgallery') ?>
420
+ <table class="form-table">
421
+ <tr valign="top">
422
+ <th scope="row"><?php _e('Select Zip-File', 'nggallery') ;?>:</th>
423
+ <td><input type="file" name="zipfile" id="zipfile" size="35" class="uploadform"/><br />
424
+ <?php _e('Upload a zip file with images', 'nggallery') ;?></td>
425
+ </tr>
426
+ <?php if (function_exists('curl_init')) : ?>
427
+ <tr valign="top">
428
+ <th scope="row"><?php _e('or enter a Zip-File URL', 'nggallery') ;?>:</th>
429
+ <td><input type="text" name="zipurl" id="zipurl" size="35" class="uploadform"/><br />
430
+ <?php _e('Import a zip file with images from a url', 'nggallery') ;?></td>
431
+ </tr>
432
+ <?php endif; ?>
433
+ <tr valign="top">
434
+ <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
435
+ <td><select name="zipgalselect">
436
+ <option value="0" ><?php _e('a new gallery', 'nggallery') ?></option>
437
+ <?php
438
+ foreach($this->gallerylist as $gallery) {
439
+ if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
440
+ continue;
441
+ $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
442
+ echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr( $name ). '</option>' . "\n";
443
+ }
444
+ ?>
445
+ </select>
446
+ <br /><?php echo $this->maxsize; ?>
447
+ <br /><?php echo _e('Note : The upload limit on your server is ','nggallery') . "<strong>" . ini_get('upload_max_filesize') . "Byte</strong>\n"; ?>
448
+ <br /><?php if ( (is_multisite()) && wpmu_enable_function('wpmuQuotaCheck') ) display_space_usage(); ?></td>
449
+ </tr>
450
+ </table>
451
+ <div class="submit"><input class="button-primary" type="submit" name= "zipupload" value="<?php _e('Start upload', 'nggallery') ;?>"/></div>
452
+ </form>
453
+ <?php
454
+ }
455
+
456
+ function tab_importfolder() {
457
+ ?>
458
+ <!-- import folder -->
459
+ <h2><?php _e('Import image folder', 'nggallery') ;?></h2>
460
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $this->filepath.'#importfolder'; ?>" accept-charset="utf-8" >
461
+ <?php wp_nonce_field('ngg_addgallery') ?>
462
+ <table class="form-table">
463
+ <tr valign="top">
464
+ <th scope="row"><?php _e('Import from Server path:', 'nggallery') ;?></th>
465
+ <td><input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $this->defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...', 'nggallery'); ?></span><br />
466
+ <div id="file_browser"></div>
467
+ <br /><i>( <?php _e('Note : Change the default path in the gallery settings', 'nggallery') ;?> )</i>
468
+ <br /><?php echo $this->maxsize; ?>
469
+ <?php if (SAFE_MODE) {?><br /><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'nggallery') ;?><?php }; ?></td>
470
+ </tr>
471
+ </table>
472
+ <div class="submit"><input class="button-primary" type="submit" name= "importfolder" value="<?php _e('Import folder', 'nggallery') ;?>"/></div>
473
+ </form>
474
+ <?php
475
+ }
476
+
477
+ function tab_uploadimage() {
478
+ global $ngg;
479
+ // check the cookie for the current setting
480
+ $checked = get_user_setting('ngg_upload_resize') ? ' checked="true"' : '';
481
+ ?>
482
+ <!-- upload images -->
483
+ <h2><?php _e('Upload Images', 'nggallery') ;?></h2>
484
+ <form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath.'#uploadimage'; ?>" accept-charset="utf-8" >
485
+ <?php wp_nonce_field('ngg_addgallery') ?>
486
+ <table class="form-table">
487
+
488
+ <tr valign="top">
489
+ <th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
490
+ <?php if ($ngg->options['swfUpload'] && defined('IS_WP_3_3') ) { ?>
491
+ <td>
492
+ <div id="plupload-upload-ui">
493
+ <div>
494
+ <?php _e( 'Choose files to upload' ); ?>
495
+ <input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" />
496
+ </div>
497
+ <p class="ngg-dragdrop-info howto" style="display:none;" ><?php _e('Or you can drop the files into this window.'); ?></p>
498
+ <div id='uploadQueue'></div>
499
+ <p><label><input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> />
500
+ <?php printf( __( 'Scale images to max width %1$dpx or max height %2$dpx', 'nggallery' ), (int) $ngg->options['imgWidth' ], (int) $ngg->options[ 'imgHeight' ] ); ?>
501
+ <div id='image_resize_pointer'>&nbsp;</div>
502
+ </label>
503
+ </p>
504
+
505
+ </div>
506
+ </td>
507
+ <?php } else { ?>
508
+ <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
509
+ <?php } ?>
510
+ </tr>
511
+ <tr valign="top">
512
+ <th scope="row"><?php _e('in to', 'nggallery') ;?></th>
513
+ <td><select name="galleryselect" id="galleryselect">
514
+ <option value="0" ><?php _e('Choose gallery', 'nggallery') ?></option>
515
+ <?php
516
+ foreach($this->gallerylist as $gallery) {
517
+
518
+ //special case : we check if a user has this cap, then we override the second cap check
519
+ if ( !current_user_can( 'NextGEN Upload in all galleries' ) )
520
+ if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
521
+ continue;
522
+
523
+ $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
524
+ echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr( $name ) . '</option>' . "\n";
525
+ } ?>
526
+ </select>
527
+ <br /><?php echo $this->maxsize; ?>
528
+ <br /><?php if ((is_multisite()) && wpmu_enable_function('wpmuQuotaCheck')) display_space_usage(); ?></td>
529
+ </tr>
530
+ </table>
531
+ <div class="submit">
532
+ <?php if ($ngg->options['swfUpload']) { ?>
533
+ <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload requires Adobe Flash 10, disable it if you have problems','nggallery') ?>" value="<?php _e('Disable flash upload', 'nggallery') ;?>" />
534
+ <?php } else { ?>
535
+ <input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog','nggallery') ?>" value="<?php _e('Enable flash based upload', 'nggallery') ;?>" />
536
+ <?php } ?>
537
+ <input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'nggallery') ;?>" />
538
+ </div>
539
+ </form>
540
+ <?php
541
+ }
542
+ }
543
+ ?>
admin/admin.php CHANGED
@@ -1,529 +1,477 @@
1
- <?php
2
- /**
3
- * nggAdminPanel - Admin Section for NextGEN Gallery
4
- *
5
- * @package NextGEN Gallery
6
- * @author Alex Rabe
7
- * @copyright 2008-2011
8
- * @since 1.0.0
9
- */
10
- class nggAdminPanel{
11
-
12
- // constructor
13
- function __construct() {
14
-
15
- // Add the admin menu
16
- add_action( 'admin_menu', array (&$this, 'add_menu') );
17
- add_action( 'admin_bar_menu', array(&$this, 'admin_bar_menu'), 99 );
18
- add_action( 'network_admin_menu', array (&$this, 'add_network_admin_menu') );
19
-
20
- // Add the script and style files
21
- add_action('admin_print_scripts', array(&$this, 'load_scripts') );
22
- add_action('admin_print_styles', array(&$this, 'load_styles') );
23
-
24
- //TODO: remove after release of Wordpress 3.3
25
- add_filter('contextual_help', array(&$this, 'show_help'), 10, 2);
26
- add_filter('current_screen', array(&$this, 'edit_current_screen'));
27
-
28
- // Add WPML hook to register description / alt text for translation
29
- add_action('ngg_image_updated', array('nggGallery', 'RegisterString') );
30
-
31
- }
32
-
33
- // integrate the menu
34
- function add_menu() {
35
-
36
- add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'), 'div' );
37
- add_submenu_page( NGGFOLDER , __('Overview', 'nggallery'), __('Overview', 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'));
38
- add_submenu_page( NGGFOLDER , __('Add Gallery / Images', 'nggallery'), __('Add Gallery / Images', 'nggallery'), 'NextGEN Upload images', 'nggallery-add-gallery', array (&$this, 'show_menu'));
39
- add_submenu_page( NGGFOLDER , __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'NextGEN Manage gallery', 'nggallery-manage-gallery', array (&$this, 'show_menu'));
40
- add_submenu_page( NGGFOLDER , _n( 'Album', 'Albums', 1, 'nggallery' ), _n( 'Album', 'Albums', 1, 'nggallery' ), 'NextGEN Edit album', 'nggallery-manage-album', array (&$this, 'show_menu'));
41
- add_submenu_page( NGGFOLDER , __('Tags', 'nggallery'), __('Tags', 'nggallery'), 'NextGEN Manage tags', 'nggallery-tags', array (&$this, 'show_menu'));
42
- add_submenu_page( NGGFOLDER , __('Options', 'nggallery'), __('Options', 'nggallery'), 'NextGEN Change options', 'nggallery-options', array (&$this, 'show_menu'));
43
- if ( wpmu_enable_function('wpmuStyle') )
44
- add_submenu_page( NGGFOLDER , __('Style', 'nggallery'), __('Style', 'nggallery'), 'NextGEN Change style', 'nggallery-style', array (&$this, 'show_menu'));
45
- if ( wpmu_enable_function('wpmuRoles') || wpmu_site_admin() )
46
- add_submenu_page( NGGFOLDER , __('Roles', 'nggallery'), __('Roles', 'nggallery'), 'activate_plugins', 'nggallery-roles', array (&$this, 'show_menu'));
47
- add_submenu_page( NGGFOLDER , __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'NextGEN Gallery overview', 'nggallery-about', array (&$this, 'show_menu'));
48
-
49
- if ( !is_multisite() || wpmu_site_admin() )
50
- add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
51
-
52
- //register the column fields
53
- $this->register_columns();
54
- }
55
-
56
- // integrate the network menu
57
- function add_network_admin_menu() {
58
-
59
- add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'), 'div' );
60
- add_submenu_page( NGGFOLDER , __('Network settings', 'nggallery'), __('Network settings', 'nggallery'), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'));
61
- add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
62
- }
63
-
64
- /**
65
- * Adding NextGEN Gallery to the Admin bar
66
- *
67
- * @since 1.9.0
68
- *
69
- * @return void
70
- */
71
- function admin_bar_menu() {
72
- // If the current user can't write posts, this is all of no use, so let's not output an admin menu
73
- if ( !current_user_can('NextGEN Gallery overview') )
74
- return;
75
-
76
- global $wp_admin_bar;
77
-
78
- $wp_admin_bar->add_menu( array( 'id' => 'ngg-menu', 'title' => __( 'Gallery' ), 'href' => admin_url('admin.php?page='. NGGFOLDER) ) );
79
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-overview', 'title' => __('Overview', 'nggallery'), 'href' => admin_url('admin.php?page='. NGGFOLDER) ) );
80
- if ( current_user_can('NextGEN Upload images') )
81
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-add-gallery', 'title' => __('Add Gallery / Images', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-add-gallery') ) );
82
- if ( current_user_can('NextGEN Manage gallery') )
83
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-gallery', 'title' => __('Manage Gallery', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-manage-gallery') ) );
84
- if ( current_user_can('NextGEN Edit album') )
85
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-album', 'title' => _n( 'Album', 'Albums', 1, 'nggallery' ), 'href' => admin_url('admin.php?page=nggallery-manage-album') ) );
86
- if ( current_user_can('NextGEN Manage tags') )
87
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-tags', 'title' => __('Tags', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-tags') ) );
88
- if ( current_user_can('NextGEN Change options') )
89
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-options', 'title' => __('Options', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-options') ) );
90
- if ( wpmu_enable_function('wpmuStyle') && ( current_user_can('NextGEN Change style') ))
91
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-style', 'title' => __('Style', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-style') ) );
92
- $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-about', 'title' => __('About', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-about') ) );
93
- }
94
-
95
- // show the network page
96
- function show_network_settings() {
97
- include_once ( dirname (__FILE__) . '/style.php' );
98
- include_once ( dirname (__FILE__) . '/wpmu.php' );
99
- nggallery_wpmu_setup();
100
- }
101
-
102
- // load the script for the defined page and load only this code
103
- function show_menu() {
104
-
105
- global $ngg;
106
-
107
- // check for upgrade and show upgrade screen
108
- if( get_option( 'ngg_db_version' ) != NGG_DBVERSION ) {
109
- include_once ( dirname (__FILE__) . '/functions.php' );
110
- include_once ( dirname (__FILE__) . '/upgrade.php' );
111
- nggallery_upgrade_page();
112
- return;
113
- }
114
-
115
- // Set installation date
116
- if( empty($ngg->options['installDate']) ) {
117
- $ngg->options['installDate'] = time();
118
- update_option('ngg_options', $ngg->options);
119
- }
120
-
121
- // Show donation message only one time.
122
- if (isset ( $_GET['hide_donation']) ) {
123
- $ngg->options['hideDonation'] = true;
124
- update_option('ngg_options', $ngg->options);
125
- }
126
-
127
- if( !isset ( $ngg->options['hideDonation']) || $ngg->options['hideDonation'] !== true ) {
128
- if ( time() > ( $ngg->options['installDate'] + ( 60 * 60 * 24 * 30 ) ) ) {
129
- ?>
130
- <div id="donator_message">
131
- <p><?php echo str_replace('%s', 'http://alexrabe.de/donation', __('Thanks for using this plugin, I hope you are satisfied ! If you would like to support the further development, please consider a <strong><a href="%s">donation</a></strong>! If you still need some help, please post your questions <a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10">here</a> .', 'nggallery')); ?>
132
- <span>
133
- <a href="<?php echo add_query_arg( array( 'hide_donation' => 'true') ); ?>" >
134
- <small><?php _e('OK, hide this message now !', 'nggallery'); ?></small>
135
- </a>
136
- <span>
137
- </p>
138
- </div>
139
- <?php
140
- }
141
- }
142
-
143
- switch ($_GET['page']){
144
- case "nggallery-add-gallery" :
145
- include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
146
- include_once ( dirname (__FILE__) . '/addgallery.php' ); // nggallery_admin_add_gallery
147
- $ngg->addgallery_page = new nggAddGallery ();
148
- $ngg->addgallery_page->controller();
149
- break;
150
- case "nggallery-manage-gallery" :
151
- include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
152
- include_once ( dirname (__FILE__) . '/manage.php' ); // nggallery_admin_manage_gallery
153
- // Initate the Manage Gallery page
154
- $ngg->manage_page = new nggManageGallery ();
155
- // Render the output now, because you cannot access a object during the constructor is not finished
156
- $ngg->manage_page->controller();
157
- break;
158
- case "nggallery-manage-album" :
159
- include_once ( dirname (__FILE__) . '/album.php' ); // nggallery_admin_manage_album
160
- $ngg->manage_album = new nggManageAlbum ();
161
- $ngg->manage_album->controller();
162
- break;
163
- case "nggallery-options" :
164
- include_once ( dirname (__FILE__) . '/settings.php' ); // nggallery_admin_options
165
- $ngg->option_page = new nggOptions ();
166
- $ngg->option_page->controller();
167
- break;
168
- case "nggallery-tags" :
169
- include_once ( dirname (__FILE__) . '/tags.php' ); // nggallery_admin_tags
170
- break;
171
- case "nggallery-style" :
172
- include_once ( dirname (__FILE__) . '/style.php' ); // nggallery_admin_style
173
- nggallery_admin_style();
174
- break;
175
- case "nggallery-setup" :
176
- include_once ( dirname (__FILE__) . '/setup.php' ); // nggallery_admin_setup
177
- nggallery_admin_setup();
178
- break;
179
- case "nggallery-roles" :
180
- include_once ( dirname (__FILE__) . '/roles.php' ); // nggallery_admin_roles
181
- nggallery_admin_roles();
182
- break;
183
- case "nggallery-import" :
184
- include_once ( dirname (__FILE__) . '/myimport.php' ); // nggallery_admin_import
185
- nggallery_admin_import();
186
- break;
187
- case "nggallery-about" :
188
- include_once ( dirname (__FILE__) . '/about.php' ); // nggallery_admin_about
189
- nggallery_admin_about();
190
- break;
191
- case "nggallery" :
192
- default :
193
- include_once ( dirname (__FILE__) . '/overview.php' ); // nggallery_admin_overview
194
- nggallery_admin_overview();
195
- break;
196
- }
197
- }
198
-
199
- function load_scripts() {
200
- global $wp_version;
201
-
202
- // no need to go on if it's not a plugin page
203
- if( !isset($_GET['page']) )
204
- return;
205
-
206
- wp_register_script('ngg-ajax', NGGALLERY_URLPATH . 'admin/js/ngg.ajax.js', array('jquery'), '1.4.1');
207
- wp_localize_script('ngg-ajax', 'nggAjaxSetup', array(
208
- 'url' => admin_url('admin-ajax.php'),
209
- 'action' => 'ngg_ajax_operation',
210
- 'operation' => '',
211
- 'nonce' => wp_create_nonce( 'ngg-ajax' ),
212
- 'ids' => '',
213
- 'permission' => __('You do not have the correct permission', 'nggallery'),
214
- 'error' => __('Unexpected Error', 'nggallery'),
215
- 'failure' => __('A failure occurred', 'nggallery')
216
- ) );
217
- wp_register_script( 'ngg-plupload-handler', NGGALLERY_URLPATH .'admin/js/plupload.handler.js', array('plupload-all'), '0.0.1' );
218
- wp_localize_script( 'ngg-plupload-handler', 'pluploadL10n', array(
219
- 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
220
- 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'),
221
- 'zero_byte_file' => __('This file is empty. Please try another.'),
222
- 'invalid_filetype' => __('This file type is not allowed. Please try another.'),
223
- 'not_an_image' => __('This file is not an image. Please try another.'),
224
- 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
225
- 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
226
- 'default_error' => __('An error occurred in the upload. Please try again later.'),
227
- 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
228
- 'upload_limit_exceeded' => __('You may only upload 1 file.'),
229
- 'http_error' => __('HTTP error.'),
230
- 'upload_failed' => __('Upload failed.'),
231
- 'io_error' => __('IO error.'),
232
- 'security_error' => __('Security error.'),
233
- 'file_cancelled' => __('File canceled.'),
234
- 'upload_stopped' => __('Upload stopped.'),
235
- 'dismiss' => __('Dismiss'),
236
- 'crunching' => __('Crunching&hellip;'),
237
- 'deleted' => __('moved to the trash.'),
238
- 'error_uploading' => __('&#8220;%s&#8221; has failed to upload due to an error')
239
- ) );
240
- wp_register_script('ngg-progressbar', NGGALLERY_URLPATH .'admin/js/ngg.progressbar.js', array('jquery'), '2.0.1');
241
- wp_register_script('jquery-ui-autocomplete', NGGALLERY_URLPATH .'admin/js/jquery.ui.autocomplete.min.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.15');
242
- wp_register_script('swfupload_f10', NGGALLERY_URLPATH .'admin/js/swfupload.js', array('jquery'), '2.2.0');
243
-
244
- switch ($_GET['page']) {
245
- case NGGFOLDER :
246
- wp_enqueue_script( 'postbox' );
247
- add_thickbox();
248
- break;
249
- case "nggallery-manage-gallery" :
250
- wp_enqueue_script( 'postbox' );
251
- wp_enqueue_script( 'ngg-ajax' );
252
- wp_enqueue_script( 'ngg-progressbar' );
253
- wp_enqueue_script( 'jquery-ui-dialog' );
254
- wp_register_script('shutter', NGGALLERY_URLPATH .'shutter/shutter-reloaded.js', false ,'1.3.2');
255
- wp_localize_script('shutter', 'shutterSettings', array(
256
- 'msgLoading' => __('L O A D I N G', 'nggallery'),
257
- 'msgClose' => __('Click to Close', 'nggallery'),
258
- 'imageCount' => '1'
259
- ) );
260
- wp_enqueue_script( 'shutter' );
261
- break;
262
- case "nggallery-manage-album" :
263
- wp_enqueue_script( 'jquery-ui-autocomplete' );
264
- wp_enqueue_script( 'jquery-ui-dialog' );
265
- wp_enqueue_script( 'jquery-ui-sortable' );
266
- wp_enqueue_script( 'ngg-autocomplete', NGGALLERY_URLPATH .'admin/js/ngg.autocomplete.js', array('jquery-ui-autocomplete'), '1.0.1');
267
- break;
268
- case "nggallery-options" :
269
- wp_enqueue_script( 'jquery-ui-tabs' );
270
- //wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
271
- break;
272
- case "nggallery-add-gallery" :
273
- wp_enqueue_script( 'jquery-ui-tabs' );
274
- wp_enqueue_script( 'multifile', NGGALLERY_URLPATH .'admin/js/jquery.MultiFile.js', array('jquery'), '1.4.4' );
275
- if ( defined('IS_WP_3_3') )
276
- wp_enqueue_script( 'ngg-plupload-handler' );
277
- else
278
- wp_enqueue_script( 'ngg-swfupload-handler', NGGALLERY_URLPATH .'admin/js/swfupload.handler.js', array('swfupload_f10'), '1.0.3' );
279
- wp_enqueue_script( 'ngg-ajax' );
280
- wp_enqueue_script( 'ngg-progressbar' );
281
- wp_enqueue_script( 'jquery-ui-dialog' );
282
- wp_enqueue_script( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.js', array('jquery'), '1.0.1' );
283
- break;
284
- case "nggallery-style" :
285
- wp_enqueue_script( 'codepress' );
286
- wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
287
- break;
288
-
289
- }
290
- }
291
-
292
- function load_styles() {
293
- // load the icon for the navigation menu
294
- wp_enqueue_style( 'nggmenu', NGGALLERY_URLPATH .'admin/css/menu.css', array() );
295
- wp_register_style( 'nggadmin', NGGALLERY_URLPATH .'admin/css/nggadmin.css', false, '2.8.1', 'screen' );
296
- wp_register_style( 'ngg-jqueryui', NGGALLERY_URLPATH .'admin/css/jquery.ui.css', false, '1.8.5', 'screen' );
297
-
298
- // no need to go on if it's not a plugin page
299
- if( !isset($_GET['page']) )
300
- return;
301
-
302
- switch ($_GET['page']) {
303
- case NGGFOLDER :
304
- wp_enqueue_style( 'thickbox' );
305
- case "nggallery-about" :
306
- wp_enqueue_style( 'nggadmin' );
307
- //TODO:Remove after WP 3.3 release
308
- if ( !defined('IS_WP_3_3') )
309
- wp_admin_css( 'css/dashboard' );
310
- break;
311
- case "nggallery-add-gallery" :
312
- wp_enqueue_style( 'ngg-jqueryui' );
313
- wp_enqueue_style( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.css', false, '1.0.1', 'screen' );
314
- case "nggallery-options" :
315
- wp_enqueue_style( 'nggtabs', NGGALLERY_URLPATH .'admin/css/jquery.ui.tabs.css', false, '2.5.0', 'screen' );
316
- wp_enqueue_style( 'nggadmin' );
317
- break;
318
- case "nggallery-manage-gallery" :
319
- wp_enqueue_style('shutter', NGGALLERY_URLPATH .'shutter/shutter-reloaded.css', false, '1.3.2', 'screen');
320
- case "nggallery-roles" :
321
- case "nggallery-manage-album" :
322
- wp_enqueue_style( 'ngg-jqueryui' );
323
- wp_enqueue_style( 'nggadmin' );
324
- break;
325
- case "nggallery-tags" :
326
- wp_enqueue_style( 'nggtags', NGGALLERY_URLPATH .'admin/css/tags-admin.css', false, '2.6.1', 'screen' );
327
- break;
328
- case "nggallery-style" :
329
- wp_admin_css( 'css/theme-editor' );
330
- wp_enqueue_style('nggcolorpicker', NGGALLERY_URLPATH.'admin/js/colorpicker/css/colorpicker.css', false, '1.0', 'screen');
331
- wp_enqueue_style('nggadmincp', NGGALLERY_URLPATH.'admin/css/nggColorPicker.css', false, '1.0', 'screen');
332
- break;
333
- }
334
- }
335
-
336
- function show_help($help, $screen) {
337
-
338
- // since WP3.0 it's an object
339
- if ( is_object($screen) )
340
- $screen = $screen->id;
341
-
342
- $link = '';
343
- // menu title is localized...
344
- $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
345
-
346
- switch ($screen) {
347
- case 'toplevel_page_' . NGGFOLDER :
348
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Introduction</a>', 'nggallery');
349
- break;
350
- case "{$i18n}_page_nggallery-setup" :
351
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Setup</a>', 'nggallery');
352
- break;
353
- case "{$i18n}_page_nggallery-about" :
354
- $link = __('<a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/languages/" target="_blank">Translation by alex rabe</a>', 'nggallery');
355
- break;
356
- case "{$i18n}_page_nggallery-roles" :
357
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Roles / Capabilities</a>', 'nggallery');
358
- break;
359
- case "{$i18n}_page_nggallery-style" :
360
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Styles</a>', 'nggallery');
361
- $link .= ' | <a href="http://nextgen-gallery.com/templates/" target="_blank">' . __('Templates', 'nggallery') . '</a>';
362
- break;
363
- case "{$i18n}_page_nggallery-gallery" :
364
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery management</a>', 'nggallery');
365
- $link .= ' | <a href="http://nextgen-gallery.com/gallery-page/" target="_blank">' . __('Gallery example', 'nggallery') . '</a>';
366
- break;
367
- case "{$i18n}_page_nggallery-manage-gallery" :
368
- case "nggallery-manage-gallery":
369
- case "nggallery-manage-images":
370
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery management</a>', 'nggallery');
371
- $link .= ' | <a href="http://nextgen-gallery.com/gallery-tags/" target="_blank">' . __('Gallery tags', 'nggallery') . '</a>';
372
- break;
373
- case "{$i18n}_page_nggallery-manage-album" :
374
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Album management</a>', 'nggallery');
375
- $link .= ' | <a href="http://nextgen-gallery.com/album/" target="_blank">' . __('Album example', 'nggallery') . '</a>';
376
- $link .= ' | <a href="http://nextgen-gallery.com/albumtags/" target="_blank">' . __('Album tags', 'nggallery') . '</a>';
377
- break;
378
- case "{$i18n}_page_nggallery-tags" :
379
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-introduction/" target="_blank">Gallery tags</a>', 'nggallery');
380
- $link .= ' | <a href="http://nextgen-gallery.com/related-images/" target="_blank">' . __('Related images', 'nggallery') . '</a>';
381
- $link .= ' | <a href="http://nextgen-gallery.com/gallery-tags/" target="_blank">' . __('Gallery tags', 'nggallery') . '</a>';
382
- $link .= ' | <a href="http://nextgen-gallery.com/albumtags/" target="_blank">' . __('Album tags', 'nggallery') . '</a>';
383
- break;
384
- case "{$i18n}_page_nggallery-options" :
385
- $link = __('<a href="http://dpotter.net/Technical/2008/03/nextgen-gallery-review-image-management/" target="_blank">Image management</a>', 'nggallery');
386
- $link .= ' | <a href="http://nextgen-gallery.com/custom-fields/" target="_blank">' . __('Custom fields', 'nggallery') . '</a>';
387
- break;
388
- }
389
-
390
- if ( !empty($link) ) {
391
- $help = '<h5>' . __('Get help with NextGEN Gallery', 'nggallery') . '</h5>';
392
- $help .= '<div class="metabox-prefs">';
393
- $help .= $link;
394
- $help .= "</div>\n";
395
- $help .= '<h5>' . __('More Help & Info', 'nggallery') . '</h5>';
396
- $help .= '<div class="metabox-prefs">';
397
- $help .= __('<a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10" target="_blank">Support Forums</a>', 'nggallery');
398
- $help .= ' | <a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/faq/" target="_blank">' . __('FAQ', 'nggallery') . '</a>';
399
- $help .= ' | <a href="http://code.google.com/p/nextgen-gallery/issues/list" target="_blank">' . __('Feature request', 'nggallery') . '</a>';
400
- $help .= ' | <a href="http://alexrabe.de/wordpress-plugins/nextgen-gallery/languages/" target="_blank">' . __('Get your language pack', 'nggallery') . '</a>';
401
- $help .= ' | <a href="http://code.google.com/p/nextgen-gallery/" target="_blank">' . __('Contribute development', 'nggallery') . '</a>';
402
- $help .= ' | <a href="http://wordpress.org/extend/plugins/nextgen-gallery" target="_blank">' . __('Download latest version', 'nggallery') . '</a>';
403
- $help .= "</div>\n";
404
- }
405
-
406
- return $help;
407
- }
408
-
409
- /**
410
- * New wrapper for WordPress 3.3, so contextual help will be added to the admin bar
411
- * Rework this see http://wpdevel.wordpress.com/2011/12/06/help-and-screen-api-changes-in-3-3/
412
- *
413
- * @since 1.9.0
414
- * @param object $screen
415
- * @return void
416
- */
417
- function add_contextual_help($screen) {
418
-
419
- $help = $this->show_help('', $screen);
420
- //add_contextual_help( $screen, $help );
421
- }
422
-
423
- /**
424
- * We need to manipulate the current_screen name so that we can show the correct column screen options
425
- *
426
- * @since 1.8.0
427
- * @param object $screen
428
- * @return object $screen
429
- */
430
- function edit_current_screen($screen) {
431
-
432
- if ( is_string($screen) )
433
- $screen = convert_to_screen($screen);
434
-
435
- // menu title is localized, so we need to change the toplevel name
436
- $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
437
-
438
- switch ($screen->id) {
439
- case "{$i18n}_page_nggallery-manage-gallery" :
440
- // we would like to have screen option only at the manage images / gallery page
441
- if ( isset ($_POST['sortGallery']) )
442
- $screen = $screen;
443
- else if ( (isset($_GET['mode']) && $_GET['mode'] == 'edit') || isset ($_POST['backToGallery']) )
444
- $screen->base = $screen->id = 'nggallery-manage-images';
445
- else if ( (isset($_GET['mode']) && $_GET['mode'] == 'sort') )
446
- $screen = $screen;
447
- else
448
- $screen->base = $screen->id = 'nggallery-manage-gallery';
449
- break;
450
- }
451
-
452
- if ( defined('IS_WP_3_3') )
453
- $this->add_contextual_help($screen);
454
-
455
- return $screen;
456
- }
457
-
458
- /**
459
- * We need to register the columns at a very early point
460
- *
461
- * @return void
462
- */
463
- function register_columns() {
464
- include_once ( dirname (__FILE__) . '/manage-images.php' );
465
-
466
- $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
467
-
468
- include_once ( dirname (__FILE__) . '/manage-galleries.php' );
469
-
470
- $wp_list_table = new _NGG_Galleries_List_Table('nggallery-manage-gallery');
471
- }
472
-
473
- /**
474
- * Read an array from a remote url
475
- *
476
- * @param string $url
477
- * @return array of the content
478
- */
479
- function get_remote_array($url) {
480
-
481
- if ( function_exists('wp_remote_request') ) {
482
-
483
- if ( false === ( $content = get_transient( 'ngg_request_' . md5($url) ) ) ) {
484
-
485
- $options = array();
486
- $options['headers'] = array(
487
- 'User-Agent' => 'NextGEN Gallery Information Reader V' . NGGVERSION . '; (' . get_bloginfo('url') .')'
488
- );
489
-
490
- $response = wp_remote_request($url, $options);
491
-
492
- if ( is_wp_error( $response ) )
493
- return false;
494
-
495
- if ( 200 != $response['response']['code'] )
496
- return false;
497
-
498
- $content = $response['body'];
499
- set_transient( 'ngg_request_' . md5($url), $content, 60*60*48 );
500
- }
501
-
502
- $content = unserialize($content);
503
-
504
- if (is_array($content))
505
- return $content;
506
- }
507
-
508
- return false;
509
- }
510
-
511
- }
512
-
513
- function wpmu_site_admin() {
514
- // Check for site admin
515
- if ( function_exists('is_super_admin') )
516
- if ( is_super_admin() )
517
- return true;
518
-
519
- return false;
520
- }
521
-
522
- function wpmu_enable_function($value) {
523
- if (is_multisite()) {
524
- $ngg_options = get_site_option('ngg_options');
525
- return $ngg_options[$value];
526
- }
527
- // if this is not WPMU, enable it !
528
- return true;
529
- }
1
+ <?php
2
+ /**
3
+ * nggAdminPanel - Admin Section for NextGEN Gallery
4
+ *
5
+ * @package NextGEN Gallery
6
+ * @author Alex Rabe
7
+ *
8
+ * @since 1.0.0
9
+ */
10
+ class nggAdminPanel{
11
+
12
+ // constructor
13
+ function __construct() {
14
+
15
+ // Add the admin menu
16
+ add_action( 'admin_menu', array (&$this, 'add_menu') );
17
+ add_action( 'admin_bar_menu', array(&$this, 'admin_bar_menu'), 99 );
18
+ add_action( 'network_admin_menu', array (&$this, 'add_network_admin_menu') );
19
+
20
+ // Add the script and style files
21
+ add_action('admin_print_scripts', array(&$this, 'load_scripts') );
22
+ add_action('admin_print_styles', array(&$this, 'load_styles') );
23
+
24
+ //TODO: remove after release of Wordpress 3.3
25
+ add_filter('contextual_help', array(&$this, 'show_help'), 10, 2);
26
+ add_filter('current_screen', array(&$this, 'edit_current_screen'));
27
+
28
+ // Add WPML hook to register description / alt text for translation
29
+ add_action('ngg_image_updated', array('nggGallery', 'RegisterString') );
30
+
31
+ }
32
+
33
+ // integrate the menu
34
+ function add_menu() {
35
+
36
+ add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'), path_join(NGGALLERY_URLPATH, 'admin/images/nextgen_16_color.png') );
37
+ add_submenu_page( NGGFOLDER , __('Overview', 'nggallery'), __('Overview', 'nggallery'), 'NextGEN Gallery overview', NGGFOLDER, array (&$this, 'show_menu'));
38
+ add_submenu_page( NGGFOLDER , __('Add Gallery / Images', 'nggallery'), __('Add Gallery / Images', 'nggallery'), 'NextGEN Upload images', 'nggallery-add-gallery', array (&$this, 'show_menu'));
39
+ add_submenu_page( NGGFOLDER , __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'NextGEN Manage gallery', 'nggallery-manage-gallery', array (&$this, 'show_menu'));
40
+ add_submenu_page( NGGFOLDER , _n( 'Album', 'Albums', 1, 'nggallery' ), _n( 'Album', 'Albums', 1, 'nggallery' ), 'NextGEN Edit album', 'nggallery-manage-album', array (&$this, 'show_menu'));
41
+ add_submenu_page( NGGFOLDER , __('Tags', 'nggallery'), __('Tags', 'nggallery'), 'NextGEN Manage tags', 'nggallery-tags', array (&$this, 'show_menu'));
42
+ add_submenu_page( NGGFOLDER , __('Options', 'nggallery'), __('Options', 'nggallery'), 'NextGEN Change options', 'nggallery-options', array (&$this, 'show_menu'));
43
+ if ( wpmu_enable_function('wpmuStyle') )
44
+ add_submenu_page( NGGFOLDER , __('Style', 'nggallery'), __('Style', 'nggallery'), 'NextGEN Change style', 'nggallery-style', array (&$this, 'show_menu'));
45
+ if ( wpmu_enable_function('wpmuRoles') || wpmu_site_admin() )
46
+ add_submenu_page( NGGFOLDER , __('Roles', 'nggallery'), __('Roles', 'nggallery'), 'activate_plugins', 'nggallery-roles', array (&$this, 'show_menu'));
47
+ add_submenu_page( NGGFOLDER , __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'NextGEN Gallery overview', 'nggallery-about', array (&$this, 'show_menu'));
48
+
49
+ if ( !is_multisite() || wpmu_site_admin() )
50
+ add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
51
+
52
+ //register the column fields
53
+ $this->register_columns();
54
+ }
55
+
56
+ // integrate the network menu
57
+ function add_network_admin_menu() {
58
+
59
+ add_menu_page( _n( 'Gallery', 'Galleries', 1, 'nggallery' ), _n( 'Gallery', 'Galleries', 1, 'nggallery' ), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'), path_join(NGGALLERY_URLPATH, 'admin/images/nextgen_16_color.png') );
60
+ add_submenu_page( NGGFOLDER , __('Network settings', 'nggallery'), __('Network settings', 'nggallery'), 'nggallery-wpmu', NGGFOLDER, array (&$this, 'show_network_settings'));
61
+ add_submenu_page( NGGFOLDER , __('Reset / Uninstall', 'nggallery'), __('Reset / Uninstall', 'nggallery'), 'activate_plugins', 'nggallery-setup', array (&$this, 'show_menu'));
62
+ }
63
+
64
+ /**
65
+ * Adding NextGEN Gallery to the Admin bar
66
+ *
67
+ * @since 1.9.0
68
+ *
69
+ * @return void
70
+ */
71
+ function admin_bar_menu() {
72
+ // If the current user can't write posts, this is all of no use, so let's not output an admin menu
73
+ if ( !current_user_can('NextGEN Gallery overview') )
74
+ return;
75
+
76
+ global $wp_admin_bar;
77
+
78
+ $wp_admin_bar->add_menu( array( 'id' => 'ngg-menu', 'title' => __( 'Gallery' ), 'href' => admin_url('admin.php?page='. NGGFOLDER) ) );
79
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-overview', 'title' => __('Overview', 'nggallery'), 'href' => admin_url('admin.php?page='. NGGFOLDER) ) );
80
+ if ( current_user_can('NextGEN Upload images') )
81
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-add-gallery', 'title' => __('Add Gallery / Images', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-add-gallery') ) );
82
+ if ( current_user_can('NextGEN Manage gallery') )
83
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-gallery', 'title' => __('Manage Gallery', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-manage-gallery') ) );
84
+ if ( current_user_can('NextGEN Edit album') )
85
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-manage-album', 'title' => _n( 'Album', 'Albums', 1, 'nggallery' ), 'href' => admin_url('admin.php?page=nggallery-manage-album') ) );
86
+ if ( current_user_can('NextGEN Manage tags') )
87
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-tags', 'title' => __('Tags', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-tags') ) );
88
+ if ( current_user_can('NextGEN Change options') )
89
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-options', 'title' => __('Options', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-options') ) );
90
+ if ( wpmu_enable_function('wpmuStyle') && ( current_user_can('NextGEN Change style') ))
91
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-style', 'title' => __('Style', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-style') ) );
92
+ $wp_admin_bar->add_menu( array( 'parent' => 'ngg-menu', 'id' => 'ngg-menu-about', 'title' => __('About', 'nggallery'), 'href' => admin_url('admin.php?page=nggallery-about') ) );
93
+ }
94
+
95
+ // show the network page
96
+ function show_network_settings() {
97
+ include_once ( dirname (__FILE__) . '/style.php' );
98
+ include_once ( dirname (__FILE__) . '/wpmu.php' );
99
+ nggallery_wpmu_setup();
100
+ }
101
+
102
+ // load the script for the defined page and load only this code
103
+ function show_menu() {
104
+
105
+ global $ngg;
106
+
107
+ // check for upgrade and show upgrade screen
108
+ if( get_option( 'ngg_db_version' ) != NGG_DBVERSION ) {
109
+ include_once ( dirname (__FILE__) . '/functions.php' );
110
+ include_once ( dirname (__FILE__) . '/upgrade.php' );
111
+ nggallery_upgrade_page();
112
+ return;
113
+ }
114
+
115
+ // Set installation date
116
+ if( empty($ngg->options['installDate']) ) {
117
+ $ngg->options['installDate'] = time();
118
+ update_option('ngg_options', $ngg->options);
119
+ }
120
+
121
+ // Show donation message only one time.
122
+ if (isset ( $_GET['hide_donation']) ) {
123
+ $ngg->options['hideDonation'] = true;
124
+ update_option('ngg_options', $ngg->options);
125
+ }
126
+
127
+ switch ($_GET['page']){
128
+ case "nggallery-add-gallery" :
129
+ include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
130
+ include_once ( dirname (__FILE__) . '/addgallery.php' ); // nggallery_admin_add_gallery
131
+ $ngg->addgallery_page = new nggAddGallery ();
132
+ $ngg->addgallery_page->controller();
133
+ break;
134
+ case "nggallery-manage-gallery" :
135
+ include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
136
+ include_once ( dirname (__FILE__) . '/manage.php' ); // nggallery_admin_manage_gallery
137
+ // Initate the Manage Gallery page
138
+ $ngg->manage_page = new nggManageGallery ();
139
+ // Render the output now, because you cannot access a object during the constructor is not finished
140
+ $ngg->manage_page->controller();
141
+ break;
142
+ case "nggallery-manage-album" :
143
+ include_once ( dirname (__FILE__) . '/album.php' ); // nggallery_admin_manage_album
144
+ $ngg->manage_album = new nggManageAlbum ();
145
+ $ngg->manage_album->controller();
146
+ break;
147
+ case "nggallery-options" :
148
+ include_once ( dirname (__FILE__) . '/settings.php' ); // nggallery_admin_options
149
+ $ngg->option_page = new nggOptions ();
150
+ $ngg->option_page->controller();
151
+ break;
152
+ case "nggallery-tags" :
153
+ include_once ( dirname (__FILE__) . '/tags.php' ); // nggallery_admin_tags
154
+ break;
155
+ case "nggallery-style" :
156
+ include_once ( dirname (__FILE__) . '/style.php' ); // nggallery_admin_style
157
+ nggallery_admin_style();
158
+ break;
159
+ case "nggallery-setup" :
160
+ include_once ( dirname (__FILE__) . '/setup.php' ); // nggallery_admin_setup
161
+ nggallery_admin_setup();
162
+ break;
163
+ case "nggallery-roles" :
164
+ include_once ( dirname (__FILE__) . '/roles.php' ); // nggallery_admin_roles
165
+ nggallery_admin_roles();
166
+ break;
167
+ case "nggallery-import" :
168
+ include_once ( dirname (__FILE__) . '/myimport.php' ); // nggallery_admin_import
169
+ nggallery_admin_import();
170
+ break;
171
+ case "nggallery-about" :
172
+ include_once ( dirname (__FILE__) . '/about.php' ); // nggallery_admin_about
173
+ nggallery_admin_about();
174
+ break;
175
+ case "nggallery" :
176
+ default :
177
+ include_once ( dirname (__FILE__) . '/overview.php' ); // nggallery_admin_overview
178
+ nggallery_admin_overview();
179
+ break;
180
+ }
181
+ }
182
+
183
+ function load_scripts() {
184
+ global $wp_version;
185
+
186
+ // no need to go on if it's not a plugin page
187
+ if( !isset($_GET['page']) )
188
+ return;
189
+
190
+ wp_register_script('ngg-ajax', NGGALLERY_URLPATH . 'admin/js/ngg.ajax.js', array('jquery'), '1.4.1');
191
+ wp_localize_script('ngg-ajax', 'nggAjaxSetup', array(
192
+ 'url' => admin_url('admin-ajax.php'),
193
+ 'action' => 'ngg_ajax_operation',
194
+ 'operation' => '',
195
+ 'nonce' => wp_create_nonce( 'ngg-ajax' ),
196
+ 'ids' => '',
197
+ 'permission' => __('You do not have the correct permission', 'nggallery'),
198
+ 'error' => __('Unexpected Error', 'nggallery'),
199
+ 'failure' => __('A failure occurred', 'nggallery')
200
+ ) );
201
+ wp_register_script( 'ngg-plupload-handler', NGGALLERY_URLPATH .'admin/js/plupload.handler.js', array('plupload-all'), '0.0.1' );
202
+ wp_localize_script( 'ngg-plupload-handler', 'pluploadL10n', array(
203
+ 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
204
+ 'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'),
205
+ 'zero_byte_file' => __('This file is empty. Please try another.'),
206
+ 'invalid_filetype' => __('This file type is not allowed. Please try another.'),
207
+ 'not_an_image' => __('This file is not an image. Please try another.'),
208
+ 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
209
+ 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
210
+ 'default_error' => __('An error occurred in the upload. Please try again later.'),
211
+ 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
212
+ 'upload_limit_exceeded' => __('You may only upload 1 file.'),
213
+ 'http_error' => __('HTTP error.'),
214
+ 'upload_failed' => __('Upload failed.'),
215
+ 'io_error' => __('IO error.'),
216
+ 'security_error' => __('Security error.'),
217
+ 'file_cancelled' => __('File canceled.'),
218
+ 'upload_stopped' => __('Upload stopped.'),
219
+ 'dismiss' => __('Dismiss'),
220
+ 'crunching' => __('Crunching&hellip;'),
221
+ 'deleted' => __('moved to the trash.'),
222
+ 'error_uploading' => __('&#8220;%s&#8221; has failed to upload due to an error')
223
+ ) );
224
+ wp_register_script('ngg-progressbar', NGGALLERY_URLPATH .'admin/js/ngg.progressbar.js', array('jquery'), '2.0.1');
225
+ wp_register_script('jquery-ui-autocomplete', NGGALLERY_URLPATH .'admin/js/jquery.ui.autocomplete.min.js', array('jquery-ui-core', 'jquery-ui-widget'), '1.8.15');
226
+
227
+ switch ($_GET['page']) {
228
+ case NGGFOLDER :
229
+ wp_enqueue_script( 'postbox' );
230
+ add_thickbox();
231
+ break;
232
+ case "nggallery-manage-gallery" :
233
+ wp_enqueue_script( 'postbox' );
234
+ wp_enqueue_script( 'ngg-ajax' );
235
+ wp_enqueue_script( 'ngg-progressbar' );
236
+ wp_enqueue_script( 'jquery-ui-dialog' );
237
+ wp_register_script('shutter', NGGALLERY_URLPATH .'shutter/shutter-reloaded.js', false ,'1.3.2');
238
+ wp_localize_script('shutter', 'shutterSettings', array(
239
+ 'msgLoading' => __('L O A D I N G', 'nggallery'),
240
+ 'msgClose' => __('Click to Close', 'nggallery'),
241
+ 'imageCount' => '1'
242
+ ) );
243
+ wp_enqueue_script( 'shutter' );
244
+ break;
245
+ case "nggallery-manage-album" :
246
+ wp_enqueue_script( 'jquery-ui-autocomplete' );
247
+ wp_enqueue_script( 'jquery-ui-dialog' );
248
+ wp_enqueue_script( 'jquery-ui-sortable' );
249
+ wp_enqueue_script( 'ngg-autocomplete', NGGALLERY_URLPATH .'admin/js/ngg.autocomplete.js', array('jquery-ui-autocomplete'), '1.0.1');
250
+ break;
251
+ case "nggallery-options" :
252
+ wp_enqueue_script( 'jquery-ui-tabs' );
253
+ //wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
254
+ break;
255
+ case "nggallery-add-gallery" :
256
+ wp_enqueue_script( 'jquery-ui-tabs' );
257
+ wp_enqueue_script( 'multifile', NGGALLERY_URLPATH .'admin/js/jquery.MultiFile.js', array('jquery'), '1.4.4' );
258
+ if ( defined('IS_WP_3_3') )
259
+ wp_enqueue_script( 'ngg-plupload-handler' );
260
+ else
261
+ wp_enqueue_script( 'ngg-swfupload-handler', NGGALLERY_URLPATH .'admin/js/swfupload.handler.js', array('jquery', 'swfupload'), '1.0.3' );
262
+ wp_enqueue_script( 'ngg-ajax' );
263
+ wp_enqueue_script( 'ngg-progressbar' );
264
+ wp_enqueue_script( 'jquery-ui-dialog' );
265
+ wp_enqueue_script( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.js', array('jquery'), '1.0.1' );
266
+ break;
267
+ case "nggallery-style" :
268
+ wp_enqueue_script( 'codepress' );
269
+ wp_enqueue_script( 'ngg-colorpicker', NGGALLERY_URLPATH .'admin/js/colorpicker/js/colorpicker.js', array('jquery'), '1.0');
270
+ break;
271
+
272
+ }
273
+ }
274
+
275
+ function load_styles() {
276
+ // load the icon for the navigation menu
277
+ wp_enqueue_style( 'nggmenu', NGGALLERY_URLPATH .'admin/css/menu.css', array() );
278
+ wp_register_style( 'nggadmin', NGGALLERY_URLPATH .'admin/css/nggadmin.css', false, '2.8.1', 'screen' );
279
+ wp_register_style( 'ngg-jqueryui', NGGALLERY_URLPATH .'admin/css/jquery.ui.css', false, '1.8.5', 'screen' );
280
+
281
+ // no need to go on if it's not a plugin page
282
+ if( !isset($_GET['page']) )
283
+ return;
284
+
285
+ switch ($_GET['page']) {
286
+ case NGGFOLDER :
287
+ wp_enqueue_style( 'thickbox' );
288
+ case "nggallery-about" :
289
+ wp_enqueue_style( 'nggadmin' );
290
+ //TODO:Remove after WP 3.3 release
291
+ if ( !defined('IS_WP_3_3') )
292
+ wp_admin_css( 'css/dashboard' );
293
+ break;
294
+ case "nggallery-add-gallery" :
295
+ wp_enqueue_style( 'ngg-jqueryui' );
296
+ wp_enqueue_style( 'jqueryFileTree', NGGALLERY_URLPATH .'admin/js/jqueryFileTree/jqueryFileTree.css', false, '1.0.1', 'screen' );
297
+ case "nggallery-options" :
298
+ wp_enqueue_style( 'nggtabs', NGGALLERY_URLPATH .'admin/css/jquery.ui.tabs.css', false, '2.5.0', 'screen' );
299
+ wp_enqueue_style( 'nggadmin' );
300
+ break;
301
+ case "nggallery-manage-gallery" :
302
+ wp_enqueue_style('shutter', NGGALLERY_URLPATH .'shutter/shutter-reloaded.css', false, '1.3.2', 'screen');
303
+ case "nggallery-roles" :
304
+ case "nggallery-manage-album" :
305
+ wp_enqueue_style( 'ngg-jqueryui' );
306
+ wp_enqueue_style( 'nggadmin' );
307
+ break;
308
+ case "nggallery-tags" :
309
+ wp_enqueue_style( 'nggtags', NGGALLERY_URLPATH .'admin/css/tags-admin.css', false, '2.6.1', 'screen' );
310
+ break;
311
+ case "nggallery-style" :
312
+ wp_admin_css( 'css/theme-editor' );
313
+ wp_enqueue_style('nggcolorpicker', NGGALLERY_URLPATH.'admin/js/colorpicker/css/colorpicker.css', false, '1.0', 'screen');
314
+ wp_enqueue_style('nggadmincp', NGGALLERY_URLPATH.'admin/css/nggColorPicker.css', false, '1.0', 'screen');
315
+ break;
316
+ }
317
+ }
318
+
319
+ function show_help($help, $screen) {
320
+
321
+ // since WP3.0 it's an object
322
+ if ( is_object($screen) )
323
+ $screen = $screen->id;
324
+
325
+ $link = '';
326
+ // menu title is localized...
327
+ $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
328
+
329
+ switch ($screen) {
330
+ case 'toplevel_page_' . NGGFOLDER :
331
+ $link = __('<a href="http://www.nextgen-gallery.com" target="_blank">Introduction</a>', 'nggallery');
332
+ break;
333
+ case "{$i18n}_page_nggallery-about" :
334
+ $link = __('<a href="http://www.nextgen-gallery.com/languages" target="_blank">Languages</a>', 'nggallery');
335
+ break;
336
+ }
337
+
338
+ if ( !empty($link) ) {
339
+ $help = '<h5>' . __('Get help with NextGEN Gallery', 'nggallery') . '</h5>';
340
+ $help .= '<div class="metabox-prefs">';
341
+ $help .= $link;
342
+ $help .= "</div>\n";
343
+ $help .= '<h5>' . __('More Help & Info', 'nggallery') . '</h5>';
344
+ $help .= '<div class="metabox-prefs">';
345
+ $help .= __('<a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10" target="_blank">Support Forums</a>', 'nggallery');
346
+ $help .= ' | <a href="http://www.nextgen-gallery.com/faq/" target="_blank">' . __('FAQ', 'nggallery') . '</a>';
347
+ $help .= ' | <a href="https://bitbucket.org/photocrati/nextgen-gallery/issues" target="_blank">' . __('Feature request', 'nggallery') . '</a>';
348
+ $help .= ' | <a href="http://www.nextgen-gallery.com/languages" target="_blank">' . __('Get your language pack', 'nggallery') . '</a>';
349
+ $help .= ' | <a href="https://bitbucket.org/photocrati/nextgen-gallery" target="_blank">' . __('Contribute development', 'nggallery') . '</a>';
350
+ $help .= ' | <a href="http://wordpress.org/extend/plugins/nextgen-gallery" target="_blank">' . __('Download latest version', 'nggallery') . '</a>';
351
+ $help .= "</div>\n";
352
+ }
353
+
354
+ return $help;
355
+ }
356
+
357
+ /**
358
+ * New wrapper for WordPress 3.3, so contextual help will be added to the admin bar
359
+ * Rework this see http://wpdevel.wordpress.com/2011/12/06/help-and-screen-api-changes-in-3-3/
360
+ *
361
+ * @since 1.9.0
362
+ * @param object $screen
363
+ * @return void
364
+ */
365
+ function add_contextual_help($screen) {
366
+
367
+ $help = $this->show_help('', $screen);
368
+ //add_contextual_help( $screen, $help );
369
+ }
370
+
371
+ /**
372
+ * We need to manipulate the current_screen name so that we can show the correct column screen options
373
+ *
374
+ * @since 1.8.0
375
+ * @param object $screen
376
+ * @return object $screen
377
+ */
378
+ function edit_current_screen($screen) {
379
+
380
+ if ( is_string($screen) )
381
+ $screen = convert_to_screen($screen);
382
+
383
+ // menu title is localized, so we need to change the toplevel name
384
+ $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
385
+
386
+ switch ($screen->id) {
387
+ case "{$i18n}_page_nggallery-manage-gallery" :
388
+ // we would like to have screen option only at the manage images / gallery page
389
+ if ( isset ($_POST['sortGallery']) )
390
+ $screen = $screen;
391
+ else if ( (isset($_GET['mode']) && $_GET['mode'] == 'edit') || isset ($_POST['backToGallery']) )
392
+ $screen->base = $screen->id = 'nggallery-manage-images';
393
+ else if ( (isset($_GET['mode']) && $_GET['mode'] == 'sort') )
394
+ $screen = $screen;
395
+ else
396
+ $screen->base = $screen->id = 'nggallery-manage-gallery';
397
+ break;
398
+ }
399
+
400
+ if ( defined('IS_WP_3_3') )
401
+ $this->add_contextual_help($screen);
402
+
403
+ return $screen;
404
+ }
405
+
406
+ /**
407
+ * We need to register the columns at a very early point
408
+ *
409
+ * @return void
410
+ */
411
+ function register_columns() {
412
+ include_once ( dirname (__FILE__) . '/manage-images.php' );
413
+
414
+ $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
415
+
416
+ include_once ( dirname (__FILE__) . '/manage-galleries.php' );
417
+
418
+ $wp_list_table = new _NGG_Galleries_List_Table('nggallery-manage-gallery');
419
+ }
420
+
421
+ /**
422
+ * Read an array from a remote url
423
+ *
424
+ * @param string $url
425
+ * @return array of the content
426
+ */
427
+ function get_remote_array($url) {
428
+
429
+ if ( function_exists('wp_remote_request') ) {
430
+
431
+ if ( false === ( $content = get_transient( 'ngg_request_' . md5($url) ) ) ) {
432
+
433
+ $options = array();
434
+ $options['headers'] = array(
435
+ 'User-Agent' => 'NextGEN Gallery Information Reader V' . NGGVERSION . '; (' . get_bloginfo('url') .')'
436
+ );
437
+
438
+ $response = wp_remote_request($url, $options);
439
+
440
+ if ( is_wp_error( $response ) )
441
+ return false;
442
+
443
+ if ( 200 != $response['response']['code'] )
444
+ return false;
445
+
446
+ $content = $response['body'];
447
+ set_transient( 'ngg_request_' . md5($url), $content, 60*60*48 );
448
+ }
449
+
450
+ $content = unserialize($content);
451
+
452
+ if (is_array($content))
453
+ return $content;
454
+ }
455
+
456
+ return false;
457
+ }
458
+
459
+ }
460
+
461
+ function wpmu_site_admin() {
462
+ // Check for site admin
463
+ if ( function_exists('is_super_admin') )
464
+ if ( is_super_admin() )
465
+ return true;
466
+
467
+ return false;
468
+ }
469
+
470
+ function wpmu_enable_function($value) {
471
+ if (is_multisite()) {
472
+ $ngg_options = get_site_option('ngg_options');
473
+ return $ngg_options[$value];
474
+ }
475
+ // if this is not WPMU, enable it !
476
+ return true;
477
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/ajax.php CHANGED
@@ -1,450 +1,450 @@
1
- <?php
2
- add_action('wp_ajax_ngg_ajax_operation', 'ngg_ajax_operation' );
3
-
4
- /**
5
- * Image edit functions via AJAX
6
- *
7
- * @author Alex Rabe
8
- * @copyright 2008 - 2010
9
- *
10
- * @return void
11
- */
12
- function ngg_ajax_operation() {
13
-
14
- global $wpdb;
15
-
16
- // if nonce is not correct it returns -1
17
- check_ajax_referer( "ngg-ajax" );
18
-
19
- // check for correct capability
20
- if ( !is_user_logged_in() )
21
- die('-1');
22
-
23
- // check for correct NextGEN capability
24
- if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
25
- die('-1');
26
-
27
- // include the ngg function
28
- include_once (dirname (__FILE__) . '/functions.php');
29
-
30
- // Get the image id
31
- if ( isset($_POST['image'])) {
32
- $id = (int) $_POST['image'];
33
- // let's get the image data
34
- $picture = nggdb::find_image( $id );
35
- // what do you want to do ?
36
- switch ( $_POST['operation'] ) {
37
- case 'create_thumbnail' :
38
- $result = nggAdmin::create_thumbnail($picture);
39
- break;
40
- case 'resize_image' :
41
- $result = nggAdmin::resize_image($picture);
42
- break;
43
- case 'rotate_cw' :
44
- $result = nggAdmin::rotate_image($picture, 'CW');
45
- nggAdmin::create_thumbnail($picture);
46
- break;
47
- case 'rotate_ccw' :
48
- $result = nggAdmin::rotate_image($picture, 'CCW');
49
- nggAdmin::create_thumbnail($picture);
50
- break;
51
- case 'set_watermark' :
52
- $result = nggAdmin::set_watermark($picture);
53
- break;
54
- case 'recover_image' :
55
- $result = nggAdmin::recover_image($picture);
56
- break;
57
- case 'import_metadata' :
58
- $result = nggAdmin::import_MetaData( $id );
59
- break;
60
- case 'get_image_ids' :
61
- $result = nggAdmin::get_image_ids( $id );
62
- break;
63
- default :
64
- do_action( 'ngg_ajax_' . $_POST['operation'] );
65
- die('-1');
66
- break;
67
- }
68
- // A success should return a '1'
69
- die ($result);
70
- }
71
-
72
- // The script should never stop here
73
- die('0');
74
- }
75
-
76
- add_action('wp_ajax_createNewThumb', 'createNewThumb');
77
-
78
- function createNewThumb() {
79
-
80
- global $ngg;
81
-
82
- // check for correct capability
83
- if ( !is_user_logged_in() )
84
- die('-1');
85
-
86
- // check for correct NextGEN capability
87
- if ( !current_user_can('NextGEN Manage gallery') )
88
- die('-1');
89
-
90
- include_once( nggGallery::graphic_library() );
91
-
92
- $id = (int) $_POST['id'];
93
- $picture = nggdb::find_image( $id );
94
-
95
- $x = round( $_POST['x'] * $_POST['rr'], 0);
96
- $y = round( $_POST['y'] * $_POST['rr'], 0);
97
- $w = round( $_POST['w'] * $_POST['rr'], 0);
98
- $h = round( $_POST['h'] * $_POST['rr'], 0);
99
-
100
- $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
101
-
102
- $thumb->crop($x, $y, $w, $h);
103
-
104
- // Note : the routine is a bit different to create_thumbnail(), due to rounding it's resized in the other way
105
- if ($ngg->options['thumbfix']) {
106
- // check for portrait format
107
- if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
108
- // first resize to the wanted height, here changed to create_thumbnail()
109
- $thumb->resize(0, $ngg->options['thumbheight']);
110
- // get optimal y startpos
111
- $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
112
- $thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
113
- } else {
114
- // first resize to the wanted width, here changed to create_thumbnail()
115
- $thumb->resize($ngg->options['thumbwidth'], 0);
116
- //
117
- // get optimal x startpos
118
- $xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
119
- $thumb->crop($xpos, 0, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
120
- }
121
- //this create a thumbnail but keep ratio settings
122
- } else {
123
- $thumb->resize($ngg->options['thumbwidth'],$ngg->options['thumbheight']);
124
- }
125
-
126
- if ( $thumb->save($picture->thumbPath, 100)) {
127
-
128
- //read the new sizes
129
- $new_size = @getimagesize ( $picture->thumbPath );
130
- $size['width'] = $new_size[0];
131
- $size['height'] = $new_size[1];
132
-
133
- // add them to the database
134
- nggdb::update_image_meta($picture->pid, array( 'thumbnail' => $size) );
135
-
136
- echo "OK";
137
- } else {
138
- header('HTTP/1.1 500 Internal Server Error');
139
- echo "KO";
140
- }
141
-
142
- exit();
143
-
144
- }
145
-
146
- add_action('wp_ajax_rotateImage', 'ngg_rotateImage');
147
-
148
- function ngg_rotateImage() {
149
-
150
- // check for correct capability
151
- if ( !is_user_logged_in() )
152
- die('-1');
153
-
154
- // check for correct NextGEN capability
155
- if ( !current_user_can('NextGEN Manage gallery') )
156
- die('-1');
157
-
158
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
159
-
160
- // include the ngg function
161
- include_once (dirname (__FILE__). '/functions.php');
162
-
163
- $ngg_options = get_option('ngg_options');
164
-
165
- $id = (int) $_POST['id'];
166
- $result = '-1';
167
-
168
- switch ( $_POST['ra'] ) {
169
- case 'cw' :
170
- $result = nggAdmin::rotate_image($id, 'CW');
171
- break;
172
- case 'ccw' :
173
- $result = nggAdmin::rotate_image($id, 'CCW');
174
- break;
175
- case 'fv' :
176
- $result = nggAdmin::rotate_image($id, 0, 'V');
177
- break;
178
- case 'fh' :
179
- $result = nggAdmin::rotate_image($id, 0, 'H');
180
- break;
181
- }
182
-
183
- // recreate the thumbnail
184
- nggAdmin::create_thumbnail($id);
185
-
186
- if ( $result == 1 )
187
- die('1');
188
-
189
- header('HTTP/1.1 500 Internal Server Error');
190
- die( $result );
191
-
192
- }
193
-
194
- add_action('wp_ajax_ngg_dashboard', 'ngg_ajax_dashboard');
195
-
196
- function ngg_ajax_dashboard() {
197
-
198
- require_once( dirname( dirname(__FILE__) ) . '/admin/admin.php');
199
- require_once( dirname( dirname(__FILE__) ) . '/admin/overview.php');
200
-
201
- if ( !current_user_can('NextGEN Gallery overview') )
202
- die('-1');
203
-
204
- @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
205
- @header( 'X-Content-Type-Options: nosniff' );
206
-
207
- switch ( $_GET['jax'] ) {
208
-
209
- case 'ngg_lastdonators' :
210
- ngg_overview_donators();
211
- break;
212
-
213
- case 'dashboard_primary' :
214
- ngg_overview_news();
215
- break;
216
-
217
- case 'ngg_locale' :
218
- ngg_locale();
219
- break;
220
-
221
- case 'dashboard_plugins' :
222
- ngg_related_plugins();
223
- break;
224
-
225
- }
226
- die();
227
- }
228
-
229
- add_action('wp_ajax_ngg_file_browser', 'ngg_ajax_file_browser');
230
-
231
- /**
232
- * jQuery File Tree PHP Connector
233
- * @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
234
- * @version 1.0.1
235
- *
236
- * @return string folder content
237
- */
238
- function ngg_ajax_file_browser() {
239
-
240
- global $ngg;
241
-
242
- // check for correct NextGEN capability
243
- if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
244
- die('No access');
245
-
246
- if ( !defined('ABSPATH') )
247
- die('No access');
248
-
249
- // if nonce is not correct it returns -1
250
- check_ajax_referer( 'ngg-ajax', 'nonce' );
251
-
252
- //PHP4 compat script
253
- if (!function_exists('scandir')) {
254
- function scandir($dir, $listDirectories = false, $skipDots = true ) {
255
- $dirArray = array();
256
- if ($handle = opendir($dir) ) {
257
- while (false !== ($file = readdir($handle))) {
258
- if (($file != '.' && $file != '..' ) || $skipDots == true) {
259
- if($listDirectories == false) { if(is_dir($file)) { continue; } }
260
- array_push($dirArray, basename($file) );
261
- }
262
- }
263
- closedir($handle);
264
- }
265
- return $dirArray;
266
- }
267
- }
268
-
269
- // start from the default path
270
- $root = trailingslashit ( WINABSPATH );
271
- // get the current directory
272
- $dir = trailingslashit ( urldecode($_POST['dir']) );
273
-
274
- if( file_exists($root . $dir) ) {
275
- $files = scandir($root . $dir);
276
- natcasesort($files);
277
-
278
- // The 2 counts for . and ..
279
- if( count($files) > 2 ) {
280
- echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
281
-
282
- // return only directories
283
- foreach( $files as $file ) {
284
-
285
- //reserved name for the thumnbnails, don't use it as folder name
286
- if ( $file == 'thumbs')
287
- continue;
288
-
289
- if ( file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file) ) {
290
- echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
291
- }
292
- }
293
-
294
- echo "</ul>";
295
- }
296
- }
297
-
298
- die();
299
- }
300
-
301
- add_action('wp_ajax_ngg_tinymce', 'ngg_ajax_tinymce');
302
- /**
303
- * Call TinyMCE window content via admin-ajax
304
- *
305
- * @since 1.7.0
306
- * @return html content
307
- */
308
- function ngg_ajax_tinymce() {
309
-
310
- // check for rights
311
- if ( !current_user_can('edit_pages') && !current_user_can('edit_posts') )
312
- die(__("You are not allowed to be here"));
313
-
314
- include_once( dirname( dirname(__FILE__) ) . '/admin/tinymce/window.php');
315
-
316
- die();
317
- }
318
-
319
- add_action( 'wp_ajax_ngg_rebuild_unique_slugs', 'ngg_ajax_rebuild_unique_slugs' );
320
- /**
321
- * This rebuild the slugs for albums, galleries and images as ajax routine, max 50 elements per request
322
- *
323
- * @since 1.7.0
324
- * @return string '1'
325
- */
326
- function ngg_ajax_rebuild_unique_slugs() {
327
- global $wpdb;
328
-
329
- // check for correct NextGEN capability
330
- if ( !current_user_can('NextGEN Change options') )
331
- die('No access');
332
-
333
- $action = $_POST['_action'];
334
- $offset = (int) $_POST['offset'];
335
-
336
- switch ($action) {
337
- case 'images':
338
- $images = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures ORDER BY pid ASC LIMIT $offset, 50", OBJECT_K);
339
- if ( is_array($images) ) {
340
- foreach ($images as $image) {
341
- //slug must be unique, we use the alttext for that
342
- $image->slug = nggdb::get_unique_slug( sanitize_title( $image->alttext ), 'image', $image->pid );
343
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggpictures SET image_slug= '%s' WHERE pid = '%d'" , $image->slug, $image->pid ) );
344
- }
345
- }
346
- break;
347
- case 'gallery':
348
- $galleries = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC LIMIT $offset, 50", OBJECT_K);
349
- if ( is_array($galleries) ) {
350
- foreach ($galleries as $gallery) {
351
- //slug must be unique, we use the title for that
352
- $gallery->slug = nggdb::get_unique_slug( sanitize_title( $gallery->title ), 'gallery', $gallery->gid );
353
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggallery SET slug= '%s' WHERE gid = '%d'" , $gallery->slug, $gallery->gid ) );
354
- }
355
- }
356
- break;
357
- case 'album':
358
- $albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id ASC LIMIT $offset, 50", OBJECT_K);
359
- if ( is_array($albumlist) ) {
360
- foreach ($albumlist as $album) {
361
- //slug must be unique, we use the name for that
362
- $album->slug = nggdb::get_unique_slug( sanitize_title( $album->name ), 'album', $album->id );
363
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s' WHERE id = '%d'" , $album->slug, $album->id ) );
364
- }
365
- }
366
- break;
367
- }
368
-
369
- die(1);
370
- }
371
- add_action('wp_ajax_ngg_image_check', 'ngg_ajax_image_check');
372
- /**
373
- * Test for various image resolution
374
- *
375
- * @since 1.7.3
376
- * @return result
377
- */
378
- function ngg_ajax_image_check() {
379
-
380
- // check for correct NextGEN capability
381
- if ( !current_user_can('NextGEN Upload images') )
382
- die('No access');
383
-
384
- if ( !defined('ABSPATH') )
385
- die('No access');
386
-
387
- $step = (int) $_POST['step'];
388
-
389
- // build the test sizes
390
- $sizes = array();
391
- $sizes[1] = array ( 'width' => 800, 'height' => 600);
392
- $sizes[2] = array ( 'width' => 1024, 'height' => 768);
393
- $sizes[3] = array ( 'width' => 1280, 'height' => 960); // 1MP
394
- $sizes[4] = array ( 'width' => 1600, 'height' => 1200); // 2MP
395
- $sizes[5] = array ( 'width' => 2016, 'height' => 1512); // 3MP
396
- $sizes[6] = array ( 'width' => 2272, 'height' => 1704); // 4MP
397
- $sizes[7] = array ( 'width' => 2560, 'height' => 1920); // 5MP
398
- $sizes[8] = array ( 'width' => 2848, 'height' => 2136); // 6MP
399
- $sizes[9] = array ( 'width' => 3072, 'height' => 2304); // 7MP
400
- $sizes[10] = array ( 'width' => 3264, 'height' => 2448); // 8MP
401
- $sizes[11] = array ( 'width' => 4048, 'height' => 3040); // 12MP
402
-
403
- if ( $step < 1 || $step > 11 )
404
- die('No vaild value');
405
-
406
- // let's test each image size
407
- $temp = imagecreatetruecolor ($sizes[$step]['width'], $sizes[$step]['height'] );
408
- imagedestroy ($temp);
409
-
410
- $result = array ('stat' => 'ok', 'message' => sprintf(__('Could create image with %s x %s pixel', 'nggallery'), $sizes[$step]['width'], $sizes[$step]['height'] ) );
411
-
412
- header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
413
- echo json_encode($result);
414
-
415
- die();
416
- }
417
-
418
- add_action('wp_ajax_ngg_test_head_footer', 'ngg_ajax_test_head_footer');
419
- /**
420
- * Check for the header / footer, parts taken from Matt Martz (http://sivel.net/)
421
- *
422
- * @see https://gist.github.com/378450
423
- * @since 1.7.3
424
- * @return result
425
- */
426
- function ngg_ajax_test_head_footer() {
427
-
428
- // Build the url to call, NOTE: uses home_url and thus requires WordPress 3.0
429
- $url = add_query_arg( array( 'test-head' => '', 'test-footer' => '' ), home_url() );
430
- // Perform the HTTP GET ignoring SSL errors
431
- $response = wp_remote_get( $url, array( 'sslverify' => false ) );
432
- // Grab the response code and make sure the request was sucessful
433
- $code = (int) wp_remote_retrieve_response_code( $response );
434
- if ( $code == 200 ) {
435
- global $head_footer_errors;
436
- $head_footer_errors = array();
437
-
438
- // Strip all tabs, line feeds, carriage returns and spaces
439
- $html = preg_replace( '/[\t\r\n\s]/', '', wp_remote_retrieve_body( $response ) );
440
-
441
- // Check to see if we found the existence of wp_head
442
- if ( ! strstr( $html, '<!--wp_head-->' ) )
443
- die('Missing the call to wp_head() in your theme, contact the theme author');
444
- // Check to see if we found the existence of wp_footer
445
- if ( ! strstr( $html, '<!--wp_footer-->' ) )
446
- die('Missing the call to wp_footer() in your theme, contact the theme author');
447
- }
448
- die('success');
449
- }
450
- ?>
1
+ <?php
2
+ add_action('wp_ajax_ngg_ajax_operation', 'ngg_ajax_operation' );
3
+
4
+ /**
5
+ * Image edit functions via AJAX
6
+ *
7
+ * @author Alex Rabe
8
+ *
9
+ *
10
+ * @return void
11
+ */
12
+ function ngg_ajax_operation() {
13
+
14
+ global $wpdb;
15
+
16
+ // if nonce is not correct it returns -1
17
+ check_ajax_referer( "ngg-ajax" );
18
+
19
+ // check for correct capability
20
+ if ( !is_user_logged_in() )
21
+ die('-1');
22
+
23
+ // check for correct NextGEN capability
24
+ if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
25
+ die('-1');
26
+
27
+ // include the ngg function
28
+ include_once (dirname (__FILE__) . '/functions.php');
29
+
30
+ // Get the image id
31
+ if ( isset($_POST['image'])) {
32
+ $id = (int) $_POST['image'];
33
+ // let's get the image data
34
+ $picture = nggdb::find_image( $id );
35
+ // what do you want to do ?
36
+ switch ( $_POST['operation'] ) {
37
+ case 'create_thumbnail' :
38
+ $result = nggAdmin::create_thumbnail($picture);
39
+ break;
40
+ case 'resize_image' :
41
+ $result = nggAdmin::resize_image($picture);
42
+ break;
43
+ case 'rotate_cw' :
44
+ $result = nggAdmin::rotate_image($picture, 'CW');
45
+ nggAdmin::create_thumbnail($picture);
46
+ break;
47
+ case 'rotate_ccw' :
48
+ $result = nggAdmin::rotate_image($picture, 'CCW');
49
+ nggAdmin::create_thumbnail($picture);
50
+ break;
51
+ case 'set_watermark' :
52
+ $result = nggAdmin::set_watermark($picture);
53
+ break;
54
+ case 'recover_image' :
55
+ $result = nggAdmin::recover_image($picture);
56
+ break;
57
+ case 'import_metadata' :
58
+ $result = nggAdmin::import_MetaData( $id );
59
+ break;
60
+ case 'get_image_ids' :
61
+ $result = nggAdmin::get_image_ids( $id );
62
+ break;
63
+ default :
64
+ do_action( 'ngg_ajax_' . $_POST['operation'] );
65
+ die('-1');
66
+ break;
67
+ }
68
+ // A success should return a '1'
69
+ die ($result);
70
+ }
71
+
72
+ // The script should never stop here
73
+ die('0');
74
+ }
75
+
76
+ add_action('wp_ajax_createNewThumb', 'createNewThumb');
77
+
78
+ function createNewThumb() {
79
+
80
+ global $ngg;
81
+
82
+ // check for correct capability
83
+ if ( !is_user_logged_in() )
84
+ die('-1');
85
+
86
+ // check for correct NextGEN capability
87
+ if ( !current_user_can('NextGEN Manage gallery') )
88
+ die('-1');
89
+
90
+ include_once( nggGallery::graphic_library() );
91
+
92
+ $id = (int) $_POST['id'];
93
+ $picture = nggdb::find_image( $id );
94
+
95
+ $x = round( $_POST['x'] * $_POST['rr'], 0);
96
+ $y = round( $_POST['y'] * $_POST['rr'], 0);
97
+ $w = round( $_POST['w'] * $_POST['rr'], 0);
98
+ $h = round( $_POST['h'] * $_POST['rr'], 0);
99
+
100
+ $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
101
+
102
+ $thumb->crop($x, $y, $w, $h);
103
+
104
+ // Note : the routine is a bit different to create_thumbnail(), due to rounding it's resized in the other way
105
+ if ($ngg->options['thumbfix']) {
106
+ // check for portrait format
107
+ if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
108
+ // first resize to the wanted height, here changed to create_thumbnail()
109
+ $thumb->resize(0, $ngg->options['thumbheight']);
110
+ // get optimal y startpos
111
+ $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
112
+ $thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
113
+ } else {
114
+ // first resize to the wanted width, here changed to create_thumbnail()
115
+ $thumb->resize($ngg->options['thumbwidth'], 0);
116
+ //
117
+ // get optimal x startpos
118
+ $xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
119
+ $thumb->crop($xpos, 0, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
120
+ }
121
+ //this create a thumbnail but keep ratio settings
122
+ } else {
123
+ $thumb->resize($ngg->options['thumbwidth'],$ngg->options['thumbheight']);
124
+ }
125
+
126
+ if ( $thumb->save($picture->thumbPath, 100)) {
127
+
128
+ //read the new sizes
129
+ $new_size = @getimagesize ( $picture->thumbPath );
130
+ $size['width'] = $new_size[0];
131
+ $size['height'] = $new_size[1];
132
+
133
+ // add them to the database
134
+ nggdb::update_image_meta($picture->pid, array( 'thumbnail' => $size) );
135
+
136
+ echo "OK";
137
+ } else {
138
+ header('HTTP/1.1 500 Internal Server Error');
139
+ echo "KO";
140
+ }
141
+
142
+ exit();
143
+
144
+ }
145
+
146
+ add_action('wp_ajax_rotateImage', 'ngg_rotateImage');
147
+
148
+ function ngg_rotateImage() {
149
+
150
+ // check for correct capability
151
+ if ( !is_user_logged_in() )
152
+ die('-1');
153
+
154
+ // check for correct NextGEN capability
155
+ if ( !current_user_can('NextGEN Manage gallery') )
156
+ die('-1');
157
+
158
+ require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
159
+
160
+ // include the ngg function
161
+ include_once (dirname (__FILE__). '/functions.php');
162
+
163
+ $ngg_options = get_option('ngg_options');
164
+
165
+ $id = (int) $_POST['id'];
166
+ $result = '-1';
167
+
168
+ switch ( $_POST['ra'] ) {
169
+ case 'cw' :
170
+ $result = nggAdmin::rotate_image($id, 'CW');
171
+ break;
172
+ case 'ccw' :
173
+ $result = nggAdmin::rotate_image($id, 'CCW');
174
+ break;
175
+ case 'fv' :
176
+ $result = nggAdmin::rotate_image($id, 0, 'V');
177
+ break;
178
+ case 'fh' :
179
+ $result = nggAdmin::rotate_image($id, 0, 'H');
180
+ break;
181
+ }
182
+
183
+ // recreate the thumbnail
184
+ nggAdmin::create_thumbnail($id);
185
+
186
+ if ( $result == 1 )
187
+ die('1');
188
+
189
+ header('HTTP/1.1 500 Internal Server Error');
190
+ die( $result );
191
+
192
+ }
193
+
194
+ add_action('wp_ajax_ngg_dashboard', 'ngg_ajax_dashboard');
195
+
196
+ function ngg_ajax_dashboard() {
197
+
198
+ require_once( dirname( dirname(__FILE__) ) . '/admin/admin.php');
199
+ require_once( dirname( dirname(__FILE__) ) . '/admin/overview.php');
200
+
201
+ if ( !current_user_can('NextGEN Gallery overview') )
202
+ die('-1');
203
+
204
+ @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
205
+ @header( 'X-Content-Type-Options: nosniff' );
206
+
207
+ switch ( $_GET['jax'] ) {
208
+
209
+ case 'ngg_lastdonators' :
210
+ ngg_overview_donators();
211
+ break;
212
+
213
+ case 'dashboard_primary' :
214
+ ngg_overview_news();
215
+ break;
216
+
217
+ case 'ngg_locale' :
218
+ ngg_locale();
219
+ break;
220
+
221
+ case 'dashboard_plugins' :
222
+ ngg_related_plugins();
223
+ break;
224
+
225
+ }
226
+ die();
227
+ }
228
+
229
+ add_action('wp_ajax_ngg_file_browser', 'ngg_ajax_file_browser');
230
+
231
+ /**
232
+ * jQuery File Tree PHP Connector
233
+ * @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
234
+ * @version 1.0.1
235
+ *
236
+ * @return string folder content
237
+ */
238
+ function ngg_ajax_file_browser() {
239
+
240
+ global $ngg;
241
+
242
+ // check for correct NextGEN capability
243
+ if ( !current_user_can('NextGEN Upload images') && !current_user_can('NextGEN Manage gallery') )
244
+ die('No access');
245
+
246
+ if ( !defined('ABSPATH') )
247
+ die('No access');
248
+
249
+ // if nonce is not correct it returns -1
250
+ check_ajax_referer( 'ngg-ajax', 'nonce' );
251
+
252
+ //PHP4 compat script
253
+ if (!function_exists('scandir')) {
254
+ function scandir($dir, $listDirectories = false, $skipDots = true ) {
255
+ $dirArray = array();
256
+ if ($handle = opendir($dir) ) {
257
+ while (false !== ($file = readdir($handle))) {
258
+ if (($file != '.' && $file != '..' ) || $skipDots == true) {
259
+ if($listDirectories == false) { if(is_dir($file)) { continue; } }
260
+ array_push($dirArray, basename($file) );
261
+ }
262
+ }
263
+ closedir($handle);
264
+ }
265
+ return $dirArray;
266
+ }
267
+ }
268
+
269
+ // start from the default path
270
+ $root = trailingslashit ( WINABSPATH );
271
+ // get the current directory
272
+ $dir = trailingslashit ( urldecode($_POST['dir']) );
273
+
274
+ if( file_exists($root . $dir) ) {
275
+ $files = scandir($root . $dir);
276
+ natcasesort($files);
277
+
278
+ // The 2 counts for . and ..
279
+ if( count($files) > 2 ) {
280
+ echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
281
+
282
+ // return only directories
283
+ foreach( $files as $file ) {
284
+
285
+ //reserved name for the thumnbnails, don't use it as folder name
286
+ if ( $file == 'thumbs')
287
+ continue;
288
+
289
+ if ( file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file) ) {
290
+ echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
291
+ }
292
+ }
293
+
294
+ echo "</ul>";
295
+ }
296
+ }
297
+
298
+ die();
299
+ }
300
+
301
+ add_action('wp_ajax_ngg_tinymce', 'ngg_ajax_tinymce');
302
+ /**
303
+ * Call TinyMCE window content via admin-ajax
304
+ *
305
+ * @since 1.7.0
306
+ * @return html content
307
+ */
308
+ function ngg_ajax_tinymce() {
309
+
310
+ // check for rights
311
+ if ( !current_user_can('edit_pages') && !current_user_can('edit_posts') )
312
+ die(__("You are not allowed to be here"));
313
+
314
+ include_once( dirname( dirname(__FILE__) ) . '/admin/tinymce/window.php');
315
+
316
+ die();
317
+ }
318
+
319
+ add_action( 'wp_ajax_ngg_rebuild_unique_slugs', 'ngg_ajax_rebuild_unique_slugs' );
320
+ /**
321
+ * This rebuild the slugs for albums, galleries and images as ajax routine, max 50 elements per request
322
+ *
323
+ * @since 1.7.0
324
+ * @return string '1'
325
+ */
326
+ function ngg_ajax_rebuild_unique_slugs() {
327
+ global $wpdb;
328
+
329
+ // check for correct NextGEN capability
330
+ if ( !current_user_can('NextGEN Change options') )
331
+ die('No access');
332
+
333
+ $action = $_POST['_action'];
334
+ $offset = (int) $_POST['offset'];
335
+
336
+ switch ($action) {
337
+ case 'images':
338
+ $images = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures ORDER BY pid ASC LIMIT $offset, 50", OBJECT_K);
339
+ if ( is_array($images) ) {
340
+ foreach ($images as $image) {
341
+ //slug must be unique, we use the alttext for that
342
+ $image->slug = nggdb::get_unique_slug( sanitize_title( $image->alttext ), 'image', $image->pid );
343
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggpictures SET image_slug= '%s' WHERE pid = '%d'" , $image->slug, $image->pid ) );
344
+ }
345
+ }
346
+ break;
347
+ case 'gallery':
348
+ $galleries = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC LIMIT $offset, 50", OBJECT_K);
349
+ if ( is_array($galleries) ) {
350
+ foreach ($galleries as $gallery) {
351
+ //slug must be unique, we use the title for that
352
+ $gallery->slug = nggdb::get_unique_slug( sanitize_title( $gallery->title ), 'gallery', $gallery->gid );
353
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggallery SET slug= '%s' WHERE gid = '%d'" , $gallery->slug, $gallery->gid ) );
354
+ }
355
+ }
356
+ break;
357
+ case 'album':
358
+ $albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id ASC LIMIT $offset, 50", OBJECT_K);
359
+ if ( is_array($albumlist) ) {
360
+ foreach ($albumlist as $album) {
361
+ //slug must be unique, we use the name for that
362
+ $album->slug = nggdb::get_unique_slug( sanitize_title( $album->name ), 'album', $album->id );
363
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s' WHERE id = '%d'" , $album->slug, $album->id ) );
364
+ }
365
+ }
366
+ break;
367
+ }
368
+
369
+ die(1);
370
+ }
371
+ add_action('wp_ajax_ngg_image_check', 'ngg_ajax_image_check');
372
+ /**
373
+ * Test for various image resolution
374
+ *
375
+ * @since 1.7.3
376
+ * @return result
377
+ */
378
+ function ngg_ajax_image_check() {
379
+
380
+ // check for correct NextGEN capability
381
+ if ( !current_user_can('NextGEN Upload images') )
382
+ die('No access');
383
+
384
+ if ( !defined('ABSPATH') )
385
+ die('No access');
386
+
387
+ $step = (int) $_POST['step'];
388
+
389
+ // build the test sizes
390
+ $sizes = array();
391
+ $sizes[1] = array ( 'width' => 800, 'height' => 600);
392
+ $sizes[2] = array ( 'width' => 1024, 'height' => 768);
393
+ $sizes[3] = array ( 'width' => 1280, 'height' => 960); // 1MP
394
+ $sizes[4] = array ( 'width' => 1600, 'height' => 1200); // 2MP
395
+ $sizes[5] = array ( 'width' => 2016, 'height' => 1512); // 3MP
396
+ $sizes[6] = array ( 'width' => 2272, 'height' => 1704); // 4MP
397
+ $sizes[7] = array ( 'width' => 2560, 'height' => 1920); // 5MP
398
+ $sizes[8] = array ( 'width' => 2848, 'height' => 2136); // 6MP
399
+ $sizes[9] = array ( 'width' => 3072, 'height' => 2304); // 7MP
400
+ $sizes[10] = array ( 'width' => 3264, 'height' => 2448); // 8MP
401
+ $sizes[11] = array ( 'width' => 4048, 'height' => 3040); // 12MP
402
+
403
+ if ( $step < 1 || $step > 11 )
404
+ die('No vaild value');
405
+
406
+ // let's test each image size
407
+ $temp = imagecreatetruecolor ($sizes[$step]['width'], $sizes[$step]['height'] );
408
+ imagedestroy ($temp);
409
+
410
+ $result = array ('stat' => 'ok', 'message' => sprintf(__('Could create image with %s x %s pixel', 'nggallery'), $sizes[$step]['width'], $sizes[$step]['height'] ) );
411
+
412
+ header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
413
+ echo json_encode($result);
414
+
415
+ die();
416
+ }
417
+
418
+ add_action('wp_ajax_ngg_test_head_footer', 'ngg_ajax_test_head_footer');
419
+ /**
420
+ * Check for the header / footer, parts taken from Matt Martz (http://sivel.net/)
421
+ *
422
+ * @see https://gist.github.com/378450
423
+ * @since 1.7.3
424
+ * @return result
425
+ */
426
+ function ngg_ajax_test_head_footer() {
427
+
428
+ // Build the url to call, NOTE: uses home_url and thus requires WordPress 3.0
429
+ $url = add_query_arg( array( 'test-head' => '', 'test-footer' => '' ), home_url() );
430
+ // Perform the HTTP GET ignoring SSL errors
431
+ $response = wp_remote_get( $url, array( 'sslverify' => false ) );
432
+ // Grab the response code and make sure the request was sucessful
433
+ $code = (int) wp_remote_retrieve_response_code( $response );
434
+ if ( $code == 200 ) {
435
+ global $head_footer_errors;
436
+ $head_footer_errors = array();
437
+
438
+ // Strip all tabs, line feeds, carriage returns and spaces
439
+ $html = preg_replace( '/[\t\r\n\s]/', '', wp_remote_retrieve_body( $response ) );
440
+
441
+ // Check to see if we found the existence of wp_head
442
+ if ( ! strstr( $html, '<!--wp_head-->' ) )
443
+ die('Missing the call to wp_head() in your theme, contact the theme author');
444
+ // Check to see if we found the existence of wp_footer
445
+ if ( ! strstr( $html, '<!--wp_footer-->' ) )
446
+ die('Missing the call to wp_footer() in your theme, contact the theme author');
447
+ }
448
+ die('success');
449
+ }
450
+ ?>
admin/album.php CHANGED
@@ -1,596 +1,597 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
-
5
- class nggManageAlbum {
6
-
7
- /**
8
- * The selected album ID
9
- *
10
- * @since 1.3.0
11
- * @access privat
12
- * @var int
13
- */
14
- var $currentID = 0;
15
-
16
- /**
17
- * The array for the galleries
18
- *
19
- * @since 1.3.0
20
- * @access privat
21
- * @var array
22
- */
23
- var $galleries = false;
24
-
25
- /**
26
- * The array for the albums
27
- *
28
- * @since 1.3.0
29
- * @access privat
30
- * @var array
31
- */
32
- var $albums = false;
33
-
34
- /**
35
- * The amount of all galleries
36
- *
37
- * @since 1.4.0
38
- * @access privat
39
- * @var int
40
- */
41
- var $num_galleries = false;
42
-
43
- /**
44
- * The amount of all albums
45
- *
46
- * @since 1.4.0
47
- * @access privat
48
- * @var int
49
- */
50
- var $num_albums = false;
51
-
52
- /**
53
- * PHP4 compatibility layer for calling the PHP5 constructor.
54
- *
55
- */
56
- function nggManageAlbum() {
57
- return $this->__construct();
58
- }
59
-
60
- /**
61
- * Init the album output
62
- *
63
- */
64
- function __construct() {
65
- return true;
66
- }
67
-
68
- function controller() {
69
- global $nggdb;
70
-
71
- $this->currentID = isset($_REQUEST['act_album']) ? (int) $_REQUEST['act_album'] : 0 ;
72
-
73
- if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
74
- $this->processor();
75
-
76
- if (isset ($_POST['update_album']) )
77
- $this->update_album();
78
-
79
- // get first all galleries & albums
80
- $this->albums = $nggdb->find_all_album();
81
- $this->galleries = $nggdb->find_all_galleries();
82
- $this->num_albums = count( $this->albums );
83
- $this->num_galleries = count( $this->galleries );
84
- $this->output();
85
-
86
- }
87
-
88
- function processor() {
89
- global $wpdb;
90
-
91
- check_admin_referer('ngg_album');
92
-
93
- if ( isset($_POST['add']) && isset ($_POST['newalbum']) ) {
94
-
95
- if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
96
- wp_die(__('Cheatin&#8217; uh?'));
97
-
98
- $result = nggdb::add_album( $_POST['newalbum'] );
99
- $this->currentID = ($result) ? $result : 0 ;
100
-
101
- //hook for other plugins
102
- do_action('ngg_add_album', $this->currentID);
103
-
104
- if ($result)
105
- nggGallery::show_message(__('Update Successfully','nggallery'));
106
- }
107
-
108
- if ( isset($_POST['update']) && ($this->currentID > 0) ) {
109
-
110
- $gid = '';
111
-
112
- // get variable galleryContainer
113
- parse_str($_POST['sortorder']);
114
- if ( is_array($gid) ){
115
- $serial_sort = serialize($gid);
116
- $wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '$serial_sort' WHERE id = $this->currentID ");
117
- } else {
118
- $wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '0' WHERE id = $this->currentID ");
119
- }
120
-
121
- //hook for other plugins
122
- do_action('ngg_update_album_sortorder', $this->currentID);
123
-
124
- nggGallery::show_message(__('Update Successfully','nggallery'));
125
-
126
- }
127
-
128
- if ( isset($_POST['delete']) ) {
129
-
130
- if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
131
- wp_die(__('Cheatin&#8217; uh?'));
132
-
133
- $result = nggdb::delete_album( $this->currentID );
134
-
135
- //hook for other plugins
136
- do_action('ngg_delete_album', $this->currentID);
137
-
138
- // jump back to main selection
139
- $this->currentID = 0;
140
-
141
- if ($result)
142
- nggGallery::show_message(__('Album deleted','nggallery'));
143
- }
144
-
145
- }
146
-
147
- function update_album() {
148
- global $wpdb, $nggdb;
149
-
150
- check_admin_referer('ngg_thickbox_form');
151
-
152
- if (!nggGallery::current_user_can( 'NextGEN Edit album settings' ))
153
- wp_die(__('Cheatin&#8217; uh?'));
154
-
155
- $name = $_POST['album_name'];
156
- $desc = $_POST['album_desc'];
157
- $prev = (int) $_POST['previewpic'];
158
- $link = (int) $_POST['pageid'];
159
-
160
- // slug must be unique, we use the title for that
161
- $slug = nggdb::get_unique_slug( sanitize_title( $name ), 'album', $this->currentID );
162
-
163
- $result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s', name= '%s', albumdesc= '%s', previewpic= %d, pageid= %d WHERE id = '%d'" , $slug, $name, $desc, $prev, $link, $this->currentID ) );
164
-
165
- //hook for other plugin to update the fields
166
- do_action('ngg_update_album', $this->currentID, $_POST);
167
-
168
- if ($result)
169
- nggGallery::show_message(__('Update Successfully','nggallery'));
170
- }
171
-
172
- function output() {
173
-
174
- global $wpdb, $nggdb;
175
-
176
- //TODO:Code MUST be optimized, how to flag a used gallery better ?
177
- $used_list = $this->get_used_galleries();
178
-
179
- ?>
180
-
181
- <script type="text/javascript">
182
-
183
- jQuery(document).ready(
184
- function()
185
- {
186
- jQuery("#previewpic").nggAutocomplete( {
187
- type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>",width: "95%"
188
- });
189
-
190
- jQuery('#selectContainer').sortable( {
191
- items: '.groupItem',
192
- placeholder: 'sort_placeholder',
193
- opacity: 0.7,
194
- tolerance: 'intersect',
195
- distance: 2,
196
- forcePlaceholderSize: true ,
197
- connectWith: ['#galleryContainer']
198
- } );
199
-
200
- jQuery('#galleryContainer').sortable( {
201
- items: '.groupItem',
202
- placeholder: 'sort_placeholder',
203
- opacity: 0.7,
204
- tolerance: 'intersect',
205
- distance: 2,
206
- forcePlaceholderSize: true ,
207
- connectWith: ['#selectContainer', '#albumContainer']
208
- } );
209
-
210
- jQuery('#albumContainer').sortable( {
211
- items: '.groupItem',
212
- placeholder: 'sort_placeholder',
213
- opacity: 0.7,
214
- tolerance: 'intersect',
215
- distance: 2,
216
- forcePlaceholderSize: true ,
217
- connectWith: ['#galleryContainer']
218
- } );
219
-
220
- jQuery('a.min').bind('click', toggleContent);
221
-
222
- // Hide used galleries
223
- jQuery('a#toggle_used').click(function()
224
- {
225
- jQuery('#selectContainer div.inUse').toggle();
226
- return false;
227
- }
228
- );
229
-
230
- // Maximize All Portlets (whole site, no differentiation)
231
- jQuery('a#all_max').click(function()
232
- {
233
- jQuery('div.itemContent:hidden').show();
234
- return false;
235
- }
236
- );
237
-
238
- // Minimize All Portlets (whole site, no differentiation)
239
- jQuery('a#all_min').click(function()
240
- {
241
- jQuery('div.itemContent:visible').hide();
242
- return false;
243
- }
244
- );
245
- // Auto Minimize if more than 4 (whole site, no differentiation)
246
- if(jQuery('a.min').length > 4)
247
- {
248
- jQuery('a.min').html('[+]');
249
- jQuery('div.itemContent:visible').hide();
250
- jQuery('#selectContainer div.inUse').toggle();
251
- };
252
- }
253
- );
254
-
255
- var toggleContent = function(e)
256
- {
257
- var targetContent = jQuery('div.itemContent', this.parentNode.parentNode);
258
- if (targetContent.css('display') == 'none') {
259
- targetContent.slideDown(300);
260
- jQuery(this).html('[-]');
261
- } else {
262
- targetContent.slideUp(300);
263
- jQuery(this).html('[+]');
264
- }
265
- return false;
266
- }
267
-
268
- function ngg_serialize(s)
269
- {
270
- //serial = jQuery.SortSerialize(s);
271
- serial = jQuery('#galleryContainer').sortable('serialize');
272
- jQuery('input[name=sortorder]').val(serial);
273
- }
274
-
275
- function showDialog() {
276
- jQuery( "#editalbum").dialog({
277
- width: 640,
278
- resizable : false,
279
- modal: true,
280
- title: '<?php echo esc_js( __('Edit Album', 'nggallery') ); ?>'
281
- });
282
- jQuery('#editalbum .dialog-cancel').click(function() { jQuery( "#editalbum" ).dialog("close"); });
283
- }
284
-
285
- </script>
286
-
287
- <div class="wrap album" id="wrap" >
288
- <?php screen_icon( 'nextgen-gallery' ); ?>
289
- <h2><?php esc_html_e('Manage Albums', 'nggallery') ?></h2>
290
- <form id="selectalbum" method="POST" onsubmit="ngg_serialize()" accept-charset="utf-8">
291
- <?php wp_nonce_field('ngg_album') ?>
292
- <input name="sortorder" type="hidden" />
293
- <div class="albumnav tablenav">
294
- <div class="alignleft actions">
295
- <?php esc_html_e('Select album', 'nggallery') ?>
296
- <select id="act_album" name="act_album" onchange="this.form.submit();">
297
- <option value="0" ><?php esc_html_e('No album selected', 'nggallery') ?></option>
298
- <?php
299
- if( is_array($this->albums) ) {
300
- foreach($this->albums as $album) {
301
- $selected = ($this->currentID == $album->id) ? 'selected="selected" ' : '';
302
- echo '<option value="' . $album->id . '" ' . $selected . '>' . $album->id . ' - ' . esc_attr( $album->name ) . '</option>'."\n";
303
- }
304
- }
305
- ?>
306
- </select>
307
- <?php if ($this->currentID > 0){ ?>
308
- <input class="button-primary" type="submit" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>"/>
309
- <?php if(nggGallery::current_user_can( 'NextGEN Edit album settings' )) { ?>
310
- <input class="button-secondary" type="submit" name="showThickbox" value="<?php esc_attr_e( 'Edit album', 'nggallery'); ?>" onclick="showDialog(); return false;" />
311
- <?php } ?>
312
- <?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
313
- <input class="button-secondary action "type="submit" name="delete" value="<?php esc_attr_e('Delete', 'nggallery'); ?>" onclick="javascript:check=confirm('<?php echo esc_js('Delete album ?','nggallery'); ?>');if(check==false) return false;"/>
314
- <?php } ?>
315
- <?php } else { ?>
316
- <?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
317
- <span><?php esc_html_e('Add new album', 'nggallery'); ?>&nbsp;</span>
318
- <input class="search-input" id="newalbum" name="newalbum" type="text" value="" />
319
- <input class="button-secondary action" type="submit" name="add" value="<?php esc_attr_e('Add', 'nggallery'); ?>"/>
320
- <?php } ?>
321
- <?php } ?>
322
- </div>
323
- </div>
324
- </form>
325
-
326
- <br class="clear"/>
327
-
328
- <div>
329
- <div style="float:right;">
330
- <a href="#" title="<?php esc_attr_e('Show / hide used galleries','nggallery'); ?>" id="toggle_used"><?php esc_html_e('[Show all]', 'nggallery'); ?></a>
331
- | <a href="#" title="<?php esc_attr_e('Maximize the widget content','nggallery'); ?>" id="all_max"><?php esc_html_e('[Maximize]', 'nggallery'); ?></a>
332
- | <a href="#" title="<?php esc_attr_e('Minimize the widget content','nggallery'); ?>" id="all_min"><?php esc_html_e('[Minimize]', 'nggallery'); ?></a>
333
- </div>
334
- <?php esc_html_e('After you create and select a album, you can drag and drop a gallery or another album into your new album below','nggallery'); ?>
335
- </div>
336
-
337
- <br class="clear" />
338
-
339
- <div class="container">
340
-
341
- <!-- /#album container -->
342
- <div class="widget widget-right">
343
- <div class="widget-top">
344
- <h3><?php esc_html_e('Select album', 'nggallery'); ?></h3>
345
- </div>
346
- <div id="albumContainer" class="widget-holder">
347
- <?php
348
- if( is_array( $this->albums ) ) {
349
- foreach($this->albums as $album) {
350
- $this->get_container('a' . $album->id);
351
- }
352
- }
353
- ?>
354
- </div>
355
- </div>
356
-
357
- <!-- /#select container -->
358
- <div class="widget widget-right">
359
- <div class="widget-top">
360
- <h3><?php esc_html_e('Select gallery', 'nggallery'); ?></h3>
361
- </div>
362
- <div id="selectContainer" class="widget-holder">
363
- <?php
364
-
365
- if( is_array( $this->galleries ) ) {
366
- //get the array of galleries
367
- $sort_array = $this->currentID > 0 ? (array) $this->albums[$this->currentID]->galleries : array() ;
368
- foreach($this->galleries as $gallery) {
369
- if (!in_array($gallery->gid, $sort_array)) {
370
- if (in_array($gallery->gid,$used_list))
371
- $this->get_container($gallery->gid,true);
372
- else
373
- $this->get_container($gallery->gid,false);
374
- }
375
- }
376
- }
377
- ?>
378
- </div>
379
- </div>
380
-
381
- <!-- /#target-album -->
382
- <div class="widget target-album widget-left">
383
-
384
- <?php
385
- if ($this->currentID > 0){
386
- $album = $this->albums[$this->currentID];
387
- ?>
388
- <div class="widget-top">
389
- <h3><?php esc_html_e('Album ID', 'nggallery'); ?> <?php echo $album->id . ' : ' . esc_html( $album->name ); ?> </h3>
390
- </div>
391
- <div id="galleryContainer" class="widget-holder target">
392
- <?php
393
- $sort_array = (array) $this->albums[$this->currentID]->galleries;
394
- foreach($sort_array as $galleryid) {
395
- $this->get_container($galleryid, false);
396
- }
397
- }
398
- else
399
- {
400
- ?>
401
- <div class="widget-top">
402
- <h3><?php esc_html_e('No album selected!', 'nggallery'); ?></h3>
403
- </div>
404
- <div class="widget-holder target">
405
- <?php
406
- }
407
- ?>
408
- </div>
409
- </div><!-- /#target-album -->
410
-
411
- </div><!-- /#container -->
412
- </div><!-- /#wrap -->
413
-
414
- <?php if ($this->currentID > 0) : ?>
415
- <!-- #editalbum -->
416
- <div id="editalbum" style="display: none;" >
417
- <form id="form-edit-album" method="POST" accept-charset="utf-8">
418
- <?php wp_nonce_field('ngg_thickbox_form') ?>
419
- <input type="hidden" id="current_album" name="act_album" value="<?php echo $this->currentID; ?>" />
420
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
421
- <tr>
422
- <th>
423
- <?php esc_html_e('Album name:', 'nggallery'); ?><br />
424
- <input class="search-input" id="album_name" name="album_name" type="text" value="<?php echo esc_attr( $album->name ); ?>" style="width:95%" />
425
- </th>
426
- </tr>
427
- <tr>
428
- <th>
429
- <?php esc_html_e('Album description:', 'nggallery'); ?><br />
430
- <textarea class="search-input" id="album_desc" name="album_desc" cols="50" rows="2" style="width:95%" ><?php echo esc_attr( $album->albumdesc ); ?></textarea>
431
- </th>
432
- </tr>
433
- <tr>
434
- <th>
435
- <?php esc_html_e('Select a preview image:', 'nggallery'); ?><br />
436
- <select id="previewpic" name="previewpic" style="width:95%" >
437
- <?php if ($album->previewpic == 0) ?>
438
- <option value="0"><?php esc_html_e('No picture', 'nggallery'); ?></option>
439
- <?php
440
- if ($album->previewpic == 0)
441
- echo '<option value="0" selected="selected">' . __('No picture', 'nggallery') . '</option>';
442
- else {
443
- $picture = nggdb::find_image($album->previewpic);
444
- echo '<option value="' . $picture->pid . '" selected="selected" >'. $picture->pid . ' - ' . ( empty($picture->alltext) ? esc_attr( $picture->filename ) : esc_attr( $picture->alltext ) ) .' </option>'."\n";
445
- }
446
- ?>
447
- </select>
448
- </th>
449
- </tr>
450
- <tr>
451
- <th>
452
- <?php esc_html_e('Page Link to', 'nggallery')?><br />
453
- <select name="pageid" style="width:95%">
454
- <option value="0" ><?php esc_html_e('Not linked', 'nggallery') ?></option>
455
- <?php
456
- if (!isset($album->pageid))
457
- $album->pageid = 0;
458
- parent_dropdown($album->pageid); ?>
459
- </select>
460
- </th>
461
- </tr>
462
-
463
- <?php do_action('ngg_edit_album_settings', $this->currentID); ?>
464
-
465
- <tr align="right">
466
- <td class="submit">
467
- <input type="submit" class="button-primary" name="update_album" value="<?php esc_attr_e('OK', 'nggallery'); ?>" />
468
- &nbsp;
469
- <input class="button-secondary dialog-cancel" type="reset" value="<?php esc_attr_e('Cancel', 'nggallery'); ?>"/>
470
- </td>
471
- </tr>
472
- </table>
473
- </form>
474
- </div>
475
- <!-- /#editalbum -->
476
- <?php endif; ?>
477
-
478
- <?php
479
-
480
- }
481
-
482
- /**
483
- * Create the album or gallery container
484
- *
485
- * @param integer $id (the prefix 'a' indidcates that you look for a album
486
- * @param bool $used (object will be hidden)
487
- * @return $output
488
- */
489
- function get_container($id = 0, $used = false) {
490
- global $wpdb, $nggdb;
491
-
492
- $obj = array();
493
- $preview_image = '';
494
- $class = '';
495
-
496
- // if the id started with a 'a', then it's a sub album
497
- if (substr( $id, 0, 1) == 'a') {
498
-
499
- if ( !$album = $this->albums[ substr( $id, 1) ] )
500
- return;
501
-
502
- $obj['id'] = $album->id;
503
- $obj['name'] = $obj['title'] = $album->name;
504
- $obj['type'] = 'album';
505
- $class = 'album_obj';
506
-
507
- // get the post name
508
- $post = get_post($album->pageid);
509
- $obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
510
-
511
- // for speed reason we limit it to 50
512
- if ( $this->num_albums < 50 ) {
513
- if ($album->previewpic != 0) {
514
- $image = $nggdb->find_image( $album->previewpic );
515
- $preview_image = ( !is_null($image->thumbURL) ) ? '<div class="inlinepicture"><img src="' . esc_url( $image->thumbURL ). '" /></div>' : '';
516
- }
517
- }
518
-
519
- // this indicates that we have a album container
520
- $prefix = 'a';
521
-
522
- } else {
523
- if ( !$gallery = $nggdb->find_gallery( $id ) )
524
- return;
525
-
526
- $obj['id'] = $gallery->gid;
527
- $obj['name'] = $gallery->name;
528
- $obj['title'] = $gallery->title;
529
- $obj['type'] = 'gallery';
530
-
531
- // get the post name
532
- $post = get_post($gallery->pageid);
533
- $obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
534
-
535
- // for spped reason we limit it to 50
536
- if ( $this->num_galleries < 50 ) {
537
- // set image url
538
- $image = $nggdb->find_image( $gallery->previewpic );
539
- $preview_image = isset($image->thumbURL) ? '<div class="inlinepicture"><img src="' . esc_url( $image->thumbURL ) . '" /></div>' : '';
540
- }
541
-
542
- $prefix = '';
543
- }
544
-
545
- // add class if it's in use in other albums
546
- $used = $used ? ' inUse' : '';
547
-
548
- echo '<div id="gid-' . $prefix . $obj['id'] . '" class="groupItem' . $used . '">
549
- <div class="innerhandle">
550
- <div class="item_top ' . $class . '">
551
- <a href="#" class="min" title="close">[-]</a>
552
- ID: ' . $obj['id'] . ' | ' . wp_html_excerpt( esc_html ( nggGallery::i18n( $obj['title'] ) ) , 25) . '
553
- </div>
554
- <div class="itemContent">
555
- ' . $preview_image . '
556
- <p><strong>' . __('Name', 'nggallery') . ' : </strong>' . esc_html ( nggGallery::i18n( $obj['name'] ) ). '</p>
557
- <p><strong>' . __('Title', 'nggallery') . ' : </strong>' . esc_html ( nggGallery::i18n( $obj['title'] ) ) . '</p>
558
- <p><strong>' . __('Page', 'nggallery'). ' : </strong>' . esc_html ( nggGallery::i18n( $obj['pagenname'] ) ) . '</p>
559
- ' . apply_filters('ngg_display_album_item_content', '', $obj) . '
560
- </div>
561
- </div>
562
- </div>';
563
- }
564
-
565
- /**
566
- * get all used galleries from all albums
567
- *
568
- * @return array $used_galleries_ids
569
- */
570
- function get_used_galleries() {
571
-
572
- $used = array();
573
-
574
- if ($this->albums) {
575
- foreach($this->albums as $key => $value) {
576
- $sort_array = $this->albums[$key]->galleries;
577
- foreach($sort_array as $galleryid) {
578
- if (!in_array($galleryid, $used))
579
- $used[] = $galleryid;
580
- }
581
- }
582
- }
583
-
584
- return $used;
585
- }
586
-
587
- /**
588
- * PHP5 style destructor
589
- *
590
- * @return bool Always true
591
- */
592
- function __destruct() {
593
- return true;
594
- }
595
-
 
596
  }
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ class nggManageAlbum {
6
+
7
+ /**
8
+ * The selected album ID
9
+ *
10
+ * @since 1.3.0
11
+ * @access privat
12
+ * @var int
13
+ */
14
+ var $currentID = 0;
15
+
16
+ /**
17
+ * The array for the galleries
18
+ *
19
+ * @since 1.3.0
20
+ * @access privat
21
+ * @var array
22
+ */
23
+ var $galleries = false;
24
+
25
+ /**
26
+ * The array for the albums
27
+ *
28
+ * @since 1.3.0
29
+ * @access privat
30
+ * @var array
31
+ */
32
+ var $albums = false;
33
+
34
+ /**
35
+ * The amount of all galleries
36
+ *
37
+ * @since 1.4.0
38
+ * @access privat
39
+ * @var int
40
+ */
41
+ var $num_galleries = false;
42
+
43
+ /**
44
+ * The amount of all albums
45
+ *
46
+ * @since 1.4.0
47
+ * @access privat
48
+ * @var int
49
+ */
50
+ var $num_albums = false;
51
+
52
+ /**
53
+ * PHP4 compatibility layer for calling the PHP5 constructor.
54
+ *
55
+ */
56
+ function nggManageAlbum() {
57
+ return $this->__construct();
58
+ }
59
+
60
+ /**
61
+ * Init the album output
62
+ *
63
+ */
64
+ function __construct() {
65
+ return true;
66
+ }
67
+
68
+ function controller() {
69
+ global $nggdb;
70
+
71
+ $this->currentID = isset($_REQUEST['act_album']) ? (int) $_REQUEST['act_album'] : 0 ;
72
+
73
+ if (isset ($_POST['update']) || isset( $_POST['delete'] ) || isset( $_POST['add'] ) )
74
+ $this->processor();
75
+
76
+ if (isset ($_POST['update_album']) )
77
+ $this->update_album();
78
+
79
+ // get first all galleries & albums
80
+ $this->albums = $nggdb->find_all_album();
81
+ $this->galleries = $nggdb->find_all_galleries();
82
+ $this->num_albums = count( $this->albums );
83
+ $this->num_galleries = count( $this->galleries );
84
+ $this->output();
85
+
86
+ }
87
+
88
+ function processor() {
89
+ global $wpdb;
90
+
91
+ check_admin_referer('ngg_album');
92
+
93
+ if ( isset($_POST['add']) && isset ($_POST['newalbum']) ) {
94
+
95
+ if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
96
+ wp_die(__('Cheatin&#8217; uh?'));
97
+
98
+ $result = nggdb::add_album( $_POST['newalbum'] );
99
+ $this->currentID = ($result) ? $result : 0 ;
100
+
101
+ //hook for other plugins
102
+ do_action('ngg_add_album', $this->currentID);
103
+
104
+ if ($result)
105
+ nggGallery::show_message(__('Update Successfully','nggallery'));
106
+ }
107
+
108
+ if ( isset($_POST['update']) && ($this->currentID > 0) ) {
109
+
110
+ $gid = '';
111
+
112
+ // get variable galleryContainer
113
+ parse_str($_POST['sortorder']);
114
+ if ( is_array($gid) ){
115
+ $serial_sort = serialize($gid);
116
+ $wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '$serial_sort' WHERE id = $this->currentID ");
117
+ } else {
118
+ $wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '0' WHERE id = $this->currentID ");
119
+ }
120
+
121
+ //hook for other plugins
122
+ do_action('ngg_update_album_sortorder', $this->currentID);
123
+
124
+ nggGallery::show_message(__('Update Successfully','nggallery'));
125
+
126
+ }
127
+
128
+ if ( isset($_POST['delete']) ) {
129
+
130
+ if (!nggGallery::current_user_can( 'NextGEN Add/Delete album' ))
131
+ wp_die(__('Cheatin&#8217; uh?'));
132
+
133
+ $result = nggdb::delete_album( $this->currentID );
134
+
135
+ //hook for other plugins
136
+ do_action('ngg_delete_album', $this->currentID);
137
+
138
+ // jump back to main selection
139
+ $this->currentID = 0;
140
+
141
+ if ($result)
142
+ nggGallery::show_message(__('Album deleted','nggallery'));
143
+ }
144
+
145
+ }
146
+
147
+ function update_album() {
148
+ global $wpdb, $nggdb;
149
+
150
+ check_admin_referer('ngg_thickbox_form');
151
+
152
+ if (!nggGallery::current_user_can( 'NextGEN Edit album settings' ))
153
+ wp_die(__('Cheatin&#8217; uh?'));
154
+
155
+ $name = $_POST['album_name'];
156
+ $desc = $_POST['album_desc'];
157
+ $prev = (int) $_POST['previewpic'];
158
+ $link = (int) $_POST['pageid'];
159
+
160
+ // slug must be unique, we use the title for that
161
+ $slug = nggdb::get_unique_slug( sanitize_title( $name ), 'album', $this->currentID );
162
+
163
+ $result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->nggalbum SET slug= '%s', name= '%s', albumdesc= '%s', previewpic= %d, pageid= %d WHERE id = '%d'" , $slug, $name, $desc, $prev, $link, $this->currentID ) );
164
+
165
+ //hook for other plugin to update the fields
166
+ do_action('ngg_update_album', $this->currentID, $_POST);
167
+
168
+ if ($result)
169
+ nggGallery::show_message(__('Update Successfully','nggallery'));
170
+ }
171
+
172
+ function output() {
173
+
174
+ global $wpdb, $nggdb;
175
+
176
+ //TODO:Code MUST be optimized, how to flag a used gallery better ?
177
+ $used_list = $this->get_used_galleries();
178
+
179
+ ?>
180
+
181
+ <script type="text/javascript">
182
+
183
+ jQuery(document).ready(
184
+ function()
185
+ {
186
+ jQuery("#previewpic").nggAutocomplete( {
187
+ type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>",width: "95%"
188
+ });
189
+
190
+ jQuery('#selectContainer').sortable( {
191
+ items: '.groupItem',
192
+ placeholder: 'sort_placeholder',
193
+ opacity: 0.7,
194
+ tolerance: 'intersect',
195
+ distance: 2,
196
+ forcePlaceholderSize: true ,
197
+ connectWith: ['#galleryContainer']
198
+ } );
199
+
200
+ jQuery('#galleryContainer').sortable( {
201
+ items: '.groupItem',
202
+ placeholder: 'sort_placeholder',
203
+ opacity: 0.7,
204
+ tolerance: 'intersect',
205
+ distance: 2,
206
+ forcePlaceholderSize: true ,
207
+ connectWith: ['#selectContainer', '#albumContainer']
208
+ } );
209
+
210
+ jQuery('#albumContainer').sortable( {
211
+ items: '.groupItem',
212
+ placeholder: 'sort_placeholder',
213
+ opacity: 0.7,
214
+ tolerance: 'intersect',
215
+ distance: 2,
216
+ forcePlaceholderSize: true ,
217
+ connectWith: ['#galleryContainer']
218
+ } );
219
+
220
+ jQuery('a.min').bind('click', toggleContent);
221
+
222
+ // Hide used galleries
223
+ jQuery('a#toggle_used').click(function()
224
+ {
225
+ jQuery('#selectContainer div.inUse').toggle();
226
+ return false;
227
+ }
228
+ );
229
+
230
+ // Maximize All Portlets (whole site, no differentiation)
231
+ jQuery('a#all_max').click(function()
232
+ {
233
+ jQuery('div.itemContent:hidden').show();
234
+ return false;
235
+ }
236
+ );
237
+
238
+ // Minimize All Portlets (whole site, no differentiation)
239
+ jQuery('a#all_min').click(function()
240
+ {
241
+ jQuery('div.itemContent:visible').hide();
242
+ return false;
243
+ }
244
+ );
245
+ // Auto Minimize if more than 4 (whole site, no differentiation)
246
+ if(jQuery('a.min').length > 4)
247
+ {
248
+ jQuery('a.min').html('[+]');
249
+ jQuery('div.itemContent:visible').hide();
250
+ jQuery('#selectContainer div.inUse').toggle();
251
+ };
252
+ }
253
+ );
254
+
255
+ var toggleContent = function(e)
256
+ {
257
+ var targetContent = jQuery('div.itemContent', this.parentNode.parentNode);
258
+ if (targetContent.css('display') == 'none') {
259
+ targetContent.slideDown(300);
260
+ jQuery(this).html('[-]');
261
+ } else {
262
+ targetContent.slideUp(300);
263
+ jQuery(this).html('[+]');
264
+ }
265
+ return false;
266
+ }
267
+
268
+ function ngg_serialize(s)
269
+ {
270
+ //serial = jQuery.SortSerialize(s);
271
+ serial = jQuery('#galleryContainer').sortable('serialize');
272
+ jQuery('input[name=sortorder]').val(serial);
273
+ }
274
+
275
+ function showDialog() {
276
+ jQuery( "#editalbum").dialog({
277
+ width: 640,
278
+ resizable : false,
279
+ modal: true,
280
+ title: '<?php echo esc_js( __('Edit Album', 'nggallery') ); ?>'
281
+ });
282
+ jQuery('#editalbum .dialog-cancel').click(function() { jQuery( "#editalbum" ).dialog("close"); });
283
+ }
284
+
285
+ </script>
286
+
287
+ <div class="wrap album" id="wrap" >
288
+ <?php include('templates/social_media_buttons.php'); ?>
289
+ <?php screen_icon( 'nextgen-gallery' ); ?>
290
+ <h2><?php esc_html_e('Manage Albums', 'nggallery') ?></h2>
291
+ <form id="selectalbum" method="POST" onsubmit="ngg_serialize()" accept-charset="utf-8">
292
+ <?php wp_nonce_field('ngg_album') ?>
293
+ <input name="sortorder" type="hidden" />
294
+ <div class="albumnav tablenav">
295
+ <div class="alignleft actions">
296
+ <?php esc_html_e('Select album', 'nggallery') ?>
297
+ <select id="act_album" name="act_album" onchange="this.form.submit();">
298
+ <option value="0" ><?php esc_html_e('No album selected', 'nggallery') ?></option>
299
+ <?php
300
+ if( is_array($this->albums) ) {
301
+ foreach($this->albums as $album) {
302
+ $selected = ($this->currentID == $album->id) ? 'selected="selected" ' : '';
303
+ echo '<option value="' . $album->id . '" ' . $selected . '>' . $album->id . ' - ' . esc_attr( $album->name ) . '</option>'."\n";
304
+ }
305
+ }
306
+ ?>
307
+ </select>
308
+ <?php if ($this->currentID > 0){ ?>
309
+ <input class="button-primary" type="submit" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>"/>
310
+ <?php if(nggGallery::current_user_can( 'NextGEN Edit album settings' )) { ?>
311
+ <input class="button-secondary" type="submit" name="showThickbox" value="<?php esc_attr_e( 'Edit album', 'nggallery'); ?>" onclick="showDialog(); return false;" />
312
+ <?php } ?>
313
+ <?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
314
+ <input class="button-secondary action "type="submit" name="delete" value="<?php esc_attr_e('Delete', 'nggallery'); ?>" onclick="javascript:check=confirm('<?php echo esc_js('Delete album ?','nggallery'); ?>');if(check==false) return false;"/>
315
+ <?php } ?>
316
+ <?php } else { ?>
317
+ <?php if(nggGallery::current_user_can( 'NextGEN Add/Delete album' )) { ?>
318
+ <span><?php esc_html_e('Add new album', 'nggallery'); ?>&nbsp;</span>
319
+ <input class="search-input" id="newalbum" name="newalbum" type="text" value="" />
320
+ <input class="button-secondary action" type="submit" name="add" value="<?php esc_attr_e('Add', 'nggallery'); ?>"/>
321
+ <?php } ?>
322
+ <?php } ?>
323
+ </div>
324
+ </div>
325
+ </form>
326
+
327
+ <br class="clear"/>
328
+
329
+ <div>
330
+ <div style="float:right;">
331
+ <a href="#" title="<?php esc_attr_e('Show / hide used galleries','nggallery'); ?>" id="toggle_used"><?php esc_html_e('[Show all]', 'nggallery'); ?></a>
332
+ | <a href="#" title="<?php esc_attr_e('Maximize the widget content','nggallery'); ?>" id="all_max"><?php esc_html_e('[Maximize]', 'nggallery'); ?></a>
333
+ | <a href="#" title="<?php esc_attr_e('Minimize the widget content','nggallery'); ?>" id="all_min"><?php esc_html_e('[Minimize]', 'nggallery'); ?></a>
334
+ </div>
335
+ <?php esc_html_e('After you create and select a album, you can drag and drop a gallery or another album into your new album below','nggallery'); ?>
336
+ </div>
337
+
338
+ <br class="clear" />
339
+
340
+ <div class="container">
341
+
342
+ <!-- /#album container -->
343
+ <div class="widget widget-right">
344
+ <div class="widget-top">
345
+ <h3><?php esc_html_e('Select album', 'nggallery'); ?></h3>
346
+ </div>
347
+ <div id="albumContainer" class="widget-holder">
348
+ <?php
349
+ if( is_array( $this->albums ) ) {
350
+ foreach($this->albums as $album) {
351
+ $this->get_container('a' . $album->id);
352
+ }
353
+ }
354
+ ?>
355
+ </div>
356
+ </div>
357
+
358
+ <!-- /#select container -->
359
+ <div class="widget widget-right">
360
+ <div class="widget-top">
361
+ <h3><?php esc_html_e('Select gallery', 'nggallery'); ?></h3>
362
+ </div>
363
+ <div id="selectContainer" class="widget-holder">
364
+ <?php
365
+
366
+ if( is_array( $this->galleries ) ) {
367
+ //get the array of galleries
368
+ $sort_array = $this->currentID > 0 ? (array) $this->albums[$this->currentID]->galleries : array() ;
369
+ foreach($this->galleries as $gallery) {
370
+ if (!in_array($gallery->gid, $sort_array)) {
371
+ if (in_array($gallery->gid,$used_list))
372
+ $this->get_container($gallery->gid,true);
373
+ else
374
+ $this->get_container($gallery->gid,false);
375
+ }
376
+ }
377
+ }
378
+ ?>
379
+ </div>
380
+ </div>
381
+
382
+ <!-- /#target-album -->
383
+ <div class="widget target-album widget-left">
384
+
385
+ <?php
386
+ if ($this->currentID > 0){
387
+ $album = $this->albums[$this->currentID];
388
+ ?>
389
+ <div class="widget-top">
390
+ <h3><?php esc_html_e('Album ID', 'nggallery'); ?> <?php echo $album->id . ' : ' . esc_html( $album->name ); ?> </h3>
391
+ </div>
392
+ <div id="galleryContainer" class="widget-holder target">
393
+ <?php
394
+ $sort_array = (array) $this->albums[$this->currentID]->galleries;
395
+ foreach($sort_array as $galleryid) {
396
+ $this->get_container($galleryid, false);
397
+ }
398
+ }
399
+ else
400
+ {
401
+ ?>
402
+ <div class="widget-top">
403
+ <h3><?php esc_html_e('No album selected!', 'nggallery'); ?></h3>
404
+ </div>
405
+ <div class="widget-holder target">
406
+ <?php
407
+ }
408
+ ?>
409
+ </div>
410
+ </div><!-- /#target-album -->
411
+
412
+ </div><!-- /#container -->
413
+ </div><!-- /#wrap -->
414
+
415
+ <?php if ($this->currentID > 0) : ?>
416
+ <!-- #editalbum -->
417
+ <div id="editalbum" style="display: none;" >
418
+ <form id="form-edit-album" method="POST" accept-charset="utf-8">
419
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
420
+ <input type="hidden" id="current_album" name="act_album" value="<?php echo $this->currentID; ?>" />
421
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
422
+ <tr>
423
+ <th>
424
+ <?php esc_html_e('Album name:', 'nggallery'); ?><br />
425
+ <input class="search-input" id="album_name" name="album_name" type="text" value="<?php echo esc_attr( $album->name ); ?>" style="width:95%" />
426
+ </th>
427
+ </tr>
428
+ <tr>
429
+ <th>
430
+ <?php esc_html_e('Album description:', 'nggallery'); ?><br />
431
+ <textarea class="search-input" id="album_desc" name="album_desc" cols="50" rows="2" style="width:95%" ><?php echo esc_attr( $album->albumdesc ); ?></textarea>
432
+ </th>
433
+ </tr>
434
+ <tr>
435
+ <th>
436
+ <?php esc_html_e('Select a preview image:', 'nggallery'); ?><br />
437
+ <select id="previewpic" name="previewpic" style="width:95%" >
438
+ <?php if ($album->previewpic == 0) ?>
439
+ <option value="0"><?php esc_html_e('No picture', 'nggallery'); ?></option>
440
+ <?php
441
+ if ($album->previewpic == 0)
442
+ echo '<option value="0" selected="selected">' . __('No picture', 'nggallery') . '</option>';
443
+ else {
444
+ $picture = nggdb::find_image($album->previewpic);
445
+ echo '<option value="' . $picture->pid . '" selected="selected" >'. $picture->pid . ' - ' . ( empty($picture->alltext) ? esc_attr( $picture->filename ) : esc_attr( $picture->alltext ) ) .' </option>'."\n";
446
+ }
447
+ ?>
448
+ </select>
449
+ </th>
450
+ </tr>
451
+ <tr>
452
+ <th>
453
+ <?php esc_html_e('Page Link to', 'nggallery')?><br />
454
+ <select name="pageid" style="width:95%">
455
+ <option value="0" ><?php esc_html_e('Not linked', 'nggallery') ?></option>
456
+ <?php
457
+ if (!isset($album->pageid))
458
+ $album->pageid = 0;
459
+ parent_dropdown($album->pageid); ?>
460
+ </select>
461
+ </th>
462
+ </tr>
463
+
464
+ <?php do_action('ngg_edit_album_settings', $this->currentID); ?>
465
+
466
+ <tr align="right">
467
+ <td class="submit">
468
+ <input type="submit" class="button-primary" name="update_album" value="<?php esc_attr_e('OK', 'nggallery'); ?>" />
469
+ &nbsp;
470
+ <input class="button-secondary dialog-cancel" type="reset" value="<?php esc_attr_e('Cancel', 'nggallery'); ?>"/>
471
+ </td>
472
+ </tr>
473
+ </table>
474
+ </form>
475
+ </div>
476
+ <!-- /#editalbum -->
477
+ <?php endif; ?>
478
+
479
+ <?php
480
+
481
+ }
482
+
483
+ /**
484
+ * Create the album or gallery container
485
+ *
486
+ * @param integer $id (the prefix 'a' indidcates that you look for a album
487
+ * @param bool $used (object will be hidden)
488
+ * @return $output
489
+ */
490
+ function get_container($id = 0, $used = false) {
491
+ global $wpdb, $nggdb;
492
+
493
+ $obj = array();
494
+ $preview_image = '';
495
+ $class = '';
496
+
497
+ // if the id started with a 'a', then it's a sub album
498
+ if (substr( $id, 0, 1) == 'a') {
499
+
500
+ if ( !$album = $this->albums[ substr( $id, 1) ] )
501
+ return;
502
+
503
+ $obj['id'] = $album->id;
504
+ $obj['name'] = $obj['title'] = $album->name;
505
+ $obj['type'] = 'album';
506
+ $class = 'album_obj';
507
+
508
+ // get the post name
509
+ $post = get_post($album->pageid);
510
+ $obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
511
+
512
+ // for speed reason we limit it to 50
513
+ if ( $this->num_albums < 50 ) {
514
+ if ($album->previewpic != 0) {
515
+ $image = $nggdb->find_image( $album->previewpic );
516
+ $preview_image = ( !is_null($image->thumbURL) ) ? '<div class="inlinepicture"><img src="' . esc_url( $image->thumbURL ). '" /></div>' : '';
517
+ }
518
+ }
519
+
520
+ // this indicates that we have a album container
521
+ $prefix = 'a';
522
+
523
+ } else {
524
+ if ( !$gallery = $nggdb->find_gallery( $id ) )
525
+ return;
526
+
527
+ $obj['id'] = $gallery->gid;
528
+ $obj['name'] = $gallery->name;
529
+ $obj['title'] = $gallery->title;
530
+ $obj['type'] = 'gallery';
531
+
532
+ // get the post name
533
+ $post = get_post($gallery->pageid);
534
+ $obj['pagenname'] = ($post == null) ? '---' : $post->post_title;
535
+
536
+ // for spped reason we limit it to 50
537
+ if ( $this->num_galleries < 50 ) {
538
+ // set image url
539
+ $image = $nggdb->find_image( $gallery->previewpic );
540
+ $preview_image = isset($image->thumbURL) ? '<div class="inlinepicture"><img src="' . esc_url( $image->thumbURL ) . '" /></div>' : '';
541
+ }
542
+
543
+ $prefix = '';
544
+ }
545
+
546
+ // add class if it's in use in other albums
547
+ $used = $used ? ' inUse' : '';
548
+
549
+ echo '<div id="gid-' . $prefix . $obj['id'] . '" class="groupItem' . $used . '">
550
+ <div class="innerhandle">
551
+ <div class="item_top ' . $class . '">
552
+ <a href="#" class="min" title="close">[-]</a>
553
+ ID: ' . $obj['id'] . ' | ' . wp_html_excerpt( esc_html ( nggGallery::i18n( $obj['title'] ) ) , 25) . '
554
+ </div>
555
+ <div class="itemContent">
556
+ ' . $preview_image . '
557
+ <p><strong>' . __('Name', 'nggallery') . ' : </strong>' . esc_html ( nggGallery::i18n( $obj['name'] ) ). '</p>
558
+ <p><strong>' . __('Title', 'nggallery') . ' : </strong>' . esc_html ( nggGallery::i18n( $obj['title'] ) ) . '</p>
559
+ <p><strong>' . __('Page', 'nggallery'). ' : </strong>' . esc_html ( nggGallery::i18n( $obj['pagenname'] ) ) . '</p>
560
+ ' . apply_filters('ngg_display_album_item_content', '', $obj) . '
561
+ </div>
562
+ </div>
563
+ </div>';
564
+ }
565
+
566
+ /**
567
+ * get all used galleries from all albums
568
+ *
569
+ * @return array $used_galleries_ids
570
+ */
571
+ function get_used_galleries() {
572
+
573
+ $used = array();
574
+
575
+ if ($this->albums) {
576
+ foreach($this->albums as $key => $value) {
577
+ $sort_array = $this->albums[$key]->galleries;
578
+ foreach($sort_array as $galleryid) {
579
+ if (!in_array($galleryid, $used))
580
+ $used[] = $galleryid;
581
+ }
582
+ }
583
+ }
584
+
585
+ return $used;
586
+ }
587
+
588
+ /**
589
+ * PHP5 style destructor
590
+ *
591
+ * @return bool Always true
592
+ */
593
+ function __destruct() {
594
+ return true;
595
+ }
596
+
597
  }
admin/css/menu.css CHANGED
@@ -1,14 +1,3 @@
1
- #adminmenu #toplevel_page_nextgen-gallery div.wp-menu-image,
2
- #oam_toplevel_page_nextgen-gallery div.wp-menu-image {
3
- background: transparent url('../images/nextgen_16_grey.png') no-repeat scroll 6px 6px;
4
- }
5
- #adminmenu #toplevel_page_nextgen-gallery:hover div.wp-menu-image,
6
- #adminmenu #toplevel_page_nextgen-gallery.wp-has-current-submenu div.wp-menu-image,
7
- #adminmenu #toplevel_page_nextgen-gallery.current div.wp-menu-image,
8
- #oam_toplevel_page_nextgen-gallery:hover div.wp-menu-image {
9
- background: transparent url('../images/nextgen_16_color.png') no-repeat scroll 6px 6px;
10
- }
11
-
12
  #icon-nextgen-gallery {
13
  background:url("../images/nextgen_32_grey.png") no-repeat scroll 1px 1px transparent;
14
  }
 
 
 
 
 
 
 
 
 
 
 
1
  #icon-nextgen-gallery {
2
  background:url("../images/nextgen_32_grey.png") no-repeat scroll 1px 1px transparent;
3
  }
admin/css/ngg_social_media.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ngg_social_media {
2
+ margin-top: -2px;
3
+ width: 85%;
4
+ position: relative;
5
+ overflow: hidden;
6
+ height: 20px;
7
+ }
8
+
9
+ .gallery_page_nggallery-manage-gallery #ngg_social_media,
10
+ .gallery_page_nggallery-manage-album #ngg_social_media,
11
+ .gallery_page_nggallery-tags #ngg_social_media,
12
+ .gallery_page_nggallery-roles #ngg_social_media,
13
+ .gallery_page_nggallery-about #ngg_social_media,
14
+ .toplevel_page_nextgen-gallery #ngg_social_media {
15
+ float: right;
16
+ width: 55%;
17
+ }
18
+
19
+ #ngg_facebook_like {
20
+ position: absolute;
21
+ right: -368px;
22
+ }
23
+
24
+ #ngg_social_media .twitter-follow-button {
25
+ position: absolute;
26
+ right: 85px;
27
+ }
28
+
29
+ #slider {
30
+ margin-top: 5px !important;
31
+ }
admin/edit-thumbnail.php CHANGED
@@ -1,171 +1,171 @@
1
- <?php
2
-
3
- /**
4
-
5
- Custom thumbnail for NGG
6
- Author : Simone Fumagalli | simone@iliveinperego.com
7
- More info and update : http://www.iliveinperego.com/custom_thumbnail_for_ngg/
8
-
9
- Credits:
10
- NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
11
- jCrop : Kelly Hallman <khallman@wrack.org> | http://deepliquid.com/content/Jcrop.html
12
-
13
- **/
14
-
15
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
16
- require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
17
-
18
- if ( !is_user_logged_in() )
19
- die(__('Cheatin&#8217; uh?'));
20
-
21
- if ( !current_user_can('NextGEN Manage gallery') )
22
- die(__('Cheatin&#8217; uh?'));
23
-
24
- global $wpdb;
25
-
26
- $id = (int) $_GET['id'];
27
-
28
- // let's get the image data
29
- $picture = nggdb::find_image($id);
30
-
31
- include_once( nggGallery::graphic_library() );
32
- $ngg_options=get_option('ngg_options');
33
-
34
- $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
35
- $thumb->resize(350,350);
36
- // we need the new dimension
37
- $resizedPreviewInfo = $thumb->newDimensions;
38
- $thumb->destruct();
39
-
40
- $preview_image = NGGALLERY_URLPATH . 'nggshow.php?pid=' . $picture->pid . '&amp;width=350&amp;height=350';
41
- $imageInfo = @getimagesize($picture->imagePath);
42
- $rr = round($imageInfo[0] / $resizedPreviewInfo['newWidth'], 2);
43
-
44
- if ( ($ngg_options['thumbfix'] == 1) ) {
45
-
46
- $WidthHtmlPrev = $ngg_options['thumbwidth'];
47
- $HeightHtmlPrev = $ngg_options['thumbheight'];
48
-
49
- } else {
50
- // H > W
51
- if ($imageInfo[1] > $imageInfo[0]) {
52
-
53
- $HeightHtmlPrev = $ngg_options['thumbheight'];
54
- $WidthHtmlPrev = round($imageInfo[0] / ($imageInfo[1] / $ngg_options['thumbheight']),0);
55
-
56
- } else {
57
-
58
- $WidthHtmlPrev = $ngg_options['thumbwidth'];
59
- $HeightHtmlPrev = round($imageInfo[1] / ($imageInfo[0] / $ngg_options['thumbwidth']),0);
60
-
61
- }
62
- }
63
-
64
- ?>
65
- <script src="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/js/jquery.Jcrop.js"></script>
66
- <link rel="stylesheet" href="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/css/jquery.Jcrop.css" type="text/css" />
67
-
68
- <script type="text/javascript">
69
- //<![CDATA[
70
- var status = 'start';
71
- var xT, yT, wT, hT, selectedCoords;
72
- var selectedImage = "thumb<?php echo $id ?>";
73
-
74
- function showPreview(coords)
75
- {
76
-
77
- if (status != 'edit') {
78
- jQuery('#actualThumb').hide();
79
- jQuery('#previewNewThumb').show();
80
- status = 'edit';
81
- }
82
-
83
- var rx = <?php echo $WidthHtmlPrev; ?> / coords.w;
84
- var ry = <?php echo $HeightHtmlPrev; ?> / coords.h;
85
-
86
- jQuery('#imageToEditPreview').css({
87
- width: Math.round(rx * <?php echo $resizedPreviewInfo['newWidth']; ?>) + 'px',
88
- height: Math.round(ry * <?php echo $resizedPreviewInfo['newHeight']; ?>) + 'px',
89
- marginLeft: '-' + Math.round(rx * coords.x) + 'px',
90
- marginTop: '-' + Math.round(ry * coords.y) + 'px'
91
- });
92
-
93
- xT = coords.x;
94
- yT = coords.y;
95
- wT = coords.w;
96
- hT = coords.h;
97
-
98
- jQuery("#sizeThumb").html(xT+" "+yT+" "+wT+" "+hT);
99
-
100
- };
101
-
102
- function updateThumb() {
103
-
104
- if ( (wT == 0) || (hT == 0) || (wT == undefined) || (hT == undefined) ) {
105
- alert("<?php _e('Select with the mouse the area for the new thumbnail', 'nggallery'); ?>");
106
- return false;
107
- }
108
-
109
- jQuery.ajax({
110
- url: ajaxurl,
111
- type : "POST",
112
- data: {x: xT, y: yT, w: wT, h: hT, action: 'createNewThumb', id: <?php echo $id; ?>, rr: <?php echo str_replace(',','.',$rr); ?>},
113
- cache: false,
114
- success: function(data){
115
- var d = new Date();
116
- newUrl = jQuery("#"+selectedImage).attr("src") + "?" + d.getTime();
117
- jQuery("#"+selectedImage).attr("src" , newUrl);
118
-
119
- jQuery('#thumbMsg').html("<?php _e('Thumbnail updated', 'nggallery') ?>");
120
- jQuery('#thumbMsg').css({'display':'block'});
121
- setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
122
- },
123
- error: function() {
124
- jQuery('#thumbMsg').html("<?php _e('Error updating thumbnail', 'nggallery') ?>");
125
- jQuery('#thumbMsg').css({'display':'block'});
126
- setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
127
- }
128
- });
129
-
130
- };
131
- //]]>
132
- </script>
133
-
134
- <table width="98%" align="center" style="border:1px solid #DADADA">
135
- <tr>
136
- <td rowspan="3" valign="middle" align="center" width="350" style="background-color:#DADADA;">
137
- <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
138
- </td>
139
- <td width="300" style="background-color : #DADADA;">
140
- <small style="margin-left:6px; display:block;"><?php esc_html_e('Select the area for the thumbnail from the picture on the left.', 'nggallery'); ?></small>
141
- </td>
142
- </tr>
143
- <tr>
144
- <td align="center" width="300" height="320">
145
- <div id="previewNewThumb" style="display:none;width:<?php echo $WidthHtmlPrev; ?>px;height:<?php echo $HeightHtmlPrev; ?>px;overflow:hidden; margin-left:5px;">
146
- <img src="<?php echo esc_url( $preview_image ); ?>" id="imageToEditPreview" />
147
- </div>
148
- <div id="actualThumb">
149
- <img src="<?php echo esc_url( $picture->thumbURL ); ?>?<?php echo time()?>" />
150
- </div>
151
- </td>
152
- </tr>
153
- <tr style="background-color:#DADADA;">
154
- <td>
155
- <input type="button" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>" onclick="updateThumb()" class="button-secondary" style="float:left; margin-left:4px;"/>
156
- <div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
157
- </td>
158
- </tr>
159
- </table>
160
-
161
- <script type="text/javascript">
162
- //<![CDATA[
163
- jQuery(document).ready(function(){
164
- jQuery('#imageToEdit').Jcrop({
165
- onChange: showPreview,
166
- onSelect: showPreview,
167
- aspectRatio: <?php echo str_replace(',', '.', round($WidthHtmlPrev/$HeightHtmlPrev, 3)); ?>
168
- });
169
- });
170
- //]]>
171
  </script>
1
+ <?php
2
+
3
+ /**
4
+
5
+ Custom thumbnail for NGG
6
+ Author : Simone Fumagalli | simone@iliveinperego.com
7
+ More info and update : http://www.iliveinperego.com/custom_thumbnail_for_ngg/
8
+
9
+ Credits:
10
+ NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
11
+ jCrop : Kelly Hallman <khallman@wrack.org> | http://deepliquid.com/content/Jcrop.html
12
+
13
+ **/
14
+
15
+ require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
16
+ require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
17
+
18
+ if ( !is_user_logged_in() )
19
+ die(__('Cheatin&#8217; uh?'));
20
+
21
+ if ( !current_user_can('NextGEN Manage gallery') )
22
+ die(__('Cheatin&#8217; uh?'));
23
+
24
+ global $wpdb;
25
+
26
+ $id = (int) $_GET['id'];
27
+
28
+ // let's get the image data
29
+ $picture = nggdb::find_image($id);
30
+
31
+ include_once( nggGallery::graphic_library() );
32
+ $ngg_options=get_option('ngg_options');
33
+
34
+ $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
35
+ $thumb->resize(350,350);
36
+ // we need the new dimension
37
+ $resizedPreviewInfo = $thumb->newDimensions;
38
+ $thumb->destruct();
39
+
40
+ $preview_image = NGGALLERY_URLPATH . 'nggshow.php?pid=' . $picture->pid . '&amp;width=350&amp;height=350';
41
+ $imageInfo = @getimagesize($picture->imagePath);
42
+ $rr = round($imageInfo[0] / $resizedPreviewInfo['newWidth'], 2);
43
+
44
+ if ( ($ngg_options['thumbfix'] == 1) ) {
45
+
46
+ $WidthHtmlPrev = $ngg_options['thumbwidth'];
47
+ $HeightHtmlPrev = $ngg_options['thumbheight'];
48
+
49
+ } else {
50
+ // H > W
51
+ if ($imageInfo[1] > $imageInfo[0]) {
52
+
53
+ $HeightHtmlPrev = $ngg_options['thumbheight'];
54
+ $WidthHtmlPrev = round($imageInfo[0] / ($imageInfo[1] / $ngg_options['thumbheight']),0);
55
+
56
+ } else {
57
+
58
+ $WidthHtmlPrev = $ngg_options['thumbwidth'];
59
+ $HeightHtmlPrev = round($imageInfo[1] / ($imageInfo[0] / $ngg_options['thumbwidth']),0);
60
+
61
+ }
62
+ }
63
+
64
+ ?>
65
+ <script src="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/js/jquery.Jcrop.js"></script>
66
+ <link rel="stylesheet" href="<?php echo NGGALLERY_URLPATH; ?>/admin/js/Jcrop/css/jquery.Jcrop.css" type="text/css" />
67
+
68
+ <script type="text/javascript">
69
+ //<![CDATA[
70
+ var status = 'start';
71
+ var xT, yT, wT, hT, selectedCoords;
72
+ var selectedImage = "thumb<?php echo $id ?>";
73
+
74
+ function showPreview(coords)
75
+ {
76
+
77
+ if (status != 'edit') {
78
+ jQuery('#actualThumb').hide();
79
+ jQuery('#previewNewThumb').show();
80
+ status = 'edit';
81
+ }
82
+
83
+ var rx = <?php echo $WidthHtmlPrev; ?> / coords.w;
84
+ var ry = <?php echo $HeightHtmlPrev; ?> / coords.h;
85
+
86
+ jQuery('#imageToEditPreview').css({
87
+ width: Math.round(rx * <?php echo $resizedPreviewInfo['newWidth']; ?>) + 'px',
88
+ height: Math.round(ry * <?php echo $resizedPreviewInfo['newHeight']; ?>) + 'px',
89
+ marginLeft: '-' + Math.round(rx * coords.x) + 'px',
90
+ marginTop: '-' + Math.round(ry * coords.y) + 'px'
91
+ });
92
+
93
+ xT = coords.x;
94
+ yT = coords.y;
95
+ wT = coords.w;
96
+ hT = coords.h;
97
+
98
+ jQuery("#sizeThumb").html(xT+" "+yT+" "+wT+" "+hT);
99
+
100
+ };
101
+
102
+ function updateThumb() {
103
+
104
+ if ( (wT == 0) || (hT == 0) || (wT == undefined) || (hT == undefined) ) {
105
+ alert("<?php _e('Select with the mouse the area for the new thumbnail', 'nggallery'); ?>");
106
+ return false;
107
+ }
108
+
109
+ jQuery.ajax({
110
+ url: ajaxurl,
111
+ type : "POST",
112
+ data: {x: xT, y: yT, w: wT, h: hT, action: 'createNewThumb', id: <?php echo $id; ?>, rr: <?php echo str_replace(',','.',$rr); ?>},
113
+ cache: false,
114
+ success: function(data){
115
+ var d = new Date();
116
+ newUrl = jQuery("#"+selectedImage).attr("src") + "?" + d.getTime();
117
+ jQuery("#"+selectedImage).attr("src" , newUrl);
118
+
119
+ jQuery('#thumbMsg').html("<?php _e('Thumbnail updated', 'nggallery') ?>");
120
+ jQuery('#thumbMsg').css({'display':'block'});
121
+ setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
122
+ },
123
+ error: function() {
124
+ jQuery('#thumbMsg').html("<?php _e('Error updating thumbnail', 'nggallery') ?>");
125
+ jQuery('#thumbMsg').css({'display':'block'});
126
+ setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
127
+ }
128
+ });
129
+
130
+ };
131
+ //]]>
132
+ </script>
133
+
134
+ <table width="98%" align="center" style="border:1px solid #DADADA">
135
+ <tr>
136
+ <td rowspan="3" valign="middle" align="center" width="350" style="background-color:#DADADA;">
137
+ <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
138
+ </td>
139
+ <td width="300" style="background-color : #DADADA;">
140
+ <small style="margin-left:6px; display:block;"><?php esc_html_e('Select the area for the thumbnail from the picture on the left.', 'nggallery'); ?></small>
141
+ </td>
142
+ </tr>
143
+ <tr>
144
+ <td align="center" width="300" height="320">
145
+ <div id="previewNewThumb" style="display:none;width:<?php echo $WidthHtmlPrev; ?>px;height:<?php echo $HeightHtmlPrev; ?>px;overflow:hidden; margin-left:5px;">
146
+ <img src="<?php echo esc_url( $preview_image ); ?>" id="imageToEditPreview" />
147
+ </div>
148
+ <div id="actualThumb">
149
+ <img src="<?php echo esc_url( $picture->thumbURL ); ?>?<?php echo time()?>" />
150
+ </div>
151
+ </td>
152
+ </tr>
153
+ <tr style="background-color:#DADADA;">
154
+ <td>
155
+ <input type="button" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>" onclick="updateThumb()" class="button-secondary" style="float:left; margin-left:4px;"/>
156
+ <div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
157
+ </td>
158
+ </tr>
159
+ </table>
160
+
161
+ <script type="text/javascript">
162
+ //<![CDATA[
163
+ jQuery(document).ready(function(){
164
+ jQuery('#imageToEdit').Jcrop({
165
+ onChange: showPreview,
166
+ onSelect: showPreview,
167
+ aspectRatio: <?php echo str_replace(',', '.', round($WidthHtmlPrev/$HeightHtmlPrev, 3)); ?>
168
+ });
169
+ });
170
+ //]]>
171
  </script>
admin/functions.php CHANGED
@@ -1,1501 +1,1501 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
-
5
- /**
6
- * nggAdmin - Class for admin operation
7
- *
8
- * @package NextGEN Gallery
9
- * @author Alex Rabe
10
- * @copyright 2007-2010
11
- * @access public
12
- */
13
- class nggAdmin{
14
-
15
- /**
16
- * create a new gallery & folder
17
- *
18
- * @class nggAdmin
19
- * @param string $name of the gallery
20
- * @param string $defaultpath
21
- * @param bool $output if the function should show an error messsage or not
22
- * @return
23
- */
24
- function create_gallery($title, $defaultpath, $output = true) {
25
-
26
- global $user_ID;
27
-
28
- // get the current user ID
29
- get_currentuserinfo();
30
-
31
- //cleanup pathname
32
- $name = sanitize_file_name( sanitize_title($title) );
33
- $name = apply_filters('ngg_gallery_name', $name);
34
- $nggRoot = WINABSPATH . $defaultpath;
35
- $txt = '';
36
-
37
- // No gallery name ?
38
- if ( empty($name) ) {
39
- if ($output) nggGallery::show_error( __('No valid gallery name!', 'nggallery') );
40
- return false;
41
- }
42
-
43
- // check for main folder
44
- if ( !is_dir($nggRoot) ) {
45
- if ( !wp_mkdir_p( $nggRoot ) ) {
46
- $txt = __('Directory', 'nggallery').' <strong>' . esc_html( $defaultpath ) . '</strong> '.__('didn\'t exist. Please create first the main gallery folder ', 'nggallery').'!<br />';
47
- $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'nggallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
48
- if ($output) nggGallery::show_error($txt);
49
- return false;
50
- }
51
- }
52
-
53
- // check for permission settings, Safe mode limitations are not taken into account.
54
- if ( !is_writeable( $nggRoot ) ) {
55
- $txt = __('Directory', 'nggallery').' <strong>' . esc_html( $defaultpath ) . '</strong> '.__('is not writeable !', 'nggallery').'<br />';
56
- $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'nggallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
57
- if ($output) nggGallery::show_error($txt);
58
- return false;
59
- }
60
-
61
- // 1. Check for existing folder
62
- if ( is_dir(WINABSPATH . $defaultpath . $name ) && !(SAFE_MODE) ) {
63
- $suffix = 1;
64
- do {
65
- $alt_name = substr ($name, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "_$suffix";
66
- $dir_check = is_dir(WINABSPATH . $defaultpath . $alt_name );
67
- $suffix++;
68
- } while ( $dir_check );
69
- $name = $alt_name;
70
- }
71
- // define relative path to gallery inside wp root folder
72
- $nggpath = $defaultpath . $name;
73
-
74
- // 2. Create new gallery folder
75
- if ( !wp_mkdir_p (WINABSPATH . $nggpath) )
76
- $txt = __('Unable to create directory ', 'nggallery') . esc_html( $nggpath ) . '!<br />';
77
-
78
- // 3. Check folder permission
79
- if ( !is_writeable(WINABSPATH . $nggpath ) )
80
- $txt .= __('Directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '</strong> '.__('is not writeable !', 'nggallery').'<br />';
81
-
82
- // 4. Now create thumbnail folder inside
83
- if ( !is_dir(WINABSPATH . $nggpath . '/thumbs') ) {
84
- if ( !wp_mkdir_p ( WINABSPATH . $nggpath . '/thumbs') )
85
- $txt .= __('Unable to create directory ', 'nggallery').' <strong>' . esc_html( $nggpath ) . '/thumbs !</strong>';
86
- }
87
-
88
- if (SAFE_MODE) {
89
- $help = __('The server setting Safe-Mode is on !', 'nggallery');
90
- $help .= '<br />'.__('If you have problems, please create directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '</strong> ';
91
- $help .= __('and the thumbnails directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '/thumbs</strong> '.__('with permission 777 manually !', 'nggallery');
92
- if ($output) nggGallery::show_message($help);
93
- }
94
-
95
- // show a error message
96
- if ( !empty($txt) ) {
97
- if (SAFE_MODE) {
98
- // for safe_mode , better delete folder, both folder must be created manually
99
- @rmdir(WINABSPATH . $nggpath . '/thumbs');
100
- @rmdir(WINABSPATH . $nggpath);
101
- }
102
- if ($output) nggGallery::show_error($txt);
103
- return false;
104
- }
105
-
106
- // now add the gallery to the database
107
- $galleryID = nggdb::add_gallery($title, $nggpath, '', 0, 0, $user_ID );
108
- // here you can inject a custom function
109
- do_action('ngg_created_new_gallery', $galleryID);
110
-
111
- // return only the id if defined
112
- if ($output == false)
113
- return $galleryID;
114
-
115
- if ($galleryID != false) {
116
- $message = __('Gallery ID %1$s successfully created. You can show this gallery in your post or page with the shortcode %2$s.<br/>','nggallery');
117
- $message = sprintf($message, $galleryID, '<strong>[nggallery id=' . $galleryID . ']</strong>');
118
- $message .= '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $galleryID . '" >';
119
- $message .= __('Edit gallery','nggallery');
120
- $message .= '</a>';
121
-
122
- if ($output) nggGallery::show_message($message);
123
- }
124
- return true;
125
- }
126
-
127
- /**
128
- * nggAdmin::import_gallery()
129
- * TODO: Check permission of existing thumb folder & images
130
- *
131
- * @class nggAdmin
132
- * @param string $galleryfolder contains relative path to the gallery itself
133
- * @return void
134
- */
135
- function import_gallery($galleryfolder) {
136
-
137
- global $wpdb, $user_ID;
138
-
139
- // get the current user ID
140
- get_currentuserinfo();
141
-
142
- $created_msg = '';
143
-
144
- // remove trailing slash at the end, if somebody use it
145
- $galleryfolder = untrailingslashit($galleryfolder);
146
- $gallerypath = WINABSPATH . $galleryfolder;
147
-
148
- if (!is_dir($gallerypath)) {
149
- nggGallery::show_error(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) .'</strong> '.__('doesn&#96;t exist!', 'nggallery'));
150
- return ;
151
- }
152
-
153
- // read list of images
154
- $new_imageslist = nggAdmin::scandir($gallerypath);
155
-
156
- if (empty($new_imageslist)) {
157
- nggGallery::show_message(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) . '</strong> '.__('contains no pictures', 'nggallery'));
158
- return;
159
- }
160
-
161
- // check & create thumbnail folder
162
- if ( !nggGallery::get_thumbnail_folder($gallerypath) )
163
- return;
164
-
165
- // take folder name as gallery name
166
- $galleryname = basename($galleryfolder);
167
- $galleryname = apply_filters('ngg_gallery_name', $galleryname);
168
-
169
- // check for existing gallery folder
170
- $gallery_id = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE path = '$galleryfolder' ");
171
-
172
- if (!$gallery_id) {
173
- // now add the gallery to the database
174
- $gallery_id = nggdb::add_gallery( $galleryname, $galleryfolder, '', 0, 0, $user_ID );
175
- if (!$gallery_id) {
176
- nggGallery::show_error(__('Database error. Could not add gallery!','nggallery'));
177
- return;
178
- }
179
- $created_msg = _n( 'Gallery', 'Galleries', 1, 'nggallery' ) . ' <strong>' . esc_html( $galleryname ) . '</strong> ' . __('successfully created!','nggallery') . '<br />';
180
- }
181
-
182
- // Look for existing image list
183
- $old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$gallery_id' ");
184
-
185
- // if no images are there, create empty array
186
- if ($old_imageslist == NULL)
187
- $old_imageslist = array();
188
-
189
- // check difference
190
- $new_images = array_diff($new_imageslist, $old_imageslist);
191
-
192
- // all images must be valid files
193
- foreach($new_images as $key => $picture) {
194
-
195
- // filter function to rename/change/modify image before
196
- $picture = apply_filters('ngg_pre_add_new_image', $picture, $gallery_id);
197
- $new_images[$key] = $picture;
198
-
199
- if (!@getimagesize($gallerypath . '/' . $picture) ) {
200
- unset($new_images[$key]);
201
- @unlink($gallerypath . '/' . $picture);
202
- }
203
- }
204
-
205
- // add images to database
206
- $image_ids = nggAdmin::add_Images($gallery_id, $new_images);
207
-
208
- //add the preview image if needed
209
- nggAdmin::set_gallery_preview ( $gallery_id );
210
-
211
- // now create thumbnails
212
- nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
213
-
214
- //TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
215
- $message = $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery');
216
- $message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
217
- $message .= __('Edit gallery','nggallery');
218
- $message .= '</a>]';
219
-
220
- nggGallery::show_message($message);
221
-
222
- return;
223
-
224
- }
225
-
226
- /**
227
- * Scan folder for new images
228
- *
229
- * @class nggAdmin
230
- * @param string $dirname
231
- * @return array $files list of image filenames
232
- */
233
- function scandir( $dirname = '.' ) {
234
- $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
235
-
236
- $files = array();
237
- if( $handle = opendir( $dirname ) ) {
238
- while( false !== ( $file = readdir( $handle ) ) ) {
239
- $info = pathinfo( $file );
240
- // just look for images with the correct extension
241
- if ( isset($info['extension']) )
242
- if ( in_array( strtolower($info['extension']), $ext) )
243
- $files[] = utf8_encode( $file );
244
- }
245
- closedir( $handle );
246
- }
247
- sort( $files );
248
- return ( $files );
249
- }
250
-
251
- /**
252
- * nggAdmin::createThumbnail() - function to create or recreate a thumbnail
253
- *
254
- * @class nggAdmin
255
- * @param object | int $image contain all information about the image or the id
256
- * @return string result code
257
- * @since v1.0.0
258
- */
259
- function create_thumbnail($image) {
260
-
261
- global $ngg;
262
-
263
- if(! class_exists('ngg_Thumbnail'))
264
- require_once( nggGallery::graphic_library() );
265
-
266
- if ( is_numeric($image) )
267
- $image = nggdb::find_image( $image );
268
-
269
- if ( !is_object($image) )
270
- return __('Object didn\'t contain correct data','nggallery');
271
-
272
- // before we start we import the meta data to database (required for uploads before V1.4.0)
273
- nggAdmin::maybe_import_meta( $image->pid );
274
-
275
- // check for existing thumbnail
276
- if (file_exists($image->thumbPath))
277
- if (!is_writable($image->thumbPath))
278
- return esc_html( $image->filename ) . __(' is not writeable ','nggallery');
279
-
280
- $thumb = new ngg_Thumbnail($image->imagePath, TRUE);
281
-
282
- // skip if file is not there
283
- if (!$thumb->error) {
284
- if ($ngg->options['thumbfix']) {
285
-
286
- // calculate correct ratio
287
- $wratio = $ngg->options['thumbwidth'] / $thumb->currentDimensions['width'];
288
- $hratio = $ngg->options['thumbheight'] / $thumb->currentDimensions['height'];
289
-
290
- if ($wratio > $hratio) {
291
- // first resize to the wanted width
292
- $thumb->resize($ngg->options['thumbwidth'], 0);
293
- // get optimal y startpos
294
- $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
295
- $thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
296
- } else {
297
- // first resize to the wanted height
298
- $thumb->resize(0, $ngg->options['thumbheight']);
299
- // get optimal x startpos
300
- $xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
301
- $thumb->crop($xpos, 0, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
302
- }
303
- //this create a thumbnail but keep ratio settings
304
- } else {
305
- $thumb->resize($ngg->options['thumbwidth'],$ngg->options['thumbheight']);
306
- }
307
-
308
- // save the new thumbnail
309
- $thumb->save($image->thumbPath, $ngg->options['thumbquality']);
310
- nggAdmin::chmod ($image->thumbPath);
311
-
312
- //read the new sizes
313
- $new_size = @getimagesize ( $image->thumbPath );
314
- $size['width'] = $new_size[0];
315
- $size['height'] = $new_size[1];
316
-
317
- // add them to the database
318
- nggdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
319
- }
320
-
321
- $thumb->destruct();
322
-
323
- if ( !empty($thumb->errmsg) )
324
- return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$thumb->errmsg .')</strong>';
325
-
326
- // success
327
- return '1';
328
- }
329
-
330
- /**
331
- * nggAdmin::resize_image() - create a new image, based on the height /width
332
- *
333
- * @class nggAdmin
334
- * @param object | int $image contain all information about the image or the id
335
- * @param integer $width optional
336
- * @param integer $height optional
337
- * @return string result code
338
- */
339
- function resize_image($image, $width = 0, $height = 0) {
340
-
341
- global $ngg;
342
-
343
- if(! class_exists('ngg_Thumbnail'))
344
- require_once( nggGallery::graphic_library() );
345
-
346
- if ( is_numeric($image) )
347
- $image = nggdb::find_image( $image );
348
-
349
- if ( !is_object($image) )
350
- return __('Object didn\'t contain correct data','nggallery');
351
-
352
- // before we start we import the meta data to database (required for uploads before V1.4.0)
353
- nggAdmin::maybe_import_meta( $image->pid );
354
-
355
- // if no parameter is set, take global settings
356
- $width = ($width == 0) ? $ngg->options['imgWidth'] : $width;
357
- $height = ($height == 0) ? $ngg->options['imgHeight'] : $height;
358
-
359
- if (!is_writable($image->imagePath))
360
- return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
361
-
362
- $file = new ngg_Thumbnail($image->imagePath, TRUE);
363
-
364
- // skip if file is not there
365
- if (!$file->error) {
366
-
367
- // If required save a backup copy of the file
368
- if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
369
- @copy ($image->imagePath, $image->imagePath . '_backup');
370
-
371
- $file->resize($width, $height);
372
- $file->save($image->imagePath, $ngg->options['imgQuality']);
373
- // read the new sizes
374
- $size = @getimagesize ( $image->imagePath );
375
- // add them to the database
376
- nggdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
377
- $file->destruct();
378
- } else {
379
- $file->destruct();
380
- return ' <strong>' . esc_html( $image->filename ) . ' (Error : ' . $file->errmsg . ')</strong>';
381
- }
382
-
383
- return '1';
384
- }
385
-
386
- /**
387
- * Rotated/Flip an image based on the orientation flag or a definded angle
388
- *
389
- * @param int|object $image
390
- * @param string (optional) $dir, CW (clockwise)or CCW (counter clockwise), if set to false, the exif flag will be used
391
- * @param string (optional) $flip, could be either false | V (flip vertical) | H (flip horizontal)
392
- * @return string result code
393
- */
394
- function rotate_image($image, $dir = false, $flip = false) {
395
-
396
- global $ngg;
397
-
398
- if(! class_exists('ngg_Thumbnail'))
399
- require_once( nggGallery::graphic_library() );
400
-
401
- if ( is_numeric($image) )
402
- $image = nggdb::find_image( $image );
403
-
404
- if ( !is_object($image) )
405
- return __('Object didn\'t contain correct data','nggallery');
406
-
407
- if (!is_writable($image->imagePath))
408
- return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
409
-
410
- // if you didn't define a rotation, we look for the orientation flag in EXIF
411
- if ( $dir === false ) {
412
- $meta = new nggMeta( $image->pid );
413
- $exif = $meta->get_EXIF();
414
-
415
- if (isset($exif['Orientation'])) {
416
-
417
- switch ($exif['Orientation']) {
418
- case 5 : // vertical flip + 90 rotate right
419
- $flip = 'V';
420
- case 6 : // 90 rotate right
421
- $dir = 'CW';
422
- break;
423
- case 7 : // horizontal flip + 90 rotate right
424
- $flip = 'H';
425
- case 8 : // 90 rotate left
426
- $dir = 'CCW';
427
- break;
428
- case 4 : // vertical flip
429
- $flip = 'V';
430
- break;
431
- case 3 : // 180 rotate left
432
- $dir = 180;
433
- break;
434
- case 2 : // horizontal flip
435
- $flip = 'H';
436
- break;
437
- case 1 : // no action in the case it doesn't need a rotation
438
- default:
439
- return '0';
440
- break;
441
- }
442
- } else
443
- return '0';
444
- }
445
- $file = new ngg_Thumbnail( $image->imagePath, TRUE );
446
-
447
- // skip if file is not there
448
- if (!$file->error) {
449
-
450
- // If required save a backup copy of the file
451
- if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
452
- @copy ($image->imagePath, $image->imagePath . '_backup');
453
-
454
- // before we start we import the meta data to database (required for uploads before V1.4.X)
455
- nggAdmin::maybe_import_meta( $image->pid );
456
-
457
- if ( $dir !== 0 )
458
- $file->rotateImage( $dir );
459
- if ( $dir === 180)
460
- $file->rotateImage( 'CCW' ); // very special case, we rotate the image two times
461
- if ( $flip == 'H')
462
- $file->flipImage(true, false);
463
- if ( $flip == 'V')
464
- $file->flipImage(false, true);
465
-
466
- $file->save($image->imagePath, $ngg->options['imgQuality']);
467
-
468
- // read the new sizes
469
- $size = @getimagesize ( $image->imagePath );
470
- // add them to the database
471
- nggdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
472
-
473
- }
474
-
475
- $file->destruct();
476
-
477
- if ( !empty($file->errmsg) )
478
- return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$file->errmsg .')</strong>';
479
-
480
- return '1';
481
-
482
- }
483
-
484
- /**
485
- * nggAdmin::set_watermark() - set the watermark for the image
486
- *
487
- * @class nggAdmin
488
- * @param object | int $image contain all information about the image or the id
489
- * @return string result code
490
- */
491
- function set_watermark($image) {
492
-
493
- global $ngg;
494
-
495
- if(! class_exists('ngg_Thumbnail'))
496
- require_once( nggGallery::graphic_library() );
497
-
498
- if ( is_numeric($image) )
499
- $image = nggdb::find_image( $image );
500
-
501
- if ( !is_object($image) )
502
- return __('Object didn\'t contain correct data','nggallery');
503
-
504
- // before we start we import the meta data to database (required for uploads before V1.4.0)
505
- nggAdmin::maybe_import_meta( $image->pid );
506
-
507
- if (!is_writable($image->imagePath))
508
- return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
509
-
510
- $file = new ngg_Thumbnail( $image->imagePath, TRUE );
511
-
512
- // skip if file is not there
513
- if (!$file->error) {
514
-
515
- // If required save a backup copy of the file
516
- if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
517
- @copy ($image->imagePath, $image->imagePath . '_backup');
518
-
519
- if ($ngg->options['wmType'] == 'image') {
520
- $file->watermarkImgPath = $ngg->options['wmPath'];
521
- $file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
522
- }
523
- if ($ngg->options['wmType'] == 'text') {
524
- $file->watermarkText = $ngg->options['wmText'];
525
- $file->watermarkCreateText($ngg->options['wmColor'], $ngg->options['wmFont'], $ngg->options['wmSize'], $ngg->options['wmOpaque']);
526
- $file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
527
- }
528
- $file->save($image->imagePath, $ngg->options['imgQuality']);
529
- }
530
-
531
- $file->destruct();
532
-
533
- if ( !empty($file->errmsg) )
534
- return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$file->errmsg .')</strong>';
535
-
536
- return '1';
537
- }
538
-
539
- /**
540
- * Recover image from backup copy and reprocess it
541
- *
542
- * @class nggAdmin
543
- * @since 1.5.0
544
- * @param object | int $image contain all information about the image or the id
545
- * @return string result code
546
- */
547
-
548
- function recover_image($image) {
549
-
550
- global $ngg;
551
-
552
- if ( is_numeric($image) )
553
- $image = nggdb::find_image( $image );
554
-
555
- if ( !is_object( $image ) )
556
- return __('Object didn\'t contain correct data','nggallery');
557
-
558
- if (!is_writable( $image->imagePath ))
559
- return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
560
-
561
- if (!file_exists( $image->imagePath . '_backup' )) {
562
- return ' <strong>'.__('File do not exists','nggallery').'</strong>';
563
- }
564
-
565
- if (!@copy( $image->imagePath . '_backup' , $image->imagePath) )
566
- return ' <strong>'.__('Couldn\'t restore original image','nggallery').'</strong>';
567
-
568
- require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
569
-
570
- $meta_obj = new nggMeta( $image->pid );
571
-
572
- $common = $meta_obj->get_common_meta();
573
- $common['saved'] = true;
574
- $result = nggdb::update_image_meta($image->pid, $common);
575
-
576
- return '1';
577
-
578
- }
579
-
580
- /**
581
- * Add images to database
582
- *
583
- * @class nggAdmin
584
- * @param int $galleryID
585
- * @param array $imageslist
586
- * @return array $image_ids Id's which are sucessful added
587
- */
588
- function add_Images($galleryID, $imageslist) {
589
-
590
- global $wpdb, $ngg;
591
-
592
- $image_ids = array();
593
-
594
- if ( is_array($imageslist) ) {
595
- foreach($imageslist as $picture) {
596
-
597
- // filter function to rename/change/modify image before
598
- $picture = apply_filters('ngg_pre_add_new_image', $picture, $galleryID);
599
-
600
- // strip off the extension of the filename
601
- $path_parts = pathinfo( $picture );
602
- $alttext = ( !isset($path_parts['filename']) ) ? substr($path_parts['basename'], 0,strpos($path_parts['basename'], '.')) : $path_parts['filename'];
603
- // save it to the database
604
- $pic_id = nggdb::add_image( $galleryID, $picture, '', $alttext );
605
-
606
- if ( !empty($pic_id) )
607
- $image_ids[] = $pic_id;
608
-
609
- // add the metadata
610
- nggAdmin::import_MetaData( $pic_id );
611
-
612
- // auto rotate
613
- nggAdmin::rotate_image( $pic_id );
614
-
615
- // Autoresize image if required
616
- if ($ngg->options['imgAutoResize']) {
617
- $imagetmp = nggdb::find_image( $pic_id );
618
- $sizetmp = @getimagesize ( $imagetmp->imagePath );
619
- $widthtmp = $ngg->options['imgWidth'];
620
- $heighttmp = $ngg->options['imgHeight'];
621
- if (($sizetmp[0] > $widthtmp && $widthtmp) || ($sizetmp[1] > $heighttmp && $heighttmp)) {
622
- nggAdmin::resize_image( $pic_id );
623
- }
624
- }
625
-
626
- // action hook for post process after the image is added to the database
627
- $image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
628
- do_action('ngg_added_new_image', $image);
629
-
630
- }
631
- } // is_array
632
-
633
- // delete dirsize after adding new images
634
- delete_transient( 'dirsize_cache' );
635
-
636
- do_action('ngg_after_new_images_added', $galleryID, $image_ids );
637
-
638
- return $image_ids;
639
-
640
- }
641
-
642
- /**
643
- * Import some meta data into the database (if avialable)
644
- *
645
- * @class nggAdmin
646
- * @param array|int $imagesIds
647
- * @return string result code
648
- */
649
- function import_MetaData($imagesIds) {
650
-
651
- global $wpdb;
652
-
653
- require_once(NGGALLERY_ABSPATH . '/lib/image.php');
654
-
655
- if (!is_array($imagesIds))
656
- $imagesIds = array($imagesIds);
657
-
658
- foreach($imagesIds as $imageID) {
659
-
660
- $image = nggdb::find_image( $imageID );
661
- if (!$image->error) {
662
-
663
- $meta = nggAdmin::get_MetaData( $image->pid );
664
-
665
- // get the title
666
- $alttext = empty( $meta['title'] ) ? $image->alttext : $meta['title'];
667
-
668
- // get the caption / description field
669
- $description = empty( $meta['caption'] ) ? $image->description : $meta['caption'];
670
-
671
- // get the file date/time from exif
672
- $timestamp = $meta['timestamp'];
673
- // first update database
674
- $result = $wpdb->query(
675
- $wpdb->prepare("UPDATE $wpdb->nggpictures SET
676
- alttext = %s,
677
- description = %s,
678
- imagedate = %s
679
- WHERE pid = %d", $alttext, $description, $timestamp, $image->pid) );
680
-
681
- if ($result === false)
682
- return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not update data base)', 'nggallery') . '</strong>';
683
-
684
- //this flag will inform us that the import is already one time performed
685
- $meta['common']['saved'] = true;
686
- $result = nggdb::update_image_meta($image->pid, $meta['common']);
687
-
688
- if ($result === false)
689
- return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not update meta data)', 'nggallery') . '</strong>';
690
-
691
- // add the tags if we found some
692
- if ($meta['keywords']) {
693
- $taglist = explode(',', $meta['keywords']);
694
- wp_set_object_terms($image->pid, $taglist, 'ngg_tag');
695
- }
696
-
697
- } else
698
- return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not find image)', 'nggallery') . '</strong>';// error check
699
- }
700
-
701
- return '1';
702
- }
703
-
704
- /**
705
- * nggAdmin::get_MetaData()
706
- *
707
- * @class nggAdmin
708
- * @require NextGEN Meta class
709
- * @param int $id image ID
710
- * @return array metadata
711
- */
712
- function get_MetaData($id) {
713
-
714
- require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
715
-
716
- $meta = array();
717
-
718
- $pdata = new nggMeta( $id );
719
-
720
- $meta['title'] = trim ( $pdata->get_META('title') );
721
- $meta['caption'] = trim ( $pdata->get_META('caption') );
722
- $meta['keywords'] = trim ( $pdata->get_META('keywords') );
723
- $meta['timestamp'] = $pdata->get_date_time();
724
- // this contain other useful meta information
725
- $meta['common'] = $pdata->get_common_meta();
726
- // hook for addon plugin to add more meta fields
727
- $meta = apply_filters('ngg_get_image_metadata', $meta, $pdata);
728
-
729
- return $meta;
730
-
731
- }
732
-
733
- /**
734
- * Maybe import some meta data to the database. The functions checks the flag 'saved'
735
- * and if based on compat reason (pre V1.4.0) we save then some meta datas to the database
736
- *
737
- * @since V1.4.0
738
- * @param int $id
739
- * @return result
740
- */
741
- function maybe_import_meta( $id ) {
742
-
743
- require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
744
-
745
- $meta_obj = new nggMeta( $id );
746
-
747
- if ( $meta_obj->image->meta_data['saved'] != true ) {
748
- $common = $meta_obj->get_common_meta();
749
- //this flag will inform us that the import is already one time performed
750
- $common['saved'] = true;
751
- $result = nggdb::update_image_meta($id, $common);
752
- } else
753
- return false;
754
-
755
- return $result;
756
-
757
- }
758
-
759
- /**
760
- * Unzip a file via the PclZip class
761
- *
762
- * @class nggAdmin
763
- * @require PclZip class
764
- * @param string $dir
765
- * @param string $file
766
- * @return bool
767
- */
768
- function unzip($dir, $file) {
769
-
770
- if(! class_exists('PclZip'))
771
- require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
772
-
773
- $archive = new PclZip($file);
774
-
775
- // extract all files in one folder
776
- if ($archive->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_REMOVE_ALL_PATH,
777
- PCLZIP_CB_PRE_EXTRACT, 'ngg_getOnlyImages',
778
- PCLZIP_CB_POST_EXTRACT, 'ngg_checkExtract') == 0) {
779
- nggGallery::show_error( 'Error : ' . $archive->errorInfo(true) );
780
- return false;
781
- }
782
-
783
- return true;
784
- }
785
-
786
- /**
787
- * nggAdmin::getOnlyImages()
788
- *
789
- * @class nggAdmin
790
- * @param mixed $p_event
791
- * @param mixed $p_header
792
- * @return bool
793
- */
794
- function getOnlyImages($p_event, &$p_header) {
795
- // avoid null byte hack (THX to Dominic Szablewski)
796
- if ( strpos($p_header['filename'], chr(0) ) !== false )
797
- $p_header['filename'] = substr ( $p_header['filename'], 0, strpos($p_header['filename'], chr(0) ));
798
- // check for extension
799
- $info = pathinfo($p_header['filename']);
800
- // check for extension
801
- $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
802
- if ( in_array( strtolower($info['extension']), $ext) ) {
803
- // For MAC skip the ".image" files
804
- if ($info['basename']{0} == '.' )
805
- return 0;
806
- else {
807
- // sanitize the file name before we do further processing
808
- $info['basename'] = sanitize_file_name( $info['basename'] );
809
- $p_header['filename'] = $info['dirname'] . '/' . $info['basename'];
810
- return 1;
811
- }
812
-
813
- }
814
- // ----- all other files are skipped
815
- else {
816
- return 0;
817
- }
818
- }
819
-
820
- /**
821
- * Import a ZIP file via a upload form or a URL
822
- *
823
- * @class nggAdmin
824
- * @param int (optional) $galleryID
825
- * @return bool $result
826
- */
827
- function import_zipfile($galleryID) {
828
-
829
- global $ngg, $wpdb;
830
-
831
- if (nggWPMU::check_quota())
832
- return false;
833
-
834
- $defaultpath = $ngg->options['gallerypath'];
835
- $zipurl = $_POST['zipurl'];
836
-
837
- // if someone entered a URL try to upload it
838
- if (!empty($zipurl) && (function_exists('curl_init')) ) {
839
-
840
- if (!(preg_match('/^http(s)?:\/\//i', $zipurl) )) {
841
- nggGallery::show_error( __('No valid URL path ','nggallery') );
842
- return false;
843
- }
844
-
845
- $temp_zipfile = tempnam('/tmp', 'zipimport_');
846
- $filename = basename($zipurl);
847
-
848
- //Grab the zip via cURL
849
- $save = fopen ( $temp_zipfile, "w" );
850
- $ch = curl_init ();
851
- curl_setopt ( $ch, CURLOPT_FILE, $save );
852
- curl_setopt ( $ch, CURLOPT_HEADER, 0 );
853
- curl_setopt ( $ch, CURLOPT_BINARYTRANSFER, 1 );
854
- curl_setopt ( $ch, CURLOPT_URL, $zipurl );
855
- $success = curl_exec ( $ch );
856
- if (!$success)
857
- nggGallery::show_error( __('Import via cURL failed.','nggallery') . ' Error code ' . curl_errno( $ch ) . ' : ' . curl_error( $ch ) );
858
- curl_close ( $ch );
859
- fclose($save);
860
-
861
- if (!$success)
862
- return false;
863
-
864
- } else {
865
-
866
- $temp_zipfile = $_FILES['zipfile']['tmp_name'];
867
- $filename = $_FILES['zipfile']['name'];
868
-
869
- // Chrome return a empty content-type : http://code.google.com/p/chromium/issues/detail?id=6800
870
- if ( !preg_match('/chrome/i', $_SERVER['HTTP_USER_AGENT']) ) {
871
- // check if file is a zip file
872
- if ( !preg_match('/(zip|download|octet-stream)/i', $_FILES['zipfile']['type']) ) {
873
- @unlink($temp_zipfile); // del temp file
874
- nggGallery::show_error(__('Uploaded file was no or a faulty zip file ! The server recognized : ','nggallery') . $_FILES['zipfile']['type']);
875
- return false;
876
- }
877
- }
878
- }
879
-
880
- // should this unpacked into a new folder ?
881
- if ( $galleryID == '0' ) {
882
- //cleanup and take the zipfile name as folder name
883
- $foldername = sanitize_title(strtok ($filename, '.'));
884
- $foldername = $defaultpath . $foldername;
885
- } else {
886
- // get foldername if selected
887
- $foldername = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
888
- }
889
-
890
- if ( empty($foldername) ) {
891
- nggGallery::show_error( __('Could not get a valid foldername', 'nggallery') );
892
- return false;
893
- }
894
-
895
- // set complete folder path
896
- $newfolder = WINABSPATH . $foldername;
897
-
898
- // check first if the traget folder exist
899
- if (!is_dir($newfolder)) {
900
- // create new directories
901
- if (!wp_mkdir_p ($newfolder)) {
902
- $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'nggallery'), esc_html( $newfolder ) );
903
- nggGallery::show_error($message);
904
- return false;
905
- }
906
- if (!wp_mkdir_p ($newfolder . '/thumbs')) {
907
- nggGallery::show_error(__('Unable to create directory ', 'nggallery') . esc_html( $newfolder ). '/thumbs !');
908
- return false;
909
- }
910
- }
911
-
912
- // unzip and del temp file
913
- $result = nggAdmin::unzip($newfolder, $temp_zipfile);
914
- @unlink($temp_zipfile);
915
-
916
- if ($result) {
917
- $message = __('Zip-File successfully unpacked','nggallery') . '<br />';
918
-
919
- // parse now the folder and add to database
920
- $message .= nggAdmin::import_gallery( $foldername );
921
- nggGallery::show_message($message);
922
- }
923
-
924
- return true;
925
- }
926
-
927
- /**
928
- * Function for uploading of images via the upload form
929
- *
930
- * @class nggAdmin
931
- * @return void
932
- */
933
- function upload_images() {
934
-
935
- global $nggdb;
936
-
937
- // WPMU action
938
- if (nggWPMU::check_quota())
939
- return;
940
-
941
- // Images must be an array
942
- $imageslist = array();
943
-
944
- // get selected gallery
945
- $galleryID = (int) $_POST['galleryselect'];
946
-
947
- if ($galleryID == 0) {
948
- nggGallery::show_error(__('No gallery selected !','nggallery'));
949
- return;
950
- }
951
-
952
- // get the path to the gallery
953
- $gallery = $nggdb->find_gallery($galleryID);
954
-
955
- if ( empty($gallery->path) ){
956
- nggGallery::show_error(__('Failure in database, no gallery path set !','nggallery'));
957
- return;
958
- }
959
-
960
- // read list of images
961
- $dirlist = nggAdmin::scandir($gallery->abspath);
962
-
963
- $imagefiles = $_FILES['imagefiles'];
964
-
965
- if (is_array($imagefiles)) {
966
- foreach ($imagefiles['name'] as $key => $value) {
967
-
968
- // look only for uploded files
969
- if ($imagefiles['error'][$key] == 0) {
970
-
971
- $temp_file = $imagefiles['tmp_name'][$key];
972
-
973
- //clean filename and extract extension
974
- $filepart = nggGallery::fileinfo( $imagefiles['name'][$key] );
975
- $filename = $filepart['basename'];
976
-
977
- // check for allowed extension and if it's an image file
978
- $ext = array('jpg', 'png', 'gif');
979
- if ( !in_array($filepart['extension'], $ext) || !@getimagesize($temp_file) ){
980
- nggGallery::show_error('<strong>' . esc_html( $imagefiles['name'][$key] ) . ' </strong>' . __('is no valid image file!','nggallery'));
981
- continue;
982
- }
983
-
984
- // check if this filename already exist in the folder
985
- $i = 0;
986
- while ( in_array( $filename, $dirlist ) ) {
987
- $filename = $filepart['filename'] . '_' . $i++ . '.' .$filepart['extension'];
988
- }
989
-
990
- $dest_file = $gallery->abspath . '/' . $filename;
991
-
992
- //check for folder permission
993
- if ( !is_writeable($gallery->abspath) ) {
994
- $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html($gallery->abspath) );
995
- nggGallery::show_error($message);
996
- return;
997
- }
998
-
999
- // save temp file to gallery
1000
- if ( !@move_uploaded_file($temp_file, $dest_file) ){
1001
- nggGallery::show_error(__('Error, the file could not be moved to : ','nggallery') . esc_html( $dest_file ) );
1002
- nggAdmin::check_safemode( $gallery->abspath );
1003
- continue;
1004
- }
1005
- if ( !nggAdmin::chmod($dest_file) ) {
1006
- nggGallery::show_error(__('Error, the file permissions could not be set','nggallery'));
1007
- continue;
1008
- }
1009
-
1010
- // add to imagelist & dirlist
1011
- $imageslist[] = $filename;
1012
- $dirlist[] = $filename;
1013
-
1014
- }
1015
- }
1016
- }
1017
-
1018
- if (count($imageslist) > 0) {
1019
-
1020
- // add images to database
1021
- $image_ids = nggAdmin::add_Images($galleryID, $imageslist);
1022
-
1023
- //create thumbnails
1024
- nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
1025
-
1026
- //add the preview image if needed
1027
- nggAdmin::set_gallery_preview ( $galleryID );
1028
-
1029
- nggGallery::show_message( count($image_ids) . __(' Image(s) successfully added','nggallery'));
1030
- }
1031
-
1032
- return;
1033
-
1034
- }
1035
-
1036
- /**
1037
- * Upload function will be called via the Flash uploader
1038
- *
1039
- * @class nggAdmin
1040
- * @param integer $galleryID
1041
- * @return string $result
1042
- */
1043
- function swfupload_image($galleryID = 0) {
1044
-
1045
- global $nggdb;
1046
-
1047
- if ($galleryID == 0)
1048
- return __('No gallery selected !', 'nggallery');
1049
-
1050
- // WPMU action
1051
- if (nggWPMU::check_quota())
1052
- return '0';
1053
-
1054
- // Check the upload
1055
- if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0)
1056
- return __('Invalid upload. Error Code : ', 'nggallery') . $_FILES['Filedata']['error'];
1057
-
1058
- // get the filename and extension
1059
- $temp_file = $_FILES['Filedata']['tmp_name'];
1060
-
1061
- $filepart = nggGallery::fileinfo( $_FILES['Filedata']['name'] );
1062
- $filename = $filepart['basename'];
1063
-
1064
- // check for allowed extension
1065
- $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
1066
- if (!in_array( strtolower( $filepart['extension'] ), $ext))
1067
- return esc_html( $_FILES[$key]['name'] ) . __('is no valid image file!', 'nggallery');
1068
-
1069
- // get the path to the gallery
1070
- $gallery = $nggdb->find_gallery( (int) $galleryID );
1071
- if ( empty($gallery->path) ){
1072
- @unlink($temp_file);
1073
- return __('Failure in database, no gallery path set !', 'nggallery');
1074
- }
1075
-
1076
- // read list of images
1077
- $imageslist = nggAdmin::scandir( WINABSPATH . $gallery->path );
1078
-
1079
- // check if this filename already exist
1080
- $i = 0;
1081
- while (in_array($filename, $imageslist)) {
1082
- $filename = $filepart['filename'] . '_' . $i++ . '.' . $filepart['extension'];
1083
- }
1084
-
1085
- $dest_file = WINABSPATH . $gallery->path . '/' . $filename;
1086
-
1087
- // save temp file to gallery
1088
- if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
1089
- nggAdmin::check_safemode(WINABSPATH . $gallery->path);
1090
- return __('Error, the file could not be moved to : ','nggallery'). esc_html( $dest_file );
1091
- }
1092
-
1093
- if ( !nggAdmin::chmod($dest_file) )
1094
- return __('Error, the file permissions could not be set','nggallery');
1095
-
1096
- return '0';
1097
- }
1098
-
1099
- /**
1100
- * Set correct file permissions (taken from wp core)
1101
- *
1102
- * @class nggAdmin
1103
- * @param string $filename
1104
- * @return bool $result
1105
- */
1106
- function chmod($filename = '') {
1107
-
1108
- $stat = @ stat( dirname($filename) );
1109
- $perms = $stat['mode'] & 0000666; // Remove execute bits for files
1110
- if ( @chmod($filename, $perms) )
1111
- return true;
1112
-
1113
- return false;
1114
- }
1115
-
1116
- /**
1117
- * Check UID in folder and Script
1118
- * Read http://www.php.net/manual/en/features.safe-mode.php to understand safe_mode
1119
- *
1120
- * @class nggAdmin
1121
- * @param string $foldername
1122
- * @return bool $result
1123
- */
1124
- function check_safemode($foldername) {
1125
-
1126
- if ( SAFE_MODE ) {
1127
-
1128
- $script_uid = ( ini_get('safe_mode_gid') ) ? getmygid() : getmyuid();
1129
- $folder_uid = fileowner($foldername);
1130
-
1131
- if ($script_uid != $folder_uid) {
1132
- $message = sprintf(__('SAFE MODE Restriction in effect! You need to create the folder <strong>%s</strong> manually','nggallery'), esc_html( $foldername ) );
1133
- $message .= '<br />' . sprintf(__('When safe_mode is on, PHP checks to see if the owner (%s) of the current script matches the owner (%s) of the file to be operated on by a file function or its directory','nggallery'), $script_uid, $folder_uid );
1134
- nggGallery::show_error($message);
1135
- return false;
1136
- }
1137
- }
1138
-
1139
- return true;
1140
- }
1141
-
1142
- /**
1143
- * Capability check. Check is the ID fit's to the user_ID
1144
- *
1145
- * @class nggAdmin
1146
- * @param int $check_ID is the user_id
1147
- * @return bool $result
1148
- */
1149
- function can_manage_this_gallery($check_ID) {
1150
-
1151
- global $user_ID, $wp_roles;
1152
-
1153
- if ( !current_user_can('NextGEN Manage others gallery') ) {
1154
- // get the current user ID
1155
- get_currentuserinfo();
1156
-
1157
- if ( $user_ID != $check_ID)
1158
- return false;
1159
- }
1160
-
1161
- return true;
1162
-
1163
- }
1164
-
1165
- /**
1166
- * Move images from one folder to another
1167
- *
1168
- * @class nggAdmin
1169
- * @param array|int $pic_ids ID's of the images
1170
- * @param int $dest_gid destination gallery
1171
- * @return void
1172
- */
1173
- function move_images($pic_ids, $dest_gid) {
1174
-
1175
- $errors = '';
1176
- $count = 0;
1177
-
1178
- if ( !is_array($pic_ids) )
1179
- $pic_ids = array($pic_ids);
1180
-
1181
- // Get destination gallery
1182
- $destination = nggdb::find_gallery( $dest_gid );
1183
- $dest_abspath = WINABSPATH . $destination->path;
1184
-
1185
- if ( $destination == null ) {
1186
- nggGallery::show_error(__('The destination gallery does not exist','nggallery'));
1187
- return;
1188
- }
1189
-
1190
- // Check for folder permission
1191
- if ( !is_writeable( $dest_abspath ) ) {
1192
- $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html( $dest_abspath ) );
1193
- nggGallery::show_error($message);
1194
- return;
1195
- }
1196
-
1197
- // Get pictures
1198
- $images = nggdb::find_images_in_list($pic_ids);
1199
-
1200
- foreach ($images as $image) {
1201
-
1202
- $i = 0;
1203
- $tmp_prefix = '';
1204
-
1205
- $destination_file_name = $image->filename;
1206
- // check if the filename already exist, then we add a copy_ prefix
1207
- while (file_exists( $dest_abspath . '/' . $destination_file_name)) {
1208
- $tmp_prefix = 'copy_' . ($i++) . '_';
1209
- $destination_file_name = $tmp_prefix . $image->filename;
1210
- }
1211
-
1212
- $destination_path = $dest_abspath . '/' . $destination_file_name;
1213
- $destination_thumbnail = $dest_abspath . '/thumbs/thumbs_' . $destination_file_name;
1214
-
1215
- // Move files
1216
- if ( !@rename($image->imagePath, $destination_path) ) {
1217
- $errors .= sprintf(__('Failed to move image %1$s to %2$s','nggallery'),
1218
- '<strong>' . esc_html( $image->filename ) . '</strong>', esc_html( $destination_path ) ) . '<br />';
1219
- continue;
1220
- }
1221
-
1222
- // Move backup file, if possible
1223
- @rename($image->imagePath . '_backup', $destination_path . '_backup');
1224
- // Move the thumbnail, if possible
1225
- @rename($image->thumbPath, $destination_thumbnail);
1226
-
1227
- // Change the gallery id in the database , maybe the filename
1228
- if ( nggdb::update_image($image->pid, $dest_gid, $destination_file_name) )
1229
- $count++;
1230
-
1231
- }
1232
-
1233
- if ( $errors != '' )
1234
- nggGallery::show_error($errors);
1235
-
1236
- $link = '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . esc_html( $destination->title ) . '</a>';
1237
- $messages = sprintf(__('Moved %1$s picture(s) to gallery : %2$s .','nggallery'), $count, $link);
1238
- nggGallery::show_message($messages);
1239
-
1240
- return;
1241
- }
1242
-
1243
- /**
1244
- * Copy images to another gallery
1245
- *
1246
- * @class nggAdmin
1247
- * @param array|int $pic_ids ID's of the images
1248
- * @param int $dest_gid destination gallery
1249
- * @return void
1250
- */
1251
- function copy_images($pic_ids, $dest_gid) {
1252
-
1253
- require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
1254
-
1255
- $errors = $messages = '';
1256
-
1257
- if (!is_array($pic_ids))
1258
- $pic_ids = array($pic_ids);
1259
-
1260
- // Get destination gallery
1261
- $destination = nggdb::find_gallery( $dest_gid );
1262
- if ( $destination == null ) {
1263
- nggGallery::show_error(__('The destination gallery does not exist','nggallery'));
1264
- return;
1265
- }
1266
-
1267
- // Check for folder permission
1268
- if (!is_writeable(WINABSPATH.$destination->path)) {
1269
- $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html( WINABSPATH.$destination->path) );
1270
- nggGallery::show_error($message);
1271
- return;
1272
- }
1273
-
1274
- // Get pictures
1275
- $images = nggdb::find_images_in_list($pic_ids);
1276
- $destination_path = WINABSPATH . $destination->path;
1277
-
1278
- foreach ($images as $image) {
1279
- // WPMU action
1280
- if ( nggWPMU::check_quota() )
1281
- return;
1282
-
1283
- $i = 0;
1284
- $tmp_prefix = '';
1285
- $destination_file_name = $image->filename;
1286
- while (file_exists($destination_path . '/' . $destination_file_name)) {
1287
- $tmp_prefix = 'copy_' . ($i++) . '_';
1288
- $destination_file_name = $tmp_prefix . $image->filename;
1289
- }
1290
-
1291
- $destination_file_path = $destination_path . '/' . $destination_file_name;
1292
- $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;
1293
-
1294
- // Copy files
1295
- if ( !@copy($image->imagePath, $destination_file_path) ) {
1296
- $errors .= sprintf(__('Failed to copy image %1$s to %2$s','nggallery'),
1297
- esc_html( $image->filename ), esc_html( $destination_file_path) ) . '<br />';
1298
- continue;
1299
- }
1300
-
1301
- // Copy backup file, if possible
1302
- @copy($image->imagePath . '_backup', $destination_file_path . '_backup');
1303
- // Copy the thumbnail if possible
1304
- @copy($image->thumbPath, $destination_thumb_file_path);
1305
-
1306
- // Create new database entry for the image
1307
- $new_pid = nggdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
1308
-
1309
- if (!isset($new_pid)) {
1310
- $errors .= sprintf(__('Failed to copy database row for picture %s','nggallery'), $image->pid) . '<br />';
1311
- continue;
1312
- }
1313
-
1314
- // Copy tags
1315
- nggTags::copy_tags($image->pid, $new_pid);
1316
-
1317
- // Copy meta information
1318
- $meta = new nggMeta($image->pid);
1319
- nggdb::update_image_meta( $new_pid, $meta->image->meta_data);
1320
-
1321
- if ( $tmp_prefix != '' ) {
1322
- $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) &raquo; The file already existed in the destination gallery.','nggallery'),
1323
- $image->pid, esc_html($image->filename), $new_pid, esc_html($destination_file_name) ) . '<br />';
1324
- } else {
1325
- $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)','nggallery'),
1326
- $image->pid, esc_html($image->filename), $new_pid, esc_html($destination_file_name) ) . '<br />';
1327
- }
1328
-
1329
- }
1330
-
1331
- // Finish by showing errors or success
1332
- if ( $errors == '' ) {
1333
- $link = '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . esc_html($destination->title) . '</a>';
1334
- $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .','nggallery'), count($images), $link);
1335
- }
1336
-
1337
- if ( $messages != '' )
1338
- nggGallery::show_message($messages);
1339
-
1340
- if ( $errors != '' )
1341
- nggGallery::show_error($errors);
1342
-
1343
- return;
1344
- }
1345
-
1346
- /**
1347
- * Initate the Ajax operation
1348
- *
1349
- * @class nggAdmin
1350
- * @param string $operation name of the function which should be executed
1351
- * @param array $image_array
1352
- * @param string $title name of the operation
1353
- * @return string the javascript output
1354
- */
1355
- function do_ajax_operation( $operation, $image_array, $title = '' ) {
1356
-
1357
- if ( !is_array($image_array) || empty($image_array) )
1358
- return;
1359
-
1360
- $js_array = implode('","', $image_array);
1361
-
1362
- // send out some JavaScript, which initate the ajax operation
1363
- ?>
1364
- <script type="text/javascript">
1365
-
1366
- Images = new Array("<?php echo $js_array; ?>");
1367
-
1368
- nggAjaxOptions = {
1369
- operation: "<?php echo $operation; ?>",
1370
- ids: Images,
1371
- header: "<?php echo $title; ?>",
1372
- maxStep: Images.length
1373
- };
1374
-
1375
- jQuery(document).ready( function(){
1376
- nggProgressBar.init( nggAjaxOptions );
1377
- nggAjax.init( nggAjaxOptions );
1378
- } );
1379
- </script>
1380
-
1381
- <?php
1382
- }
1383
-
1384
- /**
1385
- * nggAdmin::set_gallery_preview() - define a preview pic after the first upload, can be changed in the gallery settings
1386
- *
1387
- * @class nggAdmin
1388
- * @param int $galleryID
1389
- * @return void
1390
- */
1391
- function set_gallery_preview( $galleryID ) {
1392
-
1393
- global $wpdb;
1394
-
1395
- $gallery = nggdb::find_gallery( $galleryID );
1396
-
1397
- // in the case no preview image is setup, we do this now
1398
- if ($gallery->previewpic == 0) {
1399
- $firstImage = $wpdb->get_var("SELECT pid FROM $wpdb->nggpictures WHERE exclude != 1 AND galleryid = '$galleryID' ORDER by pid DESC limit 0,1");
1400
- if ($firstImage) {
1401
- $wpdb->query("UPDATE $wpdb->nggallery SET previewpic = '$firstImage' WHERE gid = '$galleryID'");
1402
- wp_cache_delete($galleryID, 'ngg_gallery');
1403
- }
1404
- }
1405
-
1406
- return;
1407
- }
1408
-
1409
- /**
1410
- * Return a JSON coded array of Image ids for a requested gallery
1411
- *
1412
- * @class nggAdmin
1413
- * @param int $galleryID
1414
- * @return arry (JSON)
1415
- */
1416
- function get_image_ids( $galleryID ) {
1417
-
1418
- if ( !function_exists('json_encode') )
1419
- return(-2);
1420
-
1421
- $gallery = nggdb::get_ids_from_gallery($galleryID, 'pid', 'ASC', false);
1422
-
1423
- header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true);
1424
- $output = json_encode($gallery);
1425
-
1426
- return $output;
1427
- }
1428
-
1429
- /**
1430
- * Decode upload error to normal message
1431
- *
1432
- * @class nggAdmin
1433
- * @access internal
1434
- * @param int $code php upload error code
1435
- * @return string message
1436
- */
1437
-
1438
- function decode_upload_error( $code ) {
1439
-
1440
- switch ($code) {
1441
- case UPLOAD_ERR_INI_SIZE:
1442
- $message = __ ( 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 'nggallery' );
1443
- break;
1444
- case UPLOAD_ERR_FORM_SIZE:
1445
- $message = __ ( 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 'nggallery' );
1446
- break;
1447
- case UPLOAD_ERR_PARTIAL:
1448
- $message = __ ( 'The uploaded file was only partially uploaded', 'nggallery' );
1449
- break;
1450
- case UPLOAD_ERR_NO_FILE:
1451
- $message = __ ( 'No file was uploaded', 'nggallery' );
1452
- break;
1453
- case UPLOAD_ERR_NO_TMP_DIR:
1454
- $message = __ ( 'Missing a temporary folder', 'nggallery' );
1455
- break;
1456
- case UPLOAD_ERR_CANT_WRITE:
1457
- $message = __ ( 'Failed to write file to disk', 'nggallery' );
1458
- break;
1459
- case UPLOAD_ERR_EXTENSION:
1460
- $message = __ ( 'File upload stopped by extension', 'nggallery' );
1461
- break;
1462
- default:
1463
- $message = __ ( 'Unknown upload error', 'nggallery' );
1464
- break;
1465
- }
1466
-
1467
- return $message;
1468
- }
1469
-
1470
- } // END class nggAdmin
1471
-
1472
- /**
1473
- * TODO: Cannot be member of a class ? Check PCLZIP later...
1474
- *
1475
- * @param mixed $p_event
1476
- * @param mixed $p_header
1477
- * @return
1478
- */
1479
- function ngg_getOnlyImages($p_event, &$p_header) {
1480
- return nggAdmin::getOnlyImages($p_event, $p_header);
1481
- }
1482
-
1483
- /**
1484
- * Ensure after zip extraction that it could be only a image file
1485
- *
1486
- * @param mixed $p_event
1487
- * @param mixed $p_header
1488
- * @return 1
1489
- */
1490
- function ngg_checkExtract($p_event, &$p_header) {
1491
-
1492
- // look for valid extraction
1493
- if ($p_header['status'] == 'ok') {
1494
- // check if it's any image file, delete all other files
1495
- if ( !@getimagesize ( $p_header['filename'] ))
1496
- unlink($p_header['filename']);
1497
- }
1498
-
1499
- return 1;
1500
- }
1501
- ?>
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ /**
6
+ * nggAdmin - Class for admin operation
7
+ *
8
+ * @package NextGEN Gallery
9
+ * @author Alex Rabe
10
+ *
11
+ * @access public
12
+ */
13
+ class nggAdmin{
14
+
15
+ /**
16
+ * create a new gallery & folder
17
+ *
18
+ * @class nggAdmin
19
+ * @param string $name of the gallery
20
+ * @param string $defaultpath
21
+ * @param bool $output if the function should show an error messsage or not
22
+ * @return
23
+ */
24
+ function create_gallery($title, $defaultpath, $output = true) {
25
+
26
+ global $user_ID;
27
+
28
+ // get the current user ID
29
+ get_currentuserinfo();
30
+
31
+ //cleanup pathname
32
+ $name = sanitize_file_name( sanitize_title($title) );
33
+ $name = apply_filters('ngg_gallery_name', $name);
34
+ $nggRoot = WINABSPATH . $defaultpath;
35
+ $txt = '';
36
+
37
+ // No gallery name ?
38
+ if ( empty($name) ) {
39
+ if ($output) nggGallery::show_error( __('No valid gallery name!', 'nggallery') );
40
+ return false;
41
+ }
42
+
43
+ // check for main folder
44
+ if ( !is_dir($nggRoot) ) {
45
+ if ( !wp_mkdir_p( $nggRoot ) ) {
46
+ $txt = __('Directory', 'nggallery').' <strong>' . esc_html( $defaultpath ) . '</strong> '.__('didn\'t exist. Please create first the main gallery folder ', 'nggallery').'!<br />';
47
+ $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'nggallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
48
+ if ($output) nggGallery::show_error($txt);
49
+ return false;
50
+ }
51
+ }
52
+
53
+ // check for permission settings, Safe mode limitations are not taken into account.
54
+ if ( !is_writeable( $nggRoot ) ) {
55
+ $txt = __('Directory', 'nggallery').' <strong>' . esc_html( $defaultpath ) . '</strong> '.__('is not writeable !', 'nggallery').'<br />';
56
+ $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'nggallery').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
57
+ if ($output) nggGallery::show_error($txt);
58
+ return false;
59
+ }
60
+
61
+ // 1. Check for existing folder
62
+ if ( is_dir(WINABSPATH . $defaultpath . $name ) && !(SAFE_MODE) ) {
63
+ $suffix = 1;
64
+ do {
65
+ $alt_name = substr ($name, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "_$suffix";
66
+ $dir_check = is_dir(WINABSPATH . $defaultpath . $alt_name );
67
+ $suffix++;
68
+ } while ( $dir_check );
69
+ $name = $alt_name;
70
+ }
71
+ // define relative path to gallery inside wp root folder
72
+ $nggpath = $defaultpath . $name;
73
+
74
+ // 2. Create new gallery folder
75
+ if ( !wp_mkdir_p (WINABSPATH . $nggpath) )
76
+ $txt = __('Unable to create directory ', 'nggallery') . esc_html( $nggpath ) . '!<br />';
77
+
78
+ // 3. Check folder permission
79
+ if ( !is_writeable(WINABSPATH . $nggpath ) )
80
+ $txt .= __('Directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '</strong> '.__('is not writeable !', 'nggallery').'<br />';
81
+
82
+ // 4. Now create thumbnail folder inside
83
+ if ( !is_dir(WINABSPATH . $nggpath . '/thumbs') ) {
84
+ if ( !wp_mkdir_p ( WINABSPATH . $nggpath . '/thumbs') )
85
+ $txt .= __('Unable to create directory ', 'nggallery').' <strong>' . esc_html( $nggpath ) . '/thumbs !</strong>';
86
+ }
87
+
88
+ if (SAFE_MODE) {
89
+ $help = __('The server setting Safe-Mode is on !', 'nggallery');
90
+ $help .= '<br />'.__('If you have problems, please create directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '</strong> ';
91
+ $help .= __('and the thumbnails directory', 'nggallery').' <strong>' . esc_html( $nggpath ) . '/thumbs</strong> '.__('with permission 777 manually !', 'nggallery');
92
+ if ($output) nggGallery::show_message($help);
93
+ }
94
+
95
+ // show a error message
96
+ if ( !empty($txt) ) {
97
+ if (SAFE_MODE) {
98
+ // for safe_mode , better delete folder, both folder must be created manually
99
+ @rmdir(WINABSPATH . $nggpath . '/thumbs');
100
+ @rmdir(WINABSPATH . $nggpath);
101
+ }
102
+ if ($output) nggGallery::show_error($txt);
103
+ return false;
104
+ }
105
+
106
+ // now add the gallery to the database
107
+ $galleryID = nggdb::add_gallery($title, $nggpath, '', 0, 0, $user_ID );
108
+ // here you can inject a custom function
109
+ do_action('ngg_created_new_gallery', $galleryID);
110
+
111
+ // return only the id if defined
112
+ if ($output == false)
113
+ return $galleryID;
114
+
115
+ if ($galleryID != false) {
116
+ $message = __('Gallery ID %1$s successfully created. You can show this gallery in your post or page with the shortcode %2$s.<br/>','nggallery');
117
+ $message = sprintf($message, $galleryID, '<strong>[nggallery id=' . $galleryID . ']</strong>');
118
+ $message .= '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $galleryID . '" >';
119
+ $message .= __('Edit gallery','nggallery');
120
+ $message .= '</a>';
121
+
122
+ if ($output) nggGallery::show_message($message);
123
+ }
124
+ return true;
125
+ }
126
+
127
+ /**
128
+ * nggAdmin::import_gallery()
129
+ * TODO: Check permission of existing thumb folder & images
130
+ *
131
+ * @class nggAdmin
132
+ * @param string $galleryfolder contains relative path to the gallery itself
133
+ * @return void
134
+ */
135
+ function import_gallery($galleryfolder) {
136
+
137
+ global $wpdb, $user_ID;
138
+
139
+ // get the current user ID
140
+ get_currentuserinfo();
141
+
142
+ $created_msg = '';
143
+
144
+ // remove trailing slash at the end, if somebody use it
145
+ $galleryfolder = untrailingslashit($galleryfolder);
146
+ $gallerypath = WINABSPATH . $galleryfolder;
147
+
148
+ if (!is_dir($gallerypath)) {
149
+ nggGallery::show_error(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) .'</strong> '.__('doesn&#96;t exist!', 'nggallery'));
150
+ return ;
151
+ }
152
+
153
+ // read list of images
154
+ $new_imageslist = nggAdmin::scandir($gallerypath);
155
+
156
+ if (empty($new_imageslist)) {
157
+ nggGallery::show_message(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) . '</strong> '.__('contains no pictures', 'nggallery'));
158
+ return;
159
+ }
160
+
161
+ // check & create thumbnail folder
162
+ if ( !nggGallery::get_thumbnail_folder($gallerypath) )
163
+ return;
164
+
165
+ // take folder name as gallery name
166
+ $galleryname = basename($galleryfolder);
167
+ $galleryname = apply_filters('ngg_gallery_name', $galleryname);
168
+
169
+ // check for existing gallery folder
170
+ $gallery_id = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE path = '$galleryfolder' ");
171
+
172
+ if (!$gallery_id) {
173
+ // now add the gallery to the database
174
+ $gallery_id = nggdb::add_gallery( $galleryname, $galleryfolder, '', 0, 0, $user_ID );
175
+ if (!$gallery_id) {
176
+ nggGallery::show_error(__('Database error. Could not add gallery!','nggallery'));
177
+ return;
178
+ }
179
+ $created_msg = _n( 'Gallery', 'Galleries', 1, 'nggallery' ) . ' <strong>' . esc_html( $galleryname ) . '</strong> ' . __('successfully created!','nggallery') . '<br />';
180
+ }
181
+
182
+ // Look for existing image list
183
+ $old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$gallery_id' ");
184
+
185
+ // if no images are there, create empty array
186
+ if ($old_imageslist == NULL)
187
+ $old_imageslist = array();
188
+
189
+ // check difference
190
+ $new_images = array_diff($new_imageslist, $old_imageslist);
191
+
192
+ // all images must be valid files
193
+ foreach($new_images as $key => $picture) {
194
+
195
+ // filter function to rename/change/modify image before
196
+ $picture = apply_filters('ngg_pre_add_new_image', $picture, $gallery_id);
197
+ $new_images[$key] = $picture;
198
+
199
+ if (!@getimagesize($gallerypath . '/' . $picture) ) {
200
+ unset($new_images[$key]);
201
+ @unlink($gallerypath . '/' . $picture);
202
+ }
203
+ }
204
+
205
+ // add images to database
206
+ $image_ids = nggAdmin::add_Images($gallery_id, $new_images);
207
+
208
+ //add the preview image if needed
209
+ nggAdmin::set_gallery_preview ( $gallery_id );
210
+
211
+ // now create thumbnails
212
+ nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
213
+
214
+ //TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
215
+ $message = $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery');
216
+ $message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
217
+ $message .= __('Edit gallery','nggallery');
218
+ $message .= '</a>]';
219
+
220
+ nggGallery::show_message($message);
221
+
222
+ return;
223
+
224
+ }
225
+
226
+ /**
227
+ * Scan folder for new images
228
+ *
229
+ * @class nggAdmin
230
+ * @param string $dirname
231
+ * @return array $files list of image filenames
232
+ */
233
+ function scandir( $dirname = '.' ) {
234
+ $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
235
+
236
+ $files = array();
237
+ if( $handle = opendir( $dirname ) ) {
238
+ while( false !== ( $file = readdir( $handle ) ) ) {
239
+ $info = pathinfo( $file );
240
+ // just look for images with the correct extension
241
+ if ( isset($info['extension']) )
242
+ if ( in_array( strtolower($info['extension']), $ext) )
243
+ $files[] = utf8_encode( $file );
244
+ }
245
+ closedir( $handle );
246
+ }
247
+ sort( $files );
248
+ return ( $files );
249
+ }
250
+
251
+ /**
252
+ * nggAdmin::createThumbnail() - function to create or recreate a thumbnail
253
+ *
254
+ * @class nggAdmin
255
+ * @param object | int $image contain all information about the image or the id
256
+ * @return string result code
257
+ * @since v1.0.0
258
+ */
259
+ function create_thumbnail($image) {
260
+
261
+ global $ngg;
262
+
263
+ if(! class_exists('ngg_Thumbnail'))
264
+ require_once( nggGallery::graphic_library() );
265
+
266
+ if ( is_numeric($image) )
267
+ $image = nggdb::find_image( $image );
268
+
269
+ if ( !is_object($image) )
270
+ return __('Object didn\'t contain correct data','nggallery');
271
+
272
+ // before we start we import the meta data to database (required for uploads before V1.4.0)
273
+ nggAdmin::maybe_import_meta( $image->pid );
274
+
275
+ // check for existing thumbnail
276
+ if (file_exists($image->thumbPath))
277
+ if (!is_writable($image->thumbPath))
278
+ return esc_html( $image->filename ) . __(' is not writeable ','nggallery');
279
+
280
+ $thumb = new ngg_Thumbnail($image->imagePath, TRUE);
281
+
282
+ // skip if file is not there
283
+ if (!$thumb->error) {
284
+ if ($ngg->options['thumbfix']) {
285
+
286
+ // calculate correct ratio
287
+ $wratio = $ngg->options['thumbwidth'] / $thumb->currentDimensions['width'];
288
+ $hratio = $ngg->options['thumbheight'] / $thumb->currentDimensions['height'];
289
+
290
+ if ($wratio > $hratio) {
291
+ // first resize to the wanted width
292
+ $thumb->resize($ngg->options['thumbwidth'], 0);
293
+ // get optimal y startpos
294
+ $ypos = ($thumb->currentDimensions['height'] - $ngg->options['thumbheight']) / 2;
295
+ $thumb->crop(0, $ypos, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
296
+ } else {
297
+ // first resize to the wanted height
298
+ $thumb->resize(0, $ngg->options['thumbheight']);
299
+ // get optimal x startpos
300
+ $xpos = ($thumb->currentDimensions['width'] - $ngg->options['thumbwidth']) / 2;
301
+ $thumb->crop($xpos, 0, $ngg->options['thumbwidth'],$ngg->options['thumbheight']);
302
+ }
303
+ //this create a thumbnail but keep ratio settings
304
+ } else {
305
+ $thumb->resize($ngg->options['thumbwidth'],$ngg->options['thumbheight']);
306
+ }
307
+
308
+ // save the new thumbnail
309
+ $thumb->save($image->thumbPath, $ngg->options['thumbquality']);
310
+ nggAdmin::chmod ($image->thumbPath);
311
+
312
+ //read the new sizes
313
+ $new_size = @getimagesize ( $image->thumbPath );
314
+ $size['width'] = $new_size[0];
315
+ $size['height'] = $new_size[1];
316
+
317
+ // add them to the database
318
+ nggdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
319
+ }
320
+
321
+ $thumb->destruct();
322
+
323
+ if ( !empty($thumb->errmsg) )
324
+ return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$thumb->errmsg .')</strong>';
325
+
326
+ // success
327
+ return '1';
328
+ }
329
+
330
+ /**
331
+ * nggAdmin::resize_image() - create a new image, based on the height /width
332
+ *
333
+ * @class nggAdmin
334
+ * @param object | int $image contain all information about the image or the id
335
+ * @param integer $width optional
336
+ * @param integer $height optional
337
+ * @return string result code
338
+ */
339
+ function resize_image($image, $width = 0, $height = 0) {
340
+
341
+ global $ngg;
342
+
343
+ if(! class_exists('ngg_Thumbnail'))
344
+ require_once( nggGallery::graphic_library() );
345
+
346
+ if ( is_numeric($image) )
347
+ $image = nggdb::find_image( $image );
348
+
349
+ if ( !is_object($image) )
350
+ return __('Object didn\'t contain correct data','nggallery');
351
+
352
+ // before we start we import the meta data to database (required for uploads before V1.4.0)
353
+ nggAdmin::maybe_import_meta( $image->pid );
354
+
355
+ // if no parameter is set, take global settings
356
+ $width = ($width == 0) ? $ngg->options['imgWidth'] : $width;
357
+ $height = ($height == 0) ? $ngg->options['imgHeight'] : $height;
358
+
359
+ if (!is_writable($image->imagePath))
360
+ return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
361
+
362
+ $file = new ngg_Thumbnail($image->imagePath, TRUE);
363
+
364
+ // skip if file is not there
365
+ if (!$file->error) {
366
+
367
+ // If required save a backup copy of the file
368
+ if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
369
+ @copy ($image->imagePath, $image->imagePath . '_backup');
370
+
371
+ $file->resize($width, $height);
372
+ $file->save($image->imagePath, $ngg->options['imgQuality']);
373
+ // read the new sizes
374
+ $size = @getimagesize ( $image->imagePath );
375
+ // add them to the database
376
+ nggdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
377
+ $file->destruct();
378
+ } else {
379
+ $file->destruct();
380
+ return ' <strong>' . esc_html( $image->filename ) . ' (Error : ' . $file->errmsg . ')</strong>';
381
+ }
382
+
383
+ return '1';
384
+ }
385
+
386
+ /**
387
+ * Rotated/Flip an image based on the orientation flag or a definded angle
388
+ *
389
+ * @param int|object $image
390
+ * @param string (optional) $dir, CW (clockwise)or CCW (counter clockwise), if set to false, the exif flag will be used
391
+ * @param string (optional) $flip, could be either false | V (flip vertical) | H (flip horizontal)
392
+ * @return string result code
393
+ */
394
+ function rotate_image($image, $dir = false, $flip = false) {
395
+
396
+ global $ngg;
397
+
398
+ if(! class_exists('ngg_Thumbnail'))
399
+ require_once( nggGallery::graphic_library() );
400
+
401
+ if ( is_numeric($image) )
402
+ $image = nggdb::find_image( $image );
403
+
404
+ if ( !is_object($image) )
405
+ return __('Object didn\'t contain correct data','nggallery');
406
+
407
+ if (!is_writable($image->imagePath))
408
+ return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
409
+
410
+ // if you didn't define a rotation, we look for the orientation flag in EXIF
411
+ if ( $dir === false ) {
412
+ $meta = new nggMeta( $image->pid );
413
+ $exif = $meta->get_EXIF();
414
+
415
+ if (isset($exif['Orientation'])) {
416
+
417
+ switch ($exif['Orientation']) {
418
+ case 5 : // vertical flip + 90 rotate right
419
+ $flip = 'V';
420
+ case 6 : // 90 rotate right
421
+ $dir = 'CW';
422
+ break;
423
+ case 7 : // horizontal flip + 90 rotate right
424
+ $flip = 'H';
425
+ case 8 : // 90 rotate left
426
+ $dir = 'CCW';
427
+ break;
428
+ case 4 : // vertical flip
429
+ $flip = 'V';
430
+ break;
431
+ case 3 : // 180 rotate left
432
+ $dir = 180;
433
+ break;
434
+ case 2 : // horizontal flip
435
+ $flip = 'H';
436
+ break;
437
+ case 1 : // no action in the case it doesn't need a rotation
438
+ default:
439
+ return '0';
440
+ break;
441
+ }
442
+ } else
443
+ return '0';
444
+ }
445
+ $file = new ngg_Thumbnail( $image->imagePath, TRUE );
446
+
447
+ // skip if file is not there
448
+ if (!$file->error) {
449
+
450
+ // If required save a backup copy of the file
451
+ if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
452
+ @copy ($image->imagePath, $image->imagePath . '_backup');
453
+
454
+ // before we start we import the meta data to database (required for uploads before V1.4.X)
455
+ nggAdmin::maybe_import_meta( $image->pid );
456
+
457
+ if ( $dir !== 0 )
458
+ $file->rotateImage( $dir );
459
+ if ( $dir === 180)
460
+ $file->rotateImage( 'CCW' ); // very special case, we rotate the image two times
461
+ if ( $flip == 'H')
462
+ $file->flipImage(true, false);
463
+ if ( $flip == 'V')
464
+ $file->flipImage(false, true);
465
+
466
+ $file->save($image->imagePath, $ngg->options['imgQuality']);
467
+
468
+ // read the new sizes
469
+ $size = @getimagesize ( $image->imagePath );
470
+ // add them to the database
471
+ nggdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
472
+
473
+ }
474
+
475
+ $file->destruct();
476
+
477
+ if ( !empty($file->errmsg) )
478
+ return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$file->errmsg .')</strong>';
479
+
480
+ return '1';
481
+
482
+ }
483
+
484
+ /**
485
+ * nggAdmin::set_watermark() - set the watermark for the image
486
+ *
487
+ * @class nggAdmin
488
+ * @param object | int $image contain all information about the image or the id
489
+ * @return string result code
490
+ */
491
+ function set_watermark($image) {
492
+
493
+ global $ngg;
494
+
495
+ if(! class_exists('ngg_Thumbnail'))
496
+ require_once( nggGallery::graphic_library() );
497
+
498
+ if ( is_numeric($image) )
499
+ $image = nggdb::find_image( $image );
500
+
501
+ if ( !is_object($image) )
502
+ return __('Object didn\'t contain correct data','nggallery');
503
+
504
+ // before we start we import the meta data to database (required for uploads before V1.4.0)
505
+ nggAdmin::maybe_import_meta( $image->pid );
506
+
507
+ if (!is_writable($image->imagePath))
508
+ return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
509
+
510
+ $file = new ngg_Thumbnail( $image->imagePath, TRUE );
511
+
512
+ // skip if file is not there
513
+ if (!$file->error) {
514
+
515
+ // If required save a backup copy of the file
516
+ if ( ($ngg->options['imgBackup'] == 1) && (!file_exists($image->imagePath . '_backup')) )
517
+ @copy ($image->imagePath, $image->imagePath . '_backup');
518
+
519
+ if ($ngg->options['wmType'] == 'image') {
520
+ $file->watermarkImgPath = $ngg->options['wmPath'];
521
+ $file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
522
+ }
523
+ if ($ngg->options['wmType'] == 'text') {
524
+ $file->watermarkText = $ngg->options['wmText'];
525
+ $file->watermarkCreateText($ngg->options['wmColor'], $ngg->options['wmFont'], $ngg->options['wmSize'], $ngg->options['wmOpaque']);
526
+ $file->watermarkImage($ngg->options['wmPos'], $ngg->options['wmXpos'], $ngg->options['wmYpos']);
527
+ }
528
+ $file->save($image->imagePath, $ngg->options['imgQuality']);
529
+ }
530
+
531
+ $file->destruct();
532
+
533
+ if ( !empty($file->errmsg) )
534
+ return ' <strong>' . esc_html( $image->filename ) . ' (Error : '.$file->errmsg .')</strong>';
535
+
536
+ return '1';
537
+ }
538
+
539
+ /**
540
+ * Recover image from backup copy and reprocess it
541
+ *
542
+ * @class nggAdmin
543
+ * @since 1.5.0
544
+ * @param object | int $image contain all information about the image or the id
545
+ * @return string result code
546
+ */
547
+
548
+ function recover_image($image) {
549
+
550
+ global $ngg;
551
+
552
+ if ( is_numeric($image) )
553
+ $image = nggdb::find_image( $image );
554
+
555
+ if ( !is_object( $image ) )
556
+ return __('Object didn\'t contain correct data','nggallery');
557
+
558
+ if (!is_writable( $image->imagePath ))
559
+ return ' <strong>' . esc_html( $image->filename ) . __(' is not writeable','nggallery') . '</strong>';
560
+
561
+ if (!file_exists( $image->imagePath . '_backup' )) {
562
+ return ' <strong>'.__('File do not exists','nggallery').'</strong>';
563
+ }
564
+
565
+ if (!@copy( $image->imagePath . '_backup' , $image->imagePath) )
566
+ return ' <strong>'.__('Couldn\'t restore original image','nggallery').'</strong>';
567
+
568
+ require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
569
+
570
+ $meta_obj = new nggMeta( $image->pid );
571
+
572
+ $common = $meta_obj->get_common_meta();
573
+ $common['saved'] = true;
574
+ $result = nggdb::update_image_meta($image->pid, $common);
575
+
576
+ return '1';
577
+
578
+ }
579
+
580
+ /**
581
+ * Add images to database
582
+ *
583
+ * @class nggAdmin
584
+ * @param int $galleryID
585
+ * @param array $imageslist
586
+ * @return array $image_ids Id's which are sucessful added
587
+ */
588
+ function add_Images($galleryID, $imageslist) {
589
+
590
+ global $wpdb, $ngg;
591
+
592
+ $image_ids = array();
593
+
594
+ if ( is_array($imageslist) ) {
595
+ foreach($imageslist as $picture) {
596
+
597
+ // filter function to rename/change/modify image before
598
+ $picture = apply_filters('ngg_pre_add_new_image', $picture, $galleryID);
599
+
600
+ // strip off the extension of the filename
601
+ $path_parts = pathinfo( $picture );
602
+ $alttext = ( !isset($path_parts['filename']) ) ? substr($path_parts['basename'], 0,strpos($path_parts['basename'], '.')) : $path_parts['filename'];
603
+ // save it to the database
604
+ $pic_id = nggdb::add_image( $galleryID, $picture, '', $alttext );
605
+
606
+ if ( !empty($pic_id) )
607
+ $image_ids[] = $pic_id;
608
+
609
+ // add the metadata
610
+ nggAdmin::import_MetaData( $pic_id );
611
+
612
+ // auto rotate
613
+ nggAdmin::rotate_image( $pic_id );
614
+
615
+ // Autoresize image if required
616
+ if ($ngg->options['imgAutoResize']) {
617
+ $imagetmp = nggdb::find_image( $pic_id );
618
+ $sizetmp = @getimagesize ( $imagetmp->imagePath );
619
+ $widthtmp = $ngg->options['imgWidth'];
620
+ $heighttmp = $ngg->options['imgHeight'];
621
+ if (($sizetmp[0] > $widthtmp && $widthtmp) || ($sizetmp[1] > $heighttmp && $heighttmp)) {
622
+ nggAdmin::resize_image( $pic_id );
623
+ }
624
+ }
625
+
626
+ // action hook for post process after the image is added to the database
627
+ $image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
628
+ do_action('ngg_added_new_image', $image);
629
+
630
+ }
631
+ } // is_array
632
+
633
+ // delete dirsize after adding new images
634
+ delete_transient( 'dirsize_cache' );
635
+
636
+ do_action('ngg_after_new_images_added', $galleryID, $image_ids );
637
+
638
+ return $image_ids;
639
+
640
+ }
641
+
642
+ /**
643
+ * Import some meta data into the database (if avialable)
644
+ *
645
+ * @class nggAdmin
646
+ * @param array|int $imagesIds
647
+ * @return string result code
648
+ */
649
+ function import_MetaData($imagesIds) {
650
+
651
+ global $wpdb;
652
+
653
+ require_once(NGGALLERY_ABSPATH . '/lib/image.php');
654
+
655
+ if (!is_array($imagesIds))
656
+ $imagesIds = array($imagesIds);
657
+
658
+ foreach($imagesIds as $imageID) {
659
+
660
+ $image = nggdb::find_image( $imageID );
661
+ if (!$image->error) {
662
+
663
+ $meta = nggAdmin::get_MetaData( $image->pid );
664
+
665
+ // get the title
666
+ $alttext = empty( $meta['title'] ) ? $image->alttext : $meta['title'];
667
+
668
+ // get the caption / description field
669
+ $description = empty( $meta['caption'] ) ? $image->description : $meta['caption'];
670
+
671
+ // get the file date/time from exif
672
+ $timestamp = $meta['timestamp'];
673
+ // first update database
674
+ $result = $wpdb->query(
675
+ $wpdb->prepare("UPDATE $wpdb->nggpictures SET
676
+ alttext = %s,
677
+ description = %s,
678
+ imagedate = %s
679
+ WHERE pid = %d", $alttext, $description, $timestamp, $image->pid) );
680
+
681
+ if ($result === false)
682
+ return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not update data base)', 'nggallery') . '</strong>';
683
+
684
+ //this flag will inform us that the import is already one time performed
685
+ $meta['common']['saved'] = true;
686
+ $result = nggdb::update_image_meta($image->pid, $meta['common']);
687
+
688
+ if ($result === false)
689
+ return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not update meta data)', 'nggallery') . '</strong>';
690
+
691
+ // add the tags if we found some
692
+ if ($meta['keywords']) {
693
+ $taglist = explode(',', $meta['keywords']);
694
+ wp_set_object_terms($image->pid, $taglist, 'ngg_tag');
695
+ }
696
+
697
+ } else
698
+ return ' <strong>' . esc_html( $image->filename ) . ' ' . __('(Error : Couldn\'t not find image)', 'nggallery') . '</strong>';// error check
699
+ }
700
+
701
+ return '1';
702
+ }
703
+
704
+ /**
705
+ * nggAdmin::get_MetaData()
706
+ *
707
+ * @class nggAdmin
708
+ * @require NextGEN Meta class
709
+ * @param int $id image ID
710
+ * @return array metadata
711
+ */
712
+ function get_MetaData($id) {
713
+
714
+ require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
715
+
716
+ $meta = array();
717
+
718
+ $pdata = new nggMeta( $id );
719
+
720
+ $meta['title'] = trim ( $pdata->get_META('title') );
721
+ $meta['caption'] = trim ( $pdata->get_META('caption') );
722
+ $meta['keywords'] = trim ( $pdata->get_META('keywords') );
723
+ $meta['timestamp'] = $pdata->get_date_time();
724
+ // this contain other useful meta information
725
+ $meta['common'] = $pdata->get_common_meta();
726
+ // hook for addon plugin to add more meta fields
727
+ $meta = apply_filters('ngg_get_image_metadata', $meta, $pdata);
728
+
729
+ return $meta;
730
+
731
+ }
732
+
733
+ /**
734
+ * Maybe import some meta data to the database. The functions checks the flag 'saved'
735
+ * and if based on compat reason (pre V1.4.0) we save then some meta datas to the database
736
+ *
737
+ * @since V1.4.0
738
+ * @param int $id
739
+ * @return result
740
+ */
741
+ function maybe_import_meta( $id ) {
742
+
743
+ require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
744
+
745
+ $meta_obj = new nggMeta( $id );
746
+
747
+ if ( $meta_obj->image->meta_data['saved'] != true ) {
748
+ $common = $meta_obj->get_common_meta();
749
+ //this flag will inform us that the import is already one time performed
750
+ $common['saved'] = true;
751
+ $result = nggdb::update_image_meta($id, $common);
752
+ } else
753
+ return false;
754
+
755
+ return $result;
756
+
757
+ }
758
+
759
+ /**
760
+ * Unzip a file via the PclZip class
761
+ *
762
+ * @class nggAdmin
763
+ * @require PclZip class
764
+ * @param string $dir
765
+ * @param string $file
766
+ * @return bool
767
+ */
768
+ function unzip($dir, $file) {
769
+
770
+ if(! class_exists('PclZip'))
771
+ require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
772
+
773
+ $archive = new PclZip($file);
774
+
775
+ // extract all files in one folder
776
+ if ($archive->extract(PCLZIP_OPT_PATH, $dir, PCLZIP_OPT_REMOVE_ALL_PATH,
777
+ PCLZIP_CB_PRE_EXTRACT, 'ngg_getOnlyImages',
778
+ PCLZIP_CB_POST_EXTRACT, 'ngg_checkExtract') == 0) {
779
+ nggGallery::show_error( 'Error : ' . $archive->errorInfo(true) );
780
+ return false;
781
+ }
782
+
783
+ return true;
784
+ }
785
+
786
+ /**
787
+ * nggAdmin::getOnlyImages()
788
+ *
789
+ * @class nggAdmin
790
+ * @param mixed $p_event
791
+ * @param mixed $p_header
792
+ * @return bool
793
+ */
794
+ function getOnlyImages($p_event, &$p_header) {
795
+ // avoid null byte hack (THX to Dominic Szablewski)
796
+ if ( strpos($p_header['filename'], chr(0) ) !== false )
797
+ $p_header['filename'] = substr ( $p_header['filename'], 0, strpos($p_header['filename'], chr(0) ));
798
+ // check for extension
799
+ $info = pathinfo($p_header['filename']);
800
+ // check for extension
801
+ $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
802
+ if ( in_array( strtolower($info['extension']), $ext) ) {
803
+ // For MAC skip the ".image" files
804
+ if ($info['basename']{0} == '.' )
805
+ return 0;
806
+ else {
807
+ // sanitize the file name before we do further processing
808
+ $info['basename'] = sanitize_file_name( $info['basename'] );
809
+ $p_header['filename'] = $info['dirname'] . '/' . $info['basename'];
810
+ return 1;
811
+ }
812
+
813
+ }
814
+ // ----- all other files are skipped
815
+ else {
816
+ return 0;
817
+ }
818
+ }
819
+
820
+ /**
821
+ * Import a ZIP file via a upload form or a URL
822
+ *
823
+ * @class nggAdmin
824
+ * @param int (optional) $galleryID
825
+ * @return bool $result
826
+ */
827
+ function import_zipfile($galleryID) {
828
+
829
+ global $ngg, $wpdb;
830
+
831
+ if (nggWPMU::check_quota())
832
+ return false;
833
+
834
+ $defaultpath = $ngg->options['gallerypath'];
835
+ $zipurl = $_POST['zipurl'];
836
+
837
+ // if someone entered a URL try to upload it
838
+ if (!empty($zipurl) && (function_exists('curl_init')) ) {
839
+
840
+ if (!(preg_match('/^http(s)?:\/\//i', $zipurl) )) {
841
+ nggGallery::show_error( __('No valid URL path ','nggallery') );
842
+ return false;
843
+ }
844
+
845
+ $temp_zipfile = tempnam('/tmp', 'zipimport_');
846
+ $filename = basename($zipurl);
847
+
848
+ //Grab the zip via cURL
849
+ $save = fopen ( $temp_zipfile, "w" );
850
+ $ch = curl_init ();
851
+ curl_setopt ( $ch, CURLOPT_FILE, $save );
852
+ curl_setopt ( $ch, CURLOPT_HEADER, 0 );
853
+ curl_setopt ( $ch, CURLOPT_BINARYTRANSFER, 1 );
854
+ curl_setopt ( $ch, CURLOPT_URL, $zipurl );
855
+ $success = curl_exec ( $ch );
856
+ if (!$success)
857
+ nggGallery::show_error( __('Import via cURL failed.','nggallery') . ' Error code ' . curl_errno( $ch ) . ' : ' . curl_error( $ch ) );
858
+ curl_close ( $ch );
859
+ fclose($save);
860
+
861
+ if (!$success)
862
+ return false;
863
+
864
+ } else {
865
+
866
+ $temp_zipfile = $_FILES['zipfile']['tmp_name'];
867
+ $filename = $_FILES['zipfile']['name'];
868
+
869
+ // Chrome return a empty content-type : http://code.google.com/p/chromium/issues/detail?id=6800
870
+ if ( !preg_match('/chrome/i', $_SERVER['HTTP_USER_AGENT']) ) {
871
+ // check if file is a zip file
872
+ if ( !preg_match('/(zip|download|octet-stream)/i', $_FILES['zipfile']['type']) ) {
873
+ @unlink($temp_zipfile); // del temp file
874
+ nggGallery::show_error(__('Uploaded file was no or a faulty zip file ! The server recognized : ','nggallery') . $_FILES['zipfile']['type']);
875
+ return false;
876
+ }
877
+ }
878
+ }
879
+
880
+ // should this unpacked into a new folder ?
881
+ if ( $galleryID == '0' ) {
882
+ //cleanup and take the zipfile name as folder name
883
+ $foldername = sanitize_title(strtok ($filename, '.'));
884
+ $foldername = $defaultpath . $foldername;
885
+ } else {
886
+ // get foldername if selected
887
+ $foldername = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
888
+ }
889
+
890
+ if ( empty($foldername) ) {
891
+ nggGallery::show_error( __('Could not get a valid foldername', 'nggallery') );
892
+ return false;
893
+ }
894
+
895
+ // set complete folder path
896
+ $newfolder = WINABSPATH . $foldername;
897
+
898
+ // check first if the traget folder exist
899
+ if (!is_dir($newfolder)) {
900
+ // create new directories
901
+ if (!wp_mkdir_p ($newfolder)) {
902
+ $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?', 'nggallery'), esc_html( $newfolder ) );
903
+ nggGallery::show_error($message);
904
+ return false;
905
+ }
906
+ if (!wp_mkdir_p ($newfolder . '/thumbs')) {
907
+ nggGallery::show_error(__('Unable to create directory ', 'nggallery') . esc_html( $newfolder ). '/thumbs !');
908
+ return false;
909
+ }
910
+ }
911
+
912
+ // unzip and del temp file
913
+ $result = nggAdmin::unzip($newfolder, $temp_zipfile);
914
+ @unlink($temp_zipfile);
915
+
916
+ if ($result) {
917
+ $message = __('Zip-File successfully unpacked','nggallery') . '<br />';
918
+
919
+ // parse now the folder and add to database
920
+ $message .= nggAdmin::import_gallery( $foldername );
921
+ nggGallery::show_message($message);
922
+ }
923
+
924
+ return true;
925
+ }
926
+
927
+ /**
928
+ * Function for uploading of images via the upload form
929
+ *
930
+ * @class nggAdmin
931
+ * @return void
932
+ */
933
+ function upload_images() {
934
+
935
+ global $nggdb;
936
+
937
+ // WPMU action
938
+ if (nggWPMU::check_quota())
939
+ return;
940
+
941
+ // Images must be an array
942
+ $imageslist = array();
943
+
944
+ // get selected gallery
945
+ $galleryID = (int) $_POST['galleryselect'];
946
+
947
+ if ($galleryID == 0) {
948
+ nggGallery::show_error(__('No gallery selected !','nggallery'));
949
+ return;
950
+ }
951
+
952
+ // get the path to the gallery
953
+ $gallery = $nggdb->find_gallery($galleryID);
954
+
955
+ if ( empty($gallery->path) ){
956
+ nggGallery::show_error(__('Failure in database, no gallery path set !','nggallery'));
957
+ return;
958
+ }
959
+
960
+ // read list of images
961
+ $dirlist = nggAdmin::scandir($gallery->abspath);
962
+
963
+ $imagefiles = $_FILES['imagefiles'];
964
+
965
+ if (is_array($imagefiles)) {
966
+ foreach ($imagefiles['name'] as $key => $value) {
967
+
968
+ // look only for uploded files
969
+ if ($imagefiles['error'][$key] == 0) {
970
+
971
+ $temp_file = $imagefiles['tmp_name'][$key];
972
+
973
+ //clean filename and extract extension
974
+ $filepart = nggGallery::fileinfo( $imagefiles['name'][$key] );
975
+ $filename = $filepart['basename'];
976
+
977
+ // check for allowed extension and if it's an image file
978
+ $ext = array('jpg', 'png', 'gif');
979
+ if ( !in_array($filepart['extension'], $ext) || !@getimagesize($temp_file) ){
980
+ nggGallery::show_error('<strong>' . esc_html( $imagefiles['name'][$key] ) . ' </strong>' . __('is no valid image file!','nggallery'));
981
+ continue;
982
+ }
983
+
984
+ // check if this filename already exist in the folder
985
+ $i = 0;
986
+ while ( in_array( $filename, $dirlist ) ) {
987
+ $filename = $filepart['filename'] . '_' . $i++ . '.' .$filepart['extension'];
988
+ }
989
+
990
+ $dest_file = $gallery->abspath . '/' . $filename;
991
+
992
+ //check for folder permission
993
+ if ( !is_writeable($gallery->abspath) ) {
994
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html($gallery->abspath) );
995
+ nggGallery::show_error($message);
996
+ return;
997
+ }
998
+
999
+ // save temp file to gallery
1000
+ if ( !@move_uploaded_file($temp_file, $dest_file) ){
1001
+ nggGallery::show_error(__('Error, the file could not be moved to : ','nggallery') . esc_html( $dest_file ) );
1002
+ nggAdmin::check_safemode( $gallery->abspath );
1003
+ continue;
1004
+ }
1005
+ if ( !nggAdmin::chmod($dest_file) ) {
1006
+ nggGallery::show_error(__('Error, the file permissions could not be set','nggallery'));
1007
+ continue;
1008
+ }
1009
+
1010
+ // add to imagelist & dirlist
1011
+ $imageslist[] = $filename;
1012
+ $dirlist[] = $filename;
1013
+
1014
+ }
1015
+ }
1016
+ }
1017
+
1018
+ if (count($imageslist) > 0) {
1019
+
1020
+ // add images to database
1021
+ $image_ids = nggAdmin::add_Images($galleryID, $imageslist);
1022
+
1023
+ //create thumbnails
1024
+ nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
1025
+
1026
+ //add the preview image if needed
1027
+ nggAdmin::set_gallery_preview ( $galleryID );
1028
+
1029
+ nggGallery::show_message( count($image_ids) . __(' Image(s) successfully added','nggallery'));
1030
+ }
1031
+
1032
+ return;
1033
+
1034
+ }
1035
+
1036
+ /**
1037
+ * Upload function will be called via the Flash uploader
1038
+ *
1039
+ * @class nggAdmin
1040
+ * @param integer $galleryID
1041
+ * @return string $result
1042
+ */
1043
+ function swfupload_image($galleryID = 0) {
1044
+
1045
+ global $nggdb;
1046
+
1047
+ if ($galleryID == 0)
1048
+ return __('No gallery selected !', 'nggallery');
1049
+
1050
+ // WPMU action
1051
+ if (nggWPMU::check_quota())
1052
+ return '0';
1053
+
1054
+ // Check the upload
1055
+ if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0)
1056
+ return __('Invalid upload. Error Code : ', 'nggallery') . $_FILES['Filedata']['error'];
1057
+
1058
+ // get the filename and extension
1059
+ $temp_file = $_FILES['Filedata']['tmp_name'];
1060
+
1061
+ $filepart = nggGallery::fileinfo( $_FILES['Filedata']['name'] );
1062
+ $filename = $filepart['basename'];
1063
+
1064
+ // check for allowed extension
1065
+ $ext = apply_filters('ngg_allowed_file_types', array('jpeg', 'jpg', 'png', 'gif') );
1066
+ if (!in_array( strtolower( $filepart['extension'] ), $ext))
1067
+ return esc_html( $_FILES[$key]['name'] ) . __('is no valid image file!', 'nggallery');
1068
+
1069
+ // get the path to the gallery
1070
+ $gallery = $nggdb->find_gallery( (int) $galleryID );
1071
+ if ( empty($gallery->path) ){
1072
+ @unlink($temp_file);
1073
+ return __('Failure in database, no gallery path set !', 'nggallery');
1074
+ }
1075
+
1076
+ // read list of images
1077
+ $imageslist = nggAdmin::scandir( WINABSPATH . $gallery->path );
1078
+
1079
+ // check if this filename already exist
1080
+ $i = 0;
1081
+ while (in_array($filename, $imageslist)) {
1082
+ $filename = $filepart['filename'] . '_' . $i++ . '.' . $filepart['extension'];
1083
+ }
1084
+
1085
+ $dest_file = WINABSPATH . $gallery->path . '/' . $filename;
1086
+
1087
+ // save temp file to gallery
1088
+ if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
1089
+ nggAdmin::check_safemode(WINABSPATH . $gallery->path);
1090
+ return __('Error, the file could not be moved to : ','nggallery'). esc_html( $dest_file );
1091
+ }
1092
+
1093
+ if ( !nggAdmin::chmod($dest_file) )
1094
+ return __('Error, the file permissions could not be set','nggallery');
1095
+
1096
+ return '0';
1097
+ }
1098
+
1099
+ /**
1100
+ * Set correct file permissions (taken from wp core)
1101
+ *
1102
+ * @class nggAdmin
1103
+ * @param string $filename
1104
+ * @return bool $result
1105
+ */
1106
+ function chmod($filename = '') {
1107
+
1108
+ $stat = @ stat( dirname($filename) );
1109
+ $perms = $stat['mode'] & 0000666; // Remove execute bits for files
1110
+ if ( @chmod($filename, $perms) )
1111
+ return true;
1112
+
1113
+ return false;
1114
+ }
1115
+
1116
+ /**
1117
+ * Check UID in folder and Script
1118
+ * Read http://www.php.net/manual/en/features.safe-mode.php to understand safe_mode
1119
+ *
1120
+ * @class nggAdmin
1121
+ * @param string $foldername
1122
+ * @return bool $result
1123
+ */
1124
+ function check_safemode($foldername) {
1125
+
1126
+ if ( SAFE_MODE ) {
1127
+
1128
+ $script_uid = ( ini_get('safe_mode_gid') ) ? getmygid() : getmyuid();
1129
+ $folder_uid = fileowner($foldername);
1130
+
1131
+ if ($script_uid != $folder_uid) {
1132
+ $message = sprintf(__('SAFE MODE Restriction in effect! You need to create the folder <strong>%s</strong> manually','nggallery'), esc_html( $foldername ) );
1133
+ $message .= '<br />' . sprintf(__('When safe_mode is on, PHP checks to see if the owner (%s) of the current script matches the owner (%s) of the file to be operated on by a file function or its directory','nggallery'), $script_uid, $folder_uid );
1134
+ nggGallery::show_error($message);
1135
+ return false;
1136
+ }
1137
+ }
1138
+
1139
+ return true;
1140
+ }
1141
+
1142
+ /**
1143
+ * Capability check. Check is the ID fit's to the user_ID
1144
+ *
1145
+ * @class nggAdmin
1146
+ * @param int $check_ID is the user_id
1147
+ * @return bool $result
1148
+ */
1149
+ function can_manage_this_gallery($check_ID) {
1150
+
1151
+ global $user_ID, $wp_roles;
1152
+
1153
+ if ( !current_user_can('NextGEN Manage others gallery') ) {
1154
+ // get the current user ID
1155
+ get_currentuserinfo();
1156
+
1157
+ if ( $user_ID != $check_ID)
1158
+ return false;
1159
+ }
1160
+
1161
+ return true;
1162
+
1163
+ }
1164
+
1165
+ /**
1166
+ * Move images from one folder to another
1167
+ *
1168
+ * @class nggAdmin
1169
+ * @param array|int $pic_ids ID's of the images
1170
+ * @param int $dest_gid destination gallery
1171
+ * @return void
1172
+ */
1173
+ function move_images($pic_ids, $dest_gid) {
1174
+
1175
+ $errors = '';
1176
+ $count = 0;
1177
+
1178
+ if ( !is_array($pic_ids) )
1179
+ $pic_ids = array($pic_ids);
1180
+
1181
+ // Get destination gallery
1182
+ $destination = nggdb::find_gallery( $dest_gid );
1183
+ $dest_abspath = WINABSPATH . $destination->path;
1184
+
1185
+ if ( $destination == null ) {
1186
+ nggGallery::show_error(__('The destination gallery does not exist','nggallery'));
1187
+ return;
1188
+ }
1189
+
1190
+ // Check for folder permission
1191
+ if ( !is_writeable( $dest_abspath ) ) {
1192
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html( $dest_abspath ) );
1193
+ nggGallery::show_error($message);
1194
+ return;
1195
+ }
1196
+
1197
+ // Get pictures
1198
+ $images = nggdb::find_images_in_list($pic_ids);
1199
+
1200
+ foreach ($images as $image) {
1201
+
1202
+ $i = 0;
1203
+ $tmp_prefix = '';
1204
+
1205
+ $destination_file_name = $image->filename;
1206
+ // check if the filename already exist, then we add a copy_ prefix
1207
+ while (file_exists( $dest_abspath . '/' . $destination_file_name)) {
1208
+ $tmp_prefix = 'copy_' . ($i++) . '_';
1209
+ $destination_file_name = $tmp_prefix . $image->filename;
1210
+ }
1211
+
1212
+ $destination_path = $dest_abspath . '/' . $destination_file_name;
1213
+ $destination_thumbnail = $dest_abspath . '/thumbs/thumbs_' . $destination_file_name;
1214
+
1215
+ // Move files
1216
+ if ( !@rename($image->imagePath, $destination_path) ) {
1217
+ $errors .= sprintf(__('Failed to move image %1$s to %2$s','nggallery'),
1218
+ '<strong>' . esc_html( $image->filename ) . '</strong>', esc_html( $destination_path ) ) . '<br />';
1219
+ continue;
1220
+ }
1221
+
1222
+ // Move backup file, if possible
1223
+ @rename($image->imagePath . '_backup', $destination_path . '_backup');
1224
+ // Move the thumbnail, if possible
1225
+ @rename($image->thumbPath, $destination_thumbnail);
1226
+
1227
+ // Change the gallery id in the database , maybe the filename
1228
+ if ( nggdb::update_image($image->pid, $dest_gid, $destination_file_name) )
1229
+ $count++;
1230
+
1231
+ }
1232
+
1233
+ if ( $errors != '' )
1234
+ nggGallery::show_error($errors);
1235
+
1236
+ $link = '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . esc_html( $destination->title ) . '</a>';
1237
+ $messages = sprintf(__('Moved %1$s picture(s) to gallery : %2$s .','nggallery'), $count, $link);
1238
+ nggGallery::show_message($messages);
1239
+
1240
+ return;
1241
+ }
1242
+
1243
+ /**
1244
+ * Copy images to another gallery
1245
+ *
1246
+ * @class nggAdmin
1247
+ * @param array|int $pic_ids ID's of the images
1248
+ * @param int $dest_gid destination gallery
1249
+ * @return void
1250
+ */
1251
+ function copy_images($pic_ids, $dest_gid) {
1252
+
1253
+ require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
1254
+
1255
+ $errors = $messages = '';
1256
+
1257
+ if (!is_array($pic_ids))
1258
+ $pic_ids = array($pic_ids);
1259
+
1260
+ // Get destination gallery
1261
+ $destination = nggdb::find_gallery( $dest_gid );
1262
+ if ( $destination == null ) {
1263
+ nggGallery::show_error(__('The destination gallery does not exist','nggallery'));
1264
+ return;
1265
+ }
1266
+
1267
+ // Check for folder permission
1268
+ if (!is_writeable(WINABSPATH.$destination->path)) {
1269
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'nggallery'), esc_html( WINABSPATH.$destination->path) );
1270
+ nggGallery::show_error($message);
1271
+ return;
1272
+ }
1273
+
1274
+ // Get pictures
1275
+ $images = nggdb::find_images_in_list($pic_ids);
1276
+ $destination_path = WINABSPATH . $destination->path;
1277
+
1278
+ foreach ($images as $image) {
1279
+ // WPMU action
1280
+ if ( nggWPMU::check_quota() )
1281
+ return;
1282
+
1283
+ $i = 0;
1284
+ $tmp_prefix = '';
1285
+ $destination_file_name = $image->filename;
1286
+ while (file_exists($destination_path . '/' . $destination_file_name)) {
1287
+ $tmp_prefix = 'copy_' . ($i++) . '_';
1288
+ $destination_file_name = $tmp_prefix . $image->filename;
1289
+ }
1290
+
1291
+ $destination_file_path = $destination_path . '/' . $destination_file_name;
1292
+ $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;
1293
+
1294
+ // Copy files
1295
+ if ( !@copy($image->imagePath, $destination_file_path) ) {
1296
+ $errors .= sprintf(__('Failed to copy image %1$s to %2$s','nggallery'),
1297
+ esc_html( $image->filename ), esc_html( $destination_file_path) ) . '<br />';
1298
+ continue;
1299
+ }
1300
+
1301
+ // Copy backup file, if possible
1302
+ @copy($image->imagePath . '_backup', $destination_file_path . '_backup');
1303
+ // Copy the thumbnail if possible
1304
+ @copy($image->thumbPath, $destination_thumb_file_path);
1305
+
1306
+ // Create new database entry for the image
1307
+ $new_pid = nggdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
1308
+
1309
+ if (!isset($new_pid)) {
1310
+ $errors .= sprintf(__('Failed to copy database row for picture %s','nggallery'), $image->pid) . '<br />';
1311
+ continue;
1312
+ }
1313
+
1314
+ // Copy tags
1315
+ nggTags::copy_tags($image->pid, $new_pid);
1316
+
1317
+ // Copy meta information
1318
+ $meta = new nggMeta($image->pid);
1319
+ nggdb::update_image_meta( $new_pid, $meta->image->meta_data);
1320
+
1321
+ if ( $tmp_prefix != '' ) {
1322
+ $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) &raquo; The file already existed in the destination gallery.','nggallery'),
1323
+ $image->pid, esc_html($image->filename), $new_pid, esc_html($destination_file_name) ) . '<br />';
1324
+ } else {
1325
+ $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)','nggallery'),
1326
+ $image->pid, esc_html($image->filename), $new_pid, esc_html($destination_file_name) ) . '<br />';
1327
+ }
1328
+
1329
+ }
1330
+
1331
+ // Finish by showing errors or success
1332
+ if ( $errors == '' ) {
1333
+ $link = '<a href="' . admin_url() . 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . esc_html($destination->title) . '</a>';
1334
+ $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .','nggallery'), count($images), $link);
1335
+ }
1336
+
1337
+ if ( $messages != '' )
1338
+ nggGallery::show_message($messages);
1339
+
1340
+ if ( $errors != '' )
1341
+ nggGallery::show_error($errors);
1342
+
1343
+ return;
1344
+ }
1345
+
1346
+ /**
1347
+ * Initate the Ajax operation
1348
+ *
1349
+ * @class nggAdmin
1350
+ * @param string $operation name of the function which should be executed
1351
+ * @param array $image_array
1352
+ * @param string $title name of the operation
1353
+ * @return string the javascript output
1354
+ */
1355
+ function do_ajax_operation( $operation, $image_array, $title = '' ) {
1356
+
1357
+ if ( !is_array($image_array) || empty($image_array) )
1358
+ return;
1359
+
1360
+ $js_array = implode('","', $image_array);
1361
+
1362
+ // send out some JavaScript, which initate the ajax operation
1363
+ ?>
1364
+ <script type="text/javascript">
1365
+
1366
+ Images = new Array("<?php echo $js_array; ?>");
1367
+
1368
+ nggAjaxOptions = {
1369
+ operation: "<?php echo $operation; ?>",
1370
+ ids: Images,
1371
+ header: "<?php echo $title; ?>",
1372
+ maxStep: Images.length
1373
+ };
1374
+
1375
+ jQuery(document).ready( function(){
1376
+ nggProgressBar.init( nggAjaxOptions );
1377
+ nggAjax.init( nggAjaxOptions );
1378
+ } );
1379
+ </script>
1380
+
1381
+ <?php
1382
+ }
1383
+
1384
+ /**
1385
+ * nggAdmin::set_gallery_preview() - define a preview pic after the first upload, can be changed in the gallery settings
1386
+ *
1387
+ * @class nggAdmin
1388
+ * @param int $galleryID
1389
+ * @return void
1390
+ */
1391
+ function set_gallery_preview( $galleryID ) {
1392
+
1393
+ global $wpdb;
1394
+
1395
+ $gallery = nggdb::find_gallery( $galleryID );
1396
+
1397
+ // in the case no preview image is setup, we do this now
1398
+ if ($gallery->previewpic == 0) {
1399
+ $firstImage = $wpdb->get_var("SELECT pid FROM $wpdb->nggpictures WHERE exclude != 1 AND galleryid = '$galleryID' ORDER by pid DESC limit 0,1");
1400
+ if ($firstImage) {
1401
+ $wpdb->query("UPDATE $wpdb->nggallery SET previewpic = '$firstImage' WHERE gid = '$galleryID'");
1402
+ wp_cache_delete($galleryID, 'ngg_gallery');
1403
+ }
1404
+ }
1405
+
1406
+ return;
1407
+ }
1408
+
1409
+ /**
1410
+ * Return a JSON coded array of Image ids for a requested gallery
1411
+ *
1412
+ * @class nggAdmin
1413
+ * @param int $galleryID
1414
+ * @return arry (JSON)
1415
+ */
1416
+ function get_image_ids( $galleryID ) {
1417
+
1418
+ if ( !function_exists('json_encode') )
1419
+ return(-2);
1420
+
1421
+ $gallery = nggdb::get_ids_from_gallery($galleryID, 'pid', 'ASC', false);
1422
+
1423
+ header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true);
1424
+ $output = json_encode($gallery);
1425
+
1426
+ return $output;
1427
+ }
1428
+
1429
+ /**
1430
+ * Decode upload error to normal message
1431
+ *
1432
+ * @class nggAdmin
1433
+ * @access internal
1434
+ * @param int $code php upload error code
1435
+ * @return string message
1436
+ */
1437
+
1438
+ function decode_upload_error( $code ) {
1439
+
1440
+ switch ($code) {
1441
+ case UPLOAD_ERR_INI_SIZE:
1442
+ $message = __ ( 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 'nggallery' );
1443
+ break;
1444
+ case UPLOAD_ERR_FORM_SIZE:
1445
+ $message = __ ( 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 'nggallery' );
1446
+ break;
1447
+ case UPLOAD_ERR_PARTIAL:
1448
+ $message = __ ( 'The uploaded file was only partially uploaded', 'nggallery' );
1449
+ break;
1450
+ case UPLOAD_ERR_NO_FILE:
1451
+ $message = __ ( 'No file was uploaded', 'nggallery' );
1452
+ break;
1453
+ case UPLOAD_ERR_NO_TMP_DIR:
1454
+ $message = __ ( 'Missing a temporary folder', 'nggallery' );
1455
+ break;
1456
+ case UPLOAD_ERR_CANT_WRITE:
1457
+ $message = __ ( 'Failed to write file to disk', 'nggallery' );
1458
+ break;
1459
+ case UPLOAD_ERR_EXTENSION:
1460
+ $message = __ ( 'File upload stopped by extension', 'nggallery' );
1461
+ break;
1462
+ default:
1463
+ $message = __ ( 'Unknown upload error', 'nggallery' );
1464
+ break;
1465
+ }
1466
+
1467
+ return $message;
1468
+ }
1469
+
1470
+ } // END class nggAdmin
1471
+
1472
+ /**
1473
+ * TODO: Cannot be member of a class ? Check PCLZIP later...
1474
+ *
1475
+ * @param mixed $p_event
1476
+ * @param mixed $p_header
1477
+ * @return
1478
+ */
1479
+ function ngg_getOnlyImages($p_event, &$p_header) {
1480
+ return nggAdmin::getOnlyImages($p_event, $p_header);
1481
+ }
1482
+
1483
+ /**
1484
+ * Ensure after zip extraction that it could be only a image file
1485
+ *
1486
+ * @param mixed $p_event
1487
+ * @param mixed $p_header
1488
+ * @return 1
1489
+ */
1490
+ function ngg_checkExtract($p_event, &$p_header) {
1491
+
1492
+ // look for valid extraction
1493
+ if ($p_header['status'] == 'ok') {
1494
+ // check if it's any image file, delete all other files
1495
+ if ( !@getimagesize ( $p_header['filename'] ))
1496
+ unlink($p_header['filename']);
1497
+ }
1498
+
1499
+ return 1;
1500
+ }
1501
+ ?>
admin/images/facebook.png ADDED
Binary file
admin/images/googleplus.png ADDED
Binary file
admin/images/twitter.png ADDED
Binary file
admin/install.php CHANGED
@@ -1,292 +1,292 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- /**
5
- * creates all tables for the gallery
6
- * called during register_activation hook
7
- *
8
- * @access internal
9
- * @return void
10
- */
11
- function nggallery_install () {
12
-
13
- global $wpdb , $wp_roles, $wp_version;
14
-
15
- // Check for capability
16
- if ( !current_user_can('activate_plugins') )
17
- return;
18
-
19
- // Set the capabilities for the administrator
20
- $role = get_role('administrator');
21
- // We need this role, no other chance
22
- if ( empty($role) ) {
23
- update_option( "ngg_init_check", __('Sorry, NextGEN Gallery works only with a role called administrator',"nggallery") );
24
- return;
25
- }
26
-
27
- $role->add_cap('NextGEN Gallery overview');
28
- $role->add_cap('NextGEN Use TinyMCE');
29
- $role->add_cap('NextGEN Upload images');
30
- $role->add_cap('NextGEN Manage gallery');
31
- $role->add_cap('NextGEN Manage tags');
32
- $role->add_cap('NextGEN Manage others gallery');
33
- $role->add_cap('NextGEN Edit album');
34
- $role->add_cap('NextGEN Change style');
35
- $role->add_cap('NextGEN Change options');
36
-
37
- // upgrade function changed in WordPress 2.3
38
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
39
-
40
- // add charset & collate like wp core
41
- $charset_collate = '';
42
-
43
- if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
44
- if ( ! empty($wpdb->charset) )
45
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
46
- if ( ! empty($wpdb->collate) )
47
- $charset_collate .= " COLLATE $wpdb->collate";
48
- }
49
-
50
- $nggpictures = $wpdb->prefix . 'ngg_pictures';
51
- $nggallery = $wpdb->prefix . 'ngg_gallery';
52
- $nggalbum = $wpdb->prefix . 'ngg_album';
53
-
54
- // could be case senstive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
55
- if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
56
-
57
- $sql = "CREATE TABLE " . $nggpictures . " (
58
- pid BIGINT(20) NOT NULL AUTO_INCREMENT ,
59
- image_slug VARCHAR(255) NOT NULL ,
60
- post_id BIGINT(20) DEFAULT '0' NOT NULL ,
61
- galleryid BIGINT(20) DEFAULT '0' NOT NULL ,
62
- filename VARCHAR(255) NOT NULL ,
63
- description MEDIUMTEXT NULL ,
64
- alttext MEDIUMTEXT NULL ,
65
- imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
66
- exclude TINYINT NULL DEFAULT '0' ,
67
- sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
68
- meta_data LONGTEXT,
69
- PRIMARY KEY pid (pid),
70
- KEY post_id (post_id)
71
- ) $charset_collate;";
72
-
73
- dbDelta($sql);
74
- }
75
-
76
- if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggallery'" )) {
77
-
78
- $sql = "CREATE TABLE " . $nggallery . " (
79
- gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
80
- name VARCHAR(255) NOT NULL ,
81
- slug VARCHAR(255) NOT NULL ,
82
- path MEDIUMTEXT NULL ,
83
- title MEDIUMTEXT NULL ,
84
- galdesc MEDIUMTEXT NULL ,
85
- pageid BIGINT(20) DEFAULT '0' NOT NULL ,
86
- previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
87
- author BIGINT(20) DEFAULT '0' NOT NULL ,
88
- PRIMARY KEY gid (gid)
89
- ) $charset_collate;";
90
-
91
- dbDelta($sql);
92
- }
93
-
94
- if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggalbum'" )) {
95
-
96
- $sql = "CREATE TABLE " . $nggalbum . " (
97
- id BIGINT(20) NOT NULL AUTO_INCREMENT ,
98
- name VARCHAR(255) NOT NULL ,
99
- slug VARCHAR(255) NOT NULL ,
100
- previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
101
- albumdesc MEDIUMTEXT NULL ,
102
- sortorder LONGTEXT NOT NULL,
103
- pageid BIGINT(20) DEFAULT '0' NOT NULL,
104
- PRIMARY KEY id (id)
105
- ) $charset_collate;";
106
-
107
- dbDelta($sql);
108
- }
109
-
110
- // check one table again, to be sure
111
- if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
112
- update_option( "ngg_init_check", __('NextGEN Gallery : Tables could not created, please check your database settings',"nggallery") );
113
- return;
114
- }
115
-
116
- $options = get_option('ngg_options');
117
- // set the default settings, if we didn't upgrade
118
- if ( empty( $options ) )
119
- ngg_default_options();
120
-
121
- // if all is passed , save the DBVERSION
122
- add_option("ngg_db_version", NGG_DBVERSION);
123
-
124
- }
125
-
126
- /**
127
- * Setup the default option array for the gallery
128
- *
129
- * @access internal
130
- * @since version 0.33
131
- * @return void
132
- */
133
- function ngg_default_options() {
134
-
135
- global $blog_id, $ngg;
136
-
137
- $ngg_options['gallerypath'] = 'wp-content/gallery/'; // set default path to the gallery
138
- $ngg_options['deleteImg'] = true; // delete Images
139
- $ngg_options['swfUpload'] = true; // activate the batch upload
140
- $ngg_options['usePermalinks'] = false; // use permalinks for parameters
141
- $ngg_options['permalinkSlug'] = 'nggallery'; // the default slug for permalinks
142
- $ngg_options['graphicLibrary'] = 'gd'; // default graphic library
143
- $ngg_options['imageMagickDir'] = '/usr/local/bin/'; // default path to ImageMagick
144
- $ngg_options['useMediaRSS'] = false; // activate the global Media RSS file
145
- $ngg_options['usePicLens'] = false; // activate the PicLens Link for galleries
146
-
147
- // Tags / categories
148
- $ngg_options['activateTags'] = false; // append related images
149
- $ngg_options['appendType'] = 'tags'; // look for category or tags
150
- $ngg_options['maxImages'] = 7; // number of images toshow
151
-
152
- // Thumbnail Settings
153
- $ngg_options['thumbwidth'] = 100; // Thumb Width
154
- $ngg_options['thumbheight'] = 75; // Thumb height
155
- $ngg_options['thumbfix'] = true; // Fix the dimension
156
- $ngg_options['thumbquality'] = 100; // Thumb Quality
157
-
158
- // Image Settings
159
- $ngg_options['imgWidth'] = 800; // Image Width
160
- $ngg_options['imgHeight'] = 600; // Image height
161
- $ngg_options['imgQuality'] = 85; // Image Quality
162
- $ngg_options['imgBackup'] = true; // Create a backup
163
- $ngg_options['imgAutoResize'] = false; // Resize after upload
164
-
165
- // Gallery Settings
166
- $ngg_options['galImages'] = '20'; // Number of images per page
167
- $ngg_options['galPagedGalleries'] = 0; // Number of galleries per page (in a album)
168
- $ngg_options['galColumns'] = 0; // Number of columns for the gallery
169
- $ngg_options['galShowSlide'] = true; // Show slideshow
170
- $ngg_options['galTextSlide'] = __('[Show as slideshow]','nggallery'); // Text for slideshow
171
- $ngg_options['galTextGallery'] = __('[Show picture list]','nggallery'); // Text for gallery
172
- $ngg_options['galShowOrder'] = 'gallery'; // Show order
173
- $ngg_options['galSort'] = 'sortorder'; // Sort order
174
- $ngg_options['galSortDir'] = 'ASC'; // Sort direction
175
- $ngg_options['galNoPages'] = true; // use no subpages for gallery
176
- $ngg_options['galImgBrowser'] = false; // Show ImageBrowser, instead effect
177
- $ngg_options['galHiddenImg'] = false; // For paged galleries we can hide image
178
- $ngg_options['galAjaxNav'] = false; // AJAX Navigation for Shutter effect
179
-
180
- // Thumbnail Effect
181
- $ngg_options['thumbEffect'] = 'shutter'; // select effect
182
- $ngg_options['thumbCode'] = 'class="shutterset_%GALLERY_NAME%"';
183
-
184
- // Watermark settings
185
- $ngg_options['wmPos'] = 'botRight'; // Postion
186
- $ngg_options['wmXpos'] = 5; // X Pos
187
- $ngg_options['wmYpos'] = 5; // Y Pos
188
- $ngg_options['wmType'] = 'text'; // Type : 'image' / 'text'
189
- $ngg_options['wmPath'] = ''; // Path to image
190
- $ngg_options['wmFont'] = 'arial.ttf'; // Font type
191
- $ngg_options['wmSize'] = 10; // Font Size
192
- $ngg_options['wmText'] = get_option('blogname'); // Text
193
- $ngg_options['wmColor'] = '000000'; // Font Color
194
- $ngg_options['wmOpaque'] = '100'; // Font Opaque
195
-
196
- // Image Rotator settings
197
- $ngg_options['enableIR'] = false;
198
- $ngg_options['slideFx'] = 'fade';
199
- $ngg_options['irURL'] = '';
200
- $ngg_options['irXHTMLvalid'] = false;
201
- $ngg_options['irAudio'] = '';
202
- $ngg_options['irWidth'] = 320;
203
- $ngg_options['irHeight'] = 240;
204
- $ngg_options['irShuffle'] = true;
205
- $ngg_options['irLinkfromdisplay'] = true;
206
- $ngg_options['irShownavigation'] = false;
207
- $ngg_options['irShowicons'] = false;
208
- $ngg_options['irWatermark'] = false;
209
- $ngg_options['irOverstretch'] = 'true';
210
- $ngg_options['irRotatetime'] = 10;
211
- $ngg_options['irTransition'] = 'random';
212
- $ngg_options['irKenburns'] = false;
213
- $ngg_options['irBackcolor'] = '000000';
214
- $ngg_options['irFrontcolor'] = 'FFFFFF';
215
- $ngg_options['irLightcolor'] = 'CC0000';
216
- $ngg_options['irScreencolor'] = '000000';
217
-
218
- // CSS Style
219
- $ngg_options['activateCSS'] = true; // activate the CSS file
220
- $ngg_options['CSSfile'] = 'nggallery.css'; // set default css filename
221
-
222
- // special overrides for WPMU
223
- if (is_multisite()) {
224
- // get the site options
225
- $ngg_wpmu_options = get_site_option('ngg_options');
226
-
227
- // get the default value during first installation
228
- if (!is_array($ngg_wpmu_options)) {
229
- $ngg_wpmu_options['gallerypath'] = 'wp-content/blogs.dir/%BLOG_ID%/files/';
230
- $ngg_wpmu_options['wpmuCSSfile'] = 'nggallery.css';
231
- update_site_option('ngg_options', $ngg_wpmu_options);
232
- }
233
-
234
- $ngg_options['gallerypath'] = str_replace("%BLOG_ID%", $blog_id , $ngg_wpmu_options['gallerypath']);
235
- $ngg_options['CSSfile'] = $ngg_wpmu_options['wpmuCSSfile'];
236
- }
237
-
238
- update_option('ngg_options', $ngg_options);
239
-
240
- }
241
-
242
- /**
243
- * Deregister a capability from all classic roles
244
- *
245
- * @access internal
246
- * @param string $capability name of the capability which should be deregister
247
- * @return void
248
- */
249
- function ngg_remove_capability($capability){
250
- // this function remove the $capability only from the classic roles
251
- $check_order = array("subscriber", "contributor", "author", "editor", "administrator");
252
-
253
- foreach ($check_order as $role) {
254
-
255
- $role = get_role($role);
256
- $role->remove_cap($capability) ;
257
- }
258
-
259
- }
260
-
261
- /**
262
- * Uninstall all settings and tables
263
- * Called via Setup and register_unstall hook
264
- *
265
- * @access internal
266
- * @return void
267
- */
268
- function nggallery_uninstall() {
269
- global $wpdb;
270
-
271
- // first remove all tables
272
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_pictures");
273
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_gallery");
274
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_album");
275
-
276
- // then remove all options
277
- delete_option( 'ngg_options' );
278
- delete_option( 'ngg_db_version' );
279
- delete_option( 'ngg_update_exists' );
280
- delete_option( 'ngg_next_update' );
281
-
282
- // now remove the capability
283
- ngg_remove_capability("NextGEN Gallery overview");
284
- ngg_remove_capability("NextGEN Use TinyMCE");
285
- ngg_remove_capability("NextGEN Upload images");
286
- ngg_remove_capability("NextGEN Manage gallery");
287
- ngg_remove_capability("NextGEN Edit album");
288
- ngg_remove_capability("NextGEN Change style");
289
- ngg_remove_capability("NextGEN Change options");
290
- }
291
-
292
  ?>
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ /**
5
+ * creates all tables for the gallery
6
+ * called during register_activation hook
7
+ *
8
+ * @access internal
9
+ * @return void
10
+ */
11
+ function nggallery_install () {
12
+
13
+ global $wpdb , $wp_roles, $wp_version;
14
+
15
+ // Check for capability
16
+ if ( !current_user_can('activate_plugins') )
17
+ return;
18
+
19
+ // Set the capabilities for the administrator
20
+ $role = get_role('administrator');
21
+ // We need this role, no other chance
22
+ if ( empty($role) ) {
23
+ update_option( "ngg_init_check", __('Sorry, NextGEN Gallery works only with a role called administrator',"nggallery") );
24
+ return;
25
+ }
26
+
27
+ $role->add_cap('NextGEN Gallery overview');
28
+ $role->add_cap('NextGEN Use TinyMCE');
29
+ $role->add_cap('NextGEN Upload images');
30
+ $role->add_cap('NextGEN Manage gallery');
31
+ $role->add_cap('NextGEN Manage tags');
32
+ $role->add_cap('NextGEN Manage others gallery');
33
+ $role->add_cap('NextGEN Edit album');
34
+ $role->add_cap('NextGEN Change style');
35
+ $role->add_cap('NextGEN Change options');
36
+
37
+ // upgrade function changed in WordPress 2.3
38
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
39
+
40
+ // add charset & collate like wp core
41
+ $charset_collate = '';
42
+
43
+ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
44
+ if ( ! empty($wpdb->charset) )
45
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
46
+ if ( ! empty($wpdb->collate) )
47
+ $charset_collate .= " COLLATE $wpdb->collate";
48
+ }
49
+
50
+ $nggpictures = $wpdb->prefix . 'ngg_pictures';
51
+ $nggallery = $wpdb->prefix . 'ngg_gallery';
52
+ $nggalbum = $wpdb->prefix . 'ngg_album';
53
+
54
+ // could be case senstive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
55
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
56
+
57
+ $sql = "CREATE TABLE " . $nggpictures . " (
58
+ pid BIGINT(20) NOT NULL AUTO_INCREMENT ,
59
+ image_slug VARCHAR(255) NOT NULL ,
60
+ post_id BIGINT(20) DEFAULT '0' NOT NULL ,
61
+ galleryid BIGINT(20) DEFAULT '0' NOT NULL ,
62
+ filename VARCHAR(255) NOT NULL ,
63
+ description MEDIUMTEXT NULL ,
64
+ alttext MEDIUMTEXT NULL ,
65
+ imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
66
+ exclude TINYINT NULL DEFAULT '0' ,
67
+ sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
68
+ meta_data LONGTEXT,
69
+ PRIMARY KEY pid (pid),
70
+ KEY post_id (post_id)
71
+ ) $charset_collate;";
72
+
73
+ dbDelta($sql);
74
+ }
75
+
76
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggallery'" )) {
77
+
78
+ $sql = "CREATE TABLE " . $nggallery . " (
79
+ gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
80
+ name VARCHAR(255) NOT NULL ,
81
+ slug VARCHAR(255) NOT NULL ,
82
+ path MEDIUMTEXT NULL ,
83
+ title MEDIUMTEXT NULL ,
84
+ galdesc MEDIUMTEXT NULL ,
85
+ pageid BIGINT(20) DEFAULT '0' NOT NULL ,
86
+ previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
87
+ author BIGINT(20) DEFAULT '0' NOT NULL ,
88
+ PRIMARY KEY gid (gid)
89
+ ) $charset_collate;";
90
+
91
+ dbDelta($sql);
92
+ }
93
+
94
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggalbum'" )) {
95
+
96
+ $sql = "CREATE TABLE " . $nggalbum . " (
97
+ id BIGINT(20) NOT NULL AUTO_INCREMENT ,
98
+ name VARCHAR(255) NOT NULL ,
99
+ slug VARCHAR(255) NOT NULL ,
100
+ previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
101
+ albumdesc MEDIUMTEXT NULL ,
102
+ sortorder LONGTEXT NOT NULL,
103
+ pageid BIGINT(20) DEFAULT '0' NOT NULL,
104
+ PRIMARY KEY id (id)
105
+ ) $charset_collate;";
106
+
107
+ dbDelta($sql);
108
+ }
109
+
110
+ // check one table again, to be sure
111
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
112
+ update_option( "ngg_init_check", __('NextGEN Gallery : Tables could not created, please check your database settings',"nggallery") );
113
+ return;
114
+ }
115
+
116
+ $options = get_option('ngg_options');
117
+ // set the default settings, if we didn't upgrade
118
+ if ( empty( $options ) )
119
+ ngg_default_options();
120
+
121
+ // if all is passed , save the DBVERSION
122
+ add_option("ngg_db_version", NGG_DBVERSION);
123
+
124
+ }
125
+
126
+ /**
127
+ * Setup the default option array for the gallery
128
+ *
129
+ * @access internal
130
+ * @since version 0.33
131
+ * @return void
132
+ */
133
+ function ngg_default_options() {
134
+
135
+ global $blog_id, $ngg;
136
+
137
+ $ngg_options['gallerypath'] = 'wp-content/gallery/'; // set default path to the gallery
138
+ $ngg_options['deleteImg'] = true; // delete Images
139
+ $ngg_options['swfUpload'] = true; // activate the batch upload
140
+ $ngg_options['usePermalinks'] = false; // use permalinks for parameters
141
+ $ngg_options['permalinkSlug'] = 'nggallery'; // the default slug for permalinks
142
+ $ngg_options['graphicLibrary'] = 'gd'; // default graphic library
143
+ $ngg_options['imageMagickDir'] = '/usr/local/bin/'; // default path to ImageMagick
144
+ $ngg_options['useMediaRSS'] = false; // activate the global Media RSS file
145
+ $ngg_options['usePicLens'] = false; // activate the PicLens Link for galleries
146
+
147
+ // Tags / categories
148
+ $ngg_options['activateTags'] = false; // append related images
149
+ $ngg_options['appendType'] = 'tags'; // look for category or tags
150
+ $ngg_options['maxImages'] = 7; // number of images toshow
151
+
152
+ // Thumbnail Settings
153
+ $ngg_options['thumbwidth'] = 100; // Thumb Width
154
+ $ngg_options['thumbheight'] = 75; // Thumb height
155
+ $ngg_options['thumbfix'] = true; // Fix the dimension
156
+ $ngg_options['thumbquality'] = 100; // Thumb Quality
157
+
158
+ // Image Settings
159
+ $ngg_options['imgWidth'] = 800; // Image Width
160
+ $ngg_options['imgHeight'] = 600; // Image height
161
+ $ngg_options['imgQuality'] = 85; // Image Quality
162
+ $ngg_options['imgBackup'] = true; // Create a backup
163
+ $ngg_options['imgAutoResize'] = false; // Resize after upload
164
+
165
+ // Gallery Settings
166
+ $ngg_options['galImages'] = '20'; // Number of images per page
167
+ $ngg_options['galPagedGalleries'] = 0; // Number of galleries per page (in a album)
168
+ $ngg_options['galColumns'] = 0; // Number of columns for the gallery
169
+ $ngg_options['galShowSlide'] = true; // Show slideshow
170
+ $ngg_options['galTextSlide'] = __('[Show as slideshow]','nggallery'); // Text for slideshow
171
+ $ngg_options['galTextGallery'] = __('[Show picture list]','nggallery'); // Text for gallery
172
+ $ngg_options['galShowOrder'] = 'gallery'; // Show order
173
+ $ngg_options['galSort'] = 'sortorder'; // Sort order
174
+ $ngg_options['galSortDir'] = 'ASC'; // Sort direction
175
+ $ngg_options['galNoPages'] = true; // use no subpages for gallery
176
+ $ngg_options['galImgBrowser'] = false; // Show ImageBrowser, instead effect
177
+ $ngg_options['galHiddenImg'] = false; // For paged galleries we can hide image
178
+ $ngg_options['galAjaxNav'] = false; // AJAX Navigation for Shutter effect
179
+
180
+ // Thumbnail Effect
181
+ $ngg_options['thumbEffect'] = 'shutter'; // select effect
182
+ $ngg_options['thumbCode'] = 'class="shutterset_%GALLERY_NAME%"';
183
+
184
+ // Watermark settings
185
+ $ngg_options['wmPos'] = 'botRight'; // Postion
186
+ $ngg_options['wmXpos'] = 5; // X Pos
187
+ $ngg_options['wmYpos'] = 5; // Y Pos
188
+ $ngg_options['wmType'] = 'text'; // Type : 'image' / 'text'
189
+ $ngg_options['wmPath'] = ''; // Path to image
190
+ $ngg_options['wmFont'] = 'arial.ttf'; // Font type
191
+ $ngg_options['wmSize'] = 10; // Font Size
192
+ $ngg_options['wmText'] = get_option('blogname'); // Text
193
+ $ngg_options['wmColor'] = '000000'; // Font Color
194
+ $ngg_options['wmOpaque'] = '100'; // Font Opaque
195
+
196
+ // Image Rotator settings
197
+ $ngg_options['enableIR'] = false;
198
+ $ngg_options['slideFx'] = 'fade';
199
+ $ngg_options['irURL'] = '';
200
+ $ngg_options['irXHTMLvalid'] = false;
201
+ $ngg_options['irAudio'] = '';
202
+ $ngg_options['irWidth'] = 320;
203
+ $ngg_options['irHeight'] = 240;
204
+ $ngg_options['irShuffle'] = true;
205
+ $ngg_options['irLinkfromdisplay'] = true;
206
+ $ngg_options['irShownavigation'] = false;
207
+ $ngg_options['irShowicons'] = false;
208
+ $ngg_options['irWatermark'] = false;
209
+ $ngg_options['irOverstretch'] = 'true';
210
+ $ngg_options['irRotatetime'] = 10;
211
+ $ngg_options['irTransition'] = 'random';
212
+ $ngg_options['irKenburns'] = false;
213
+ $ngg_options['irBackcolor'] = '000000';
214
+ $ngg_options['irFrontcolor'] = 'FFFFFF';
215
+ $ngg_options['irLightcolor'] = 'CC0000';
216
+ $ngg_options['irScreencolor'] = '000000';
217
+
218
+ // CSS Style
219
+ $ngg_options['activateCSS'] = true; // activate the CSS file
220
+ $ngg_options['CSSfile'] = 'nggallery.css'; // set default css filename
221
+
222
+ // special overrides for WPMU
223
+ if (is_multisite()) {
224
+ // get the site options
225
+ $ngg_wpmu_options = get_site_option('ngg_options');
226
+
227
+ // get the default value during first installation
228
+ if (!is_array($ngg_wpmu_options)) {
229
+ $ngg_wpmu_options['gallerypath'] = 'wp-content/blogs.dir/%BLOG_ID%/files/';
230
+ $ngg_wpmu_options['wpmuCSSfile'] = 'nggallery.css';
231
+ update_site_option('ngg_options', $ngg_wpmu_options);
232
+ }
233
+
234
+ $ngg_options['gallerypath'] = str_replace("%BLOG_ID%", $blog_id , $ngg_wpmu_options['gallerypath']);
235
+ $ngg_options['CSSfile'] = $ngg_wpmu_options['wpmuCSSfile'];
236
+ }
237
+
238
+ update_option('ngg_options', $ngg_options);
239
+
240
+ }
241
+
242
+ /**
243
+ * Deregister a capability from all classic roles
244
+ *
245
+ * @access internal
246
+ * @param string $capability name of the capability which should be deregister
247
+ * @return void
248
+ */
249
+ function ngg_remove_capability($capability){
250
+ // this function remove the $capability only from the classic roles
251
+ $check_order = array("subscriber", "contributor", "author", "editor", "administrator");
252
+
253
+ foreach ($check_order as $role) {
254
+
255
+ $role = get_role($role);
256
+ $role->remove_cap($capability) ;
257
+ }
258
+
259
+ }
260
+
261
+ /**
262
+ * Uninstall all settings and tables
263
+ * Called via Setup and register_unstall hook
264
+ *
265
+ * @access internal
266
+ * @return void
267
+ */
268
+ function nggallery_uninstall() {
269
+ global $wpdb;
270
+
271
+ // first remove all tables
272
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_pictures");
273
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_gallery");
274
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}ngg_album");
275
+
276
+ // then remove all options
277
+ delete_option( 'ngg_options' );
278
+ delete_option( 'ngg_db_version' );
279
+ delete_option( 'ngg_update_exists' );
280
+ delete_option( 'ngg_next_update' );
281
+
282
+ // now remove the capability
283
+ ngg_remove_capability("NextGEN Gallery overview");
284
+ ngg_remove_capability("NextGEN Use TinyMCE");
285
+ ngg_remove_capability("NextGEN Upload images");
286
+ ngg_remove_capability("NextGEN Manage gallery");
287
+ ngg_remove_capability("NextGEN Edit album");
288
+ ngg_remove_capability("NextGEN Change style");
289
+ ngg_remove_capability("NextGEN Change options");
290
+ }
291
+
292
  ?>
admin/js/jquery.MultiFile.js CHANGED
@@ -1,535 +1,535 @@
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
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- ###
10
- */
11
-
12
- /*# AVOID COLLISIONS #*/
13
- ;if(window.jQuery) (function($){
14
- /*# AVOID COLLISIONS #*/
15
-
16
- // plugin initialization
17
- $.fn.MultiFile = function(options){
18
- if(this.length==0) return this; // quick fail
19
-
20
- // Handle API methods
21
- if(typeof arguments[0]=='string'){
22
- // Perform API methods on individual elements
23
- if(this.length>1){
24
- var args = arguments;
25
- return this.each(function(){
26
- $.fn.MultiFile.apply($(this), args);
27
- });
28
- };
29
- // Invoke API method handler
30
- $.fn.MultiFile[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
31
- // Quick exit...
32
- return this;
33
- };
34
-
35
- // Initialize options for this call
36
- var options = $.extend(
37
- {}/* new object */,
38
- $.fn.MultiFile.options/* default options */,
39
- options || {} /* just-in-time options */
40
- );
41
-
42
- // Empty Element Fix!!!
43
- // this code will automatically intercept native form submissions
44
- // and disable empty file elements
45
- $('form')
46
- .not('MultiFile-intercepted')
47
- .addClass('MultiFile-intercepted')
48
- .submit($.fn.MultiFile.disableEmpty);
49
-
50
- //### http://plugins.jquery.com/node/1363
51
- // utility method to integrate this plugin with others...
52
- if($.fn.MultiFile.options.autoIntercept){
53
- $.fn.MultiFile.intercept( $.fn.MultiFile.options.autoIntercept /* array of methods to intercept */ );
54
- $.fn.MultiFile.options.autoIntercept = null; /* only run this once */
55
- };
56
-
57
- // loop through each matched element
58
- this
59
- .not('.MultiFile-applied')
60
- .addClass('MultiFile-applied')
61
- .each(function(){
62
- //#####################################################################
63
- // MAIN PLUGIN FUNCTIONALITY - START
64
- //#####################################################################
65
-
66
- // BUG 1251 FIX: http://plugins.jquery.com/project/comments/add/1251
67
- // variable group_count would repeat itself on multiple calls to the plugin.
68
- // this would cause a conflict with multiple elements
69
- // changes scope of variable to global so id will be unique over n calls
70
- window.MultiFile = (window.MultiFile || 0) + 1;
71
- var group_count = window.MultiFile;
72
-
73
- // Copy parent attributes - Thanks to Jonas Wagner
74
- // we will use this one to create new input elements
75
- var MultiFile = {e:this, E:$(this), clone:$(this).clone()};
76
-
77
- //===
78
-
79
- //# USE CONFIGURATION
80
- if(typeof options=='number') options = {max:options};
81
- var o = $.extend({},
82
- $.fn.MultiFile.options,
83
- options || {},
84
- ($.metadata? MultiFile.E.metadata(): ($.meta?MultiFile.E.data():null)) || {}, /* metadata options */
85
- {} /* internals */
86
- );
87
- // limit number of files that can be selected?
88
- if(!(o.max>0) /*IsNull(MultiFile.max)*/){
89
- o.max = MultiFile.E.attr('maxlength');
90
- if(!(o.max>0) /*IsNull(MultiFile.max)*/){
91
- o.max = (String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0];
92
- if(!(o.max>0)) o.max = -1;
93
- else o.max = String(o.max).match(/[0-9]+/gi)[0];
94
- }
95
- };
96
- o.max = new Number(o.max);
97
- // limit extensions?
98
- o.accept = o.accept || MultiFile.E.attr('accept') || '';
99
- if(!o.accept){
100
- o.accept = (MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi)) || '';
101
- o.accept = new String(o.accept).replace(/^(accept|ext)\-/i,'');
102
- };
103
-
104
- //===
105
-
106
- // APPLY CONFIGURATION
107
- $.extend(MultiFile, o || {});
108
- MultiFile.STRING = $.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);
109
-
110
- //===
111
-
112
- //#########################################
113
- // PRIVATE PROPERTIES/METHODS
114
- $.extend(MultiFile, {
115
- n: 0, // How many elements are currently selected?
116
- slaves: [], files: [],
117
- instanceKey: MultiFile.e.id || 'MultiFile'+String(group_count), // Instance Key?
118
- generateID: function(z){ return MultiFile.instanceKey + (z>0 ?'_F'+String(z):''); },
119
- trigger: function(event, element){
120
- var handler = MultiFile[event], value = $(element).attr('value');
121
- if(handler){
122
- var returnValue = handler(element, value, MultiFile);
123
- if( returnValue!=null ) return returnValue;
124
- }
125
- return true;
126
- }
127
- });
128
-
129
- //===
130
-
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
-
138
- //===
139
-
140
- // Create wrapper to hold our file list
141
- MultiFile.wrapID = MultiFile.instanceKey+'_wrap'; // Wrapper ID?
142
- MultiFile.E.wrap('<div class="MultiFile-wrap" id="'+MultiFile.wrapID+'"></div>');
143
- MultiFile.wrapper = $('#'+MultiFile.wrapID+'');
144
-
145
- //===
146
-
147
- // MultiFile MUST have a name - default: file1[], file2[], file3[]
148
- MultiFile.e.name = MultiFile.e.name || 'file'+ group_count +'[]';
149
-
150
- //===
151
-
152
- if(!MultiFile.list){
153
- // Create a wrapper for the list
154
- // * OPERA BUG: NO_MODIFICATION_ALLOWED_ERR ('list' is a read-only property)
155
- // this change allows us to keep the files in the order they were selected
156
- MultiFile.wrapper.append( '<div class="MultiFile-list" id="'+MultiFile.wrapID+'_list"></div>' );
157
- MultiFile.list = $('#'+MultiFile.wrapID+'_list');
158
- };
159
- MultiFile.list = $(MultiFile.list);
160
-
161
- //===
162
-
163
- // Bind a new element
164
- MultiFile.addSlave = function( slave, slave_count ){
165
- //if(window.console) console.log('MultiFile.addSlave',slave_count);
166
-
167
- // Keep track of how many elements have been displayed
168
- MultiFile.n++;
169
- // Add reference to master element
170
- slave.MultiFile = MultiFile;
171
-
172
- // BUG FIX: http://plugins.jquery.com/node/1495
173
- // Clear identifying properties from clones
174
- if(slave_count>0) slave.id = slave.name = '';
175
-
176
- // Define element's ID and name (upload components need this!)
177
- //slave.id = slave.id || MultiFile.generateID(slave_count);
178
- if(slave_count>0) slave.id = MultiFile.generateID(slave_count);
179
- //FIX for: http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=23
180
-
181
- // 2008-Apr-29: New customizable naming convention (see url below)
182
- // http://groups.google.com/group/jquery-dev/browse_frm/thread/765c73e41b34f924#
183
- slave.name = String(MultiFile.namePattern
184
- /*master name*/.replace(/\$name/gi,$(MultiFile.clone).attr('name'))
185
- /*master id */.replace(/\$id/gi, $(MultiFile.clone).attr('id'))
186
- /*group count*/.replace(/\$g/gi, group_count)//(group_count>0?group_count:''))
187
- /*slave count*/.replace(/\$i/gi, slave_count)//(slave_count>0?slave_count:''))
188
- );
189
-
190
- // If we've reached maximum number, disable input slave
191
- if( (MultiFile.max > 0) && ((MultiFile.n-1) > (MultiFile.max)) )//{ // MultiFile.n Starts at 1, so subtract 1 to find true count
192
- slave.disabled = true;
193
- //};
194
-
195
- // Remember most recent slave
196
- MultiFile.current = MultiFile.slaves[slave_count] = slave;
197
-
198
- // We'll use jQuery from now on
199
- slave = $(slave);
200
-
201
- // Clear value
202
- slave.val('').attr('value','')[0].value = '';
203
-
204
- // Stop plugin initializing on slaves
205
- slave.addClass('MultiFile-applied');
206
-
207
- // Triggered when a file is selected
208
- slave.change(function(){
209
- //if(window.console) console.log('MultiFile.slave.change',slave_count);
210
-
211
- // Lose focus to stop IE7 firing onchange again
212
- $(this).blur();
213
-
214
- //# Trigger Event! onFileSelect
215
- if(!MultiFile.trigger('onFileSelect', this, MultiFile)) return false;
216
- //# End Event!
217
-
218
- //# Retrive value of selected file from element
219
- var ERROR = '', v = String(this.value || ''/*.attr('value)*/);
220
-
221
- // check extension
222
- if(MultiFile.accept && v && !v.match(MultiFile.rxAccept))//{
223
- ERROR = MultiFile.STRING.denied.replace('$ext', String(v.match(/\.\w{1,4}$/gi)));
224
- //}
225
- //};
226
-
227
- // Disallow duplicates
228
- for(var f in MultiFile.slaves)//{
229
- if(MultiFile.slaves[f] && MultiFile.slaves[f]!=this)//{
230
- //console.log(MultiFile.slaves[f],MultiFile.slaves[f].value);
231
- if(MultiFile.slaves[f].value==v)//{
232
- ERROR = MultiFile.STRING.duplicate.replace('$file', v.match(/[^\/\\]+$/gi));
233
- //};
234
- //};
235
- //};
236
-
237
- // Create a new file input element
238
- var newEle = $(MultiFile.clone).clone();// Copy parent attributes - Thanks to Jonas Wagner
239
- //# Let's remember which input we've generated so
240
- // we can disable the empty ones before submission
241
- // See: http://plugins.jquery.com/node/1495
242
- newEle.addClass('MultiFile');
243
-
244
- // Handle error
245
- if(ERROR!=''){
246
- // Handle error
247
- MultiFile.error(ERROR);
248
-
249
- // 2007-06-24: BUG FIX - Thanks to Adrian Wr�bel <adrian [dot] wrobel [at] gmail.com>
250
- // Ditch the trouble maker and add a fresh new element
251
- MultiFile.n--;
252
- MultiFile.addSlave(newEle[0], slave_count);
253
- slave.parent().prepend(newEle);
254
- slave.remove();
255
- return false;
256
- };
257
-
258
- // Hide this element (NB: display:none is evil!)
259
- $(this).css({ position:'absolute', top: '-3000px' });
260
-
261
- // Add new element to the form
262
- slave.after(newEle);
263
-
264
- // Update list
265
- MultiFile.addToList( this, slave_count );
266
-
267
- // Bind functionality
268
- MultiFile.addSlave( newEle[0], slave_count+1 );
269
-
270
- //# Trigger Event! afterFileSelect
271
- if(!MultiFile.trigger('afterFileSelect', this, MultiFile)) return false;
272
- //# End Event!
273
-
274
- }); // slave.change()
275
-
276
- // Save control to element
277
- $(slave).data('MultiFile', MultiFile);
278
-
279
- };// MultiFile.addSlave
280
- // Bind a new element
281
-
282
-
283
-
284
- // Add a new file to the list
285
- MultiFile.addToList = function( slave, slave_count ){
286
- //if(window.console) console.log('MultiFile.addToList',slave_count);
287
-
288
- //# Trigger Event! onFileAppend
289
- if(!MultiFile.trigger('onFileAppend', slave, MultiFile)) return false;
290
- //# End Event!
291
-
292
- // Create label elements
293
- var
294
- r = $('<div class="MultiFile-label"></div>'),
295
- v = String(slave.value || ''/*.attr('value)*/),
296
- a = $('<span class="MultiFile-title" title="'+MultiFile.STRING.selected.replace('$file', v)+'">'+MultiFile.STRING.file.replace('$file', v.match(/[^\/\\]+$/gi)[0])+'</span>'),
297
- b = $('<a class="MultiFile-remove" href="#'+MultiFile.wrapID+'">'+MultiFile.STRING.remove+'</a>');
298
-
299
- // Insert label
300
- MultiFile.list.append(
301
- r.append(b, ' ', a)
302
- );
303
-
304
- b
305
- .click(function(){
306
-
307
- //# Trigger Event! onFileRemove
308
- if(!MultiFile.trigger('onFileRemove', slave, MultiFile)) return false;
309
- //# End Event!
310
-
311
- MultiFile.n--;
312
- MultiFile.current.disabled = false;
313
-
314
- // Remove element, remove label, point to current
315
- MultiFile.slaves[slave_count] = null;
316
- $(slave).remove();
317
- $(this).parent().remove();
318
-
319
- // Show most current element again (move into view) and clear selection
320
- $(MultiFile.current).css({ position:'', top: '' });
321
- $(MultiFile.current).reset().val('').attr('value', '')[0].value = '';
322
-
323
- //# Trigger Event! afterFileRemove
324
- if(!MultiFile.trigger('afterFileRemove', slave, MultiFile)) return false;
325
- //# End Event!
326
-
327
- return false;
328
- });
329
-
330
- //# Trigger Event! afterFileAppend
331
- if(!MultiFile.trigger('afterFileAppend', slave, MultiFile)) return false;
332
- //# End Event!
333
-
334
- }; // MultiFile.addToList
335
- // Add element to selected files list
336
-
337
-
338
-
339
- // Bind functionality to the first element
340
- if(!MultiFile.MultiFile) MultiFile.addSlave(MultiFile.e, 0);
341
-
342
- // Increment control count
343
- //MultiFile.I++; // using window.MultiFile
344
- MultiFile.n++;
345
-
346
- // Save control to element
347
- MultiFile.E.data('MultiFile', MultiFile);
348
-
349
-
350
- //#####################################################################
351
- // MAIN PLUGIN FUNCTIONALITY - END
352
- //#####################################################################
353
- }); // each element
354
- };
355
-
356
- /*--------------------------------------------------------*/
357
-
358
- /*
359
- ### Core functionality and API ###
360
- */
361
- $.extend($.fn.MultiFile, {
362
- /**
363
- * This method removes all selected files
364
- *
365
- * Returns a jQuery collection of all affected elements.
366
- *
367
- * @name reset
368
- * @type jQuery
369
- * @cat Plugins/MultiFile
370
- * @author Diego A. (http://www.fyneworks.com/)
371
- *
372
- * @example $.fn.MultiFile.reset();
373
- */
374
- reset: function(){
375
- var settings = $(this).data('MultiFile');
376
- //if(settings) settings.wrapper.find('a.MultiFile-remove').click();
377
- if(settings) settings.list.find('a.MultiFile-remove').click();
378
- return $(this);
379
- },
380
-
381
-
382
- /**
383
- * This utility makes it easy to disable all 'empty' file elements in the document before submitting a form.
384
- * It marks the affected elements so they can be easily re-enabled after the form submission or validation.
385
- *
386
- * Returns a jQuery collection of all affected elements.
387
- *
388
- * @name disableEmpty
389
- * @type jQuery
390
- * @cat Plugins/MultiFile
391
- * @author Diego A. (http://www.fyneworks.com/)
392
- *
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 || [];
435
- if(args.constructor.toString().indexOf("Array")<0) 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];
444
- for(var i=0;i<methods.length;i++){
445
- method = methods[i]+''; // make sure that we have a STRING
446
- if(method) (function(method){ // make sure that method is ISOLATED for the interception
447
- $.fn.MultiFile.intercepted[method] = $.fn[method] || function(){};
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
456
- };// for each method
457
- }
458
- });
459
-
460
- /*--------------------------------------------------------*/
461
-
462
- /*
463
- ### Default Settings ###
464
- eg.: You can override default control like this:
465
- $.fn.MultiFile.options.accept = 'gif|jpg';
466
- */
467
- $.fn.MultiFile.options = { //$.extend($.fn.MultiFile, { options: {
468
- accept: '', // accepted file extensions
469
- max: -1, // maximum number of selectable files
470
-
471
- // name to use for newly created elements
472
- namePattern: '$name', // same name by default (which creates an array)
473
-
474
- // STRING: collection lets you show messages in different languages
475
- STRING: {
476
- remove:'x',
477
- denied:'You cannot select a $ext file.\nTry again...',
478
- file:'$file',
479
- selected:'File selected: $file',
480
- duplicate:'This file has already been selected:\n$file'
481
- },
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){
489
- /*
490
- ERROR! blockUI is not currently working in IE
491
- if($.blockUI){
492
- $.blockUI({
493
- message: s.replace(/\n/gi,'<br/>'),
494
- css: {
495
- border:'none', padding:'15px', size:'12.0pt',
496
- backgroundColor:'#900', color:'#fff',
497
- opacity:'.8','-webkit-border-radius': '10px','-moz-border-radius': '10px'
498
- }
499
- });
500
- window.setTimeout($.unblockUI, 2000);
501
- }
502
- else//{// save a byte!
503
- */
504
- alert(s);
505
- //}// save a byte!
506
- }
507
- }; //} });
508
-
509
- /*--------------------------------------------------------*/
510
-
511
- /*
512
- ### Additional Methods ###
513
- Required functionality outside the plugin's scope
514
- */
515
-
516
- // Native input reset method - because this alone doesn't always work: $(element).val('').attr('value', '')[0].value = '';
517
- $.fn.reset = function(){ return this.each(function(){ try{ this.reset(); }catch(e){} }); };
518
-
519
- /*--------------------------------------------------------*/
520
-
521
- /*
522
- ### Default implementation ###
523
- The plugin will attach itself to file inputs
524
- with the class 'multi' when the page loads
525
- */
526
- $(function(){
527
- //$("input:file.multi").MultiFile();
528
- $("input[type=file].multi").MultiFile();
529
- });
530
-
531
-
532
-
533
- /*# AVOID COLLISIONS #*/
534
- })(jQuery);
535
- /*# AVOID COLLISIONS #*/
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
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ ###
10
+ */
11
+
12
+ /*# AVOID COLLISIONS #*/
13
+ ;if(window.jQuery) (function($){
14
+ /*# AVOID COLLISIONS #*/
15
+
16
+ // plugin initialization
17
+ $.fn.MultiFile = function(options){
18
+ if(this.length==0) return this; // quick fail
19
+
20
+ // Handle API methods
21
+ if(typeof arguments[0]=='string'){
22
+ // Perform API methods on individual elements
23
+ if(this.length>1){
24
+ var args = arguments;
25
+ return this.each(function(){
26
+ $.fn.MultiFile.apply($(this), args);
27
+ });
28
+ };
29
+ // Invoke API method handler
30
+ $.fn.MultiFile[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
31
+ // Quick exit...
32
+ return this;
33
+ };
34
+
35
+ // Initialize options for this call
36
+ var options = $.extend(
37
+ {}/* new object */,
38
+ $.fn.MultiFile.options/* default options */,
39
+ options || {} /* just-in-time options */
40
+ );
41
+
42
+ // Empty Element Fix!!!
43
+ // this code will automatically intercept native form submissions
44
+ // and disable empty file elements
45
+ $('form')
46
+ .not('MultiFile-intercepted')
47
+ .addClass('MultiFile-intercepted')
48
+ .submit($.fn.MultiFile.disableEmpty);
49
+
50
+ //### http://plugins.jquery.com/node/1363
51
+ // utility method to integrate this plugin with others...
52
+ if($.fn.MultiFile.options.autoIntercept){
53
+ $.fn.MultiFile.intercept( $.fn.MultiFile.options.autoIntercept /* array of methods to intercept */ );
54
+ $.fn.MultiFile.options.autoIntercept = null; /* only run this once */
55
+ };
56
+
57
+ // loop through each matched element
58
+ this
59
+ .not('.MultiFile-applied')
60
+ .addClass('MultiFile-applied')
61
+ .each(function(){
62
+ //#####################################################################
63
+ // MAIN PLUGIN FUNCTIONALITY - START
64
+ //#####################################################################
65
+
66
+ // BUG 1251 FIX: http://plugins.jquery.com/project/comments/add/1251
67
+ // variable group_count would repeat itself on multiple calls to the plugin.
68
+ // this would cause a conflict with multiple elements
69
+ // changes scope of variable to global so id will be unique over n calls
70
+ window.MultiFile = (window.MultiFile || 0) + 1;
71
+ var group_count = window.MultiFile;
72
+
73
+ // Copy parent attributes - Thanks to Jonas Wagner
74
+ // we will use this one to create new input elements
75
+ var MultiFile = {e:this, E:$(this), clone:$(this).clone()};
76
+
77
+ //===
78
+
79
+ //# USE CONFIGURATION
80
+ if(typeof options=='number') options = {max:options};
81
+ var o = $.extend({},
82
+ $.fn.MultiFile.options,
83
+ options || {},
84
+ ($.metadata? MultiFile.E.metadata(): ($.meta?MultiFile.E.data():null)) || {}, /* metadata options */
85
+ {} /* internals */
86
+ );
87
+ // limit number of files that can be selected?
88
+ if(!(o.max>0) /*IsNull(MultiFile.max)*/){
89
+ o.max = MultiFile.E.attr('maxlength');
90
+ if(!(o.max>0) /*IsNull(MultiFile.max)*/){
91
+ o.max = (String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0];
92
+ if(!(o.max>0)) o.max = -1;
93
+ else o.max = String(o.max).match(/[0-9]+/gi)[0];
94
+ }
95
+ };
96
+ o.max = new Number(o.max);
97
+ // limit extensions?
98
+ o.accept = o.accept || MultiFile.E.attr('accept') || '';
99
+ if(!o.accept){
100
+ o.accept = (MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi)) || '';
101
+ o.accept = new String(o.accept).replace(/^(accept|ext)\-/i,'');
102
+ };
103
+
104
+ //===
105
+
106
+ // APPLY CONFIGURATION
107
+ $.extend(MultiFile, o || {});
108
+ MultiFile.STRING = $.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);
109
+
110
+ //===
111
+
112
+ //#########################################
113
+ // PRIVATE PROPERTIES/METHODS
114
+ $.extend(MultiFile, {
115
+ n: 0, // How many elements are currently selected?
116
+ slaves: [], files: [],
117
+ instanceKey: MultiFile.e.id || 'MultiFile'+String(group_count), // Instance Key?
118
+ generateID: function(z){ return MultiFile.instanceKey + (z>0 ?'_F'+String(z):''); },
119
+ trigger: function(event, element){
120
+ var handler = MultiFile[event], value = $(element).attr('value');
121
+ if(handler){
122
+ var returnValue = handler(element, value, MultiFile);
123
+ if( returnValue!=null ) return returnValue;
124
+ }
125
+ return true;
126
+ }
127
+ });
128
+
129
+ //===
130
+
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
+
138
+ //===
139
+
140
+ // Create wrapper to hold our file list
141
+ MultiFile.wrapID = MultiFile.instanceKey+'_wrap'; // Wrapper ID?
142
+ MultiFile.E.wrap('<div class="MultiFile-wrap" id="'+MultiFile.wrapID+'"></div>');
143
+ MultiFile.wrapper = $('#'+MultiFile.wrapID+'');
144
+
145
+ //===
146
+
147
+ // MultiFile MUST have a name - default: file1[], file2[], file3[]
148
+ MultiFile.e.name = MultiFile.e.name || 'file'+ group_count +'[]';
149
+
150
+ //===
151
+
152
+ if(!MultiFile.list){
153
+ // Create a wrapper for the list
154
+ // * OPERA BUG: NO_MODIFICATION_ALLOWED_ERR ('list' is a read-only property)
155
+ // this change allows us to keep the files in the order they were selected
156
+ MultiFile.wrapper.append( '<div class="MultiFile-list" id="'+MultiFile.wrapID+'_list"></div>' );
157
+ MultiFile.list = $('#'+MultiFile.wrapID+'_list');
158
+ };
159
+ MultiFile.list = $(MultiFile.list);
160
+
161
+ //===
162
+
163
+ // Bind a new element
164
+ MultiFile.addSlave = function( slave, slave_count ){
165
+ //if(window.console) console.log('MultiFile.addSlave',slave_count);
166
+
167
+ // Keep track of how many elements have been displayed
168
+ MultiFile.n++;
169
+ // Add reference to master element
170
+ slave.MultiFile = MultiFile;
171
+
172
+ // BUG FIX: http://plugins.jquery.com/node/1495
173
+ // Clear identifying properties from clones
174
+ if(slave_count>0) slave.id = slave.name = '';
175
+
176
+ // Define element's ID and name (upload components need this!)
177
+ //slave.id = slave.id || MultiFile.generateID(slave_count);
178
+ if(slave_count>0) slave.id = MultiFile.generateID(slave_count);
179
+ //FIX for: http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=23
180
+
181
+ // 2008-Apr-29: New customizable naming convention (see url below)
182
+ // http://groups.google.com/group/jquery-dev/browse_frm/thread/765c73e41b34f924#
183
+ slave.name = String(MultiFile.namePattern
184
+ /*master name*/.replace(/\$name/gi,$(MultiFile.clone).attr('name'))
185
+ /*master id */.replace(/\$id/gi, $(MultiFile.clone).attr('id'))
186
+ /*group count*/.replace(/\$g/gi, group_count)//(group_count>0?group_count:''))
187
+ /*slave count*/.replace(/\$i/gi, slave_count)//(slave_count>0?slave_count:''))
188
+ );
189
+
190
+ // If we've reached maximum number, disable input slave
191
+ if( (MultiFile.max > 0) && ((MultiFile.n-1) > (MultiFile.max)) )//{ // MultiFile.n Starts at 1, so subtract 1 to find true count
192
+ slave.disabled = true;
193
+ //};
194
+
195
+ // Remember most recent slave
196
+ MultiFile.current = MultiFile.slaves[slave_count] = slave;
197
+
198
+ // We'll use jQuery from now on
199
+ slave = $(slave);
200
+
201
+ // Clear value
202
+ slave.val('').attr('value','')[0].value = '';
203
+
204
+ // Stop plugin initializing on slaves
205
+ slave.addClass('MultiFile-applied');
206
+
207
+ // Triggered when a file is selected
208
+ slave.change(function(){
209
+ //if(window.console) console.log('MultiFile.slave.change',slave_count);
210
+
211
+ // Lose focus to stop IE7 firing onchange again
212
+ $(this).blur();
213
+
214
+ //# Trigger Event! onFileSelect
215
+ if(!MultiFile.trigger('onFileSelect', this, MultiFile)) return false;
216
+ //# End Event!
217
+
218
+ //# Retrive value of selected file from element
219
+ var ERROR = '', v = String(this.value || ''/*.attr('value)*/);
220
+
221
+ // check extension
222
+ if(MultiFile.accept && v && !v.match(MultiFile.rxAccept))//{
223
+ ERROR = MultiFile.STRING.denied.replace('$ext', String(v.match(/\.\w{1,4}$/gi)));
224
+ //}
225
+ //};
226
+
227
+ // Disallow duplicates
228
+ for(var f in MultiFile.slaves)//{
229
+ if(MultiFile.slaves[f] && MultiFile.slaves[f]!=this)//{
230
+ //console.log(MultiFile.slaves[f],MultiFile.slaves[f].value);
231
+ if(MultiFile.slaves[f].value==v)//{
232
+ ERROR = MultiFile.STRING.duplicate.replace('$file', v.match(/[^\/\\]+$/gi));
233
+ //};
234
+ //};
235
+ //};
236
+
237
+ // Create a new file input element
238
+ var newEle = $(MultiFile.clone).clone();// Copy parent attributes - Thanks to Jonas Wagner
239
+ //# Let's remember which input we've generated so
240
+ // we can disable the empty ones before submission
241
+ // See: http://plugins.jquery.com/node/1495
242
+ newEle.addClass('MultiFile');
243
+
244
+ // Handle error
245
+ if(ERROR!=''){
246
+ // Handle error
247
+ MultiFile.error(ERROR);
248
+
249
+ // 2007-06-24: BUG FIX - Thanks to Adrian Wr�bel <adrian [dot] wrobel [at] gmail.com>
250
+ // Ditch the trouble maker and add a fresh new element
251
+ MultiFile.n--;
252
+ MultiFile.addSlave(newEle[0], slave_count);
253
+ slave.parent().prepend(newEle);
254
+ slave.remove();
255
+ return false;
256
+ };
257
+
258
+ // Hide this element (NB: display:none is evil!)
259
+ $(this).css({ position:'absolute', top: '-3000px' });
260
+
261
+ // Add new element to the form
262
+ slave.after(newEle);
263
+
264
+ // Update list
265
+ MultiFile.addToList( this, slave_count );
266
+
267
+ // Bind functionality
268
+ MultiFile.addSlave( newEle[0], slave_count+1 );
269
+
270
+ //# Trigger Event! afterFileSelect
271
+ if(!MultiFile.trigger('afterFileSelect', this, MultiFile)) return false;
272
+ //# End Event!
273
+
274
+ }); // slave.change()
275
+
276
+ // Save control to element
277
+ $(slave).data('MultiFile', MultiFile);
278
+
279
+ };// MultiFile.addSlave
280
+ // Bind a new element
281
+
282
+
283
+
284
+ // Add a new file to the list
285
+ MultiFile.addToList = function( slave, slave_count ){
286
+ //if(window.console) console.log('MultiFile.addToList',slave_count);
287
+
288
+ //# Trigger Event! onFileAppend
289
+ if(!MultiFile.trigger('onFileAppend', slave, MultiFile)) return false;
290
+ //# End Event!
291
+
292
+ // Create label elements
293
+ var
294
+ r = $('<div class="MultiFile-label"></div>'),
295
+ v = String(slave.value || ''/*.attr('value)*/),
296
+ a = $('<span class="MultiFile-title" title="'+MultiFile.STRING.selected.replace('$file', v)+'">'+MultiFile.STRING.file.replace('$file', v.match(/[^\/\\]+$/gi)[0])+'</span>'),
297
+ b = $('<a class="MultiFile-remove" href="#'+MultiFile.wrapID+'">'+MultiFile.STRING.remove+'</a>');
298
+
299
+ // Insert label
300
+ MultiFile.list.append(
301
+ r.append(b, ' ', a)
302
+ );
303
+
304
+ b
305
+ .click(function(){
306
+
307
+ //# Trigger Event! onFileRemove
308
+ if(!MultiFile.trigger('onFileRemove', slave, MultiFile)) return false;
309
+ //# End Event!
310
+
311
+ MultiFile.n--;
312
+ MultiFile.current.disabled = false;
313
+
314
+ // Remove element, remove label, point to current
315
+ MultiFile.slaves[slave_count] = null;
316
+ $(slave).remove();
317
+ $(this).parent().remove();
318
+
319
+ // Show most current element again (move into view) and clear selection
320
+ $(MultiFile.current).css({ position:'', top: '' });
321
+ $(MultiFile.current).reset().val('').attr('value', '')[0].value = '';
322
+
323
+ //# Trigger Event! afterFileRemove
324
+ if(!MultiFile.trigger('afterFileRemove', slave, MultiFile)) return false;
325
+ //# End Event!
326
+
327
+ return false;
328
+ });
329
+
330
+ //# Trigger Event! afterFileAppend
331
+ if(!MultiFile.trigger('afterFileAppend', slave, MultiFile)) return false;
332
+ //# End Event!
333
+
334
+ }; // MultiFile.addToList
335
+ // Add element to selected files list
336
+
337
+
338
+
339
+ // Bind functionality to the first element
340
+ if(!MultiFile.MultiFile) MultiFile.addSlave(MultiFile.e, 0);
341
+
342
+ // Increment control count
343
+ //MultiFile.I++; // using window.MultiFile
344
+ MultiFile.n++;
345
+
346
+ // Save control to element
347
+ MultiFile.E.data('MultiFile', MultiFile);
348
+
349
+
350
+ //#####################################################################
351
+ // MAIN PLUGIN FUNCTIONALITY - END
352
+ //#####################################################################
353
+ }); // each element
354
+ };
355
+
356
+ /*--------------------------------------------------------*/
357
+
358
+ /*
359
+ ### Core functionality and API ###
360
+ */
361
+ $.extend($.fn.MultiFile, {
362
+ /**
363
+ * This method removes all selected files
364
+ *
365
+ * Returns a jQuery collection of all affected elements.
366
+ *
367
+ * @name reset
368
+ * @type jQuery
369
+ * @cat Plugins/MultiFile
370
+ * @author Diego A. (http://www.fyneworks.com/)
371
+ *
372
+ * @example $.fn.MultiFile.reset();
373
+ */
374
+ reset: function(){
375
+ var settings = $(this).data('MultiFile');
376
+ //if(settings) settings.wrapper.find('a.MultiFile-remove').click();
377
+ if(settings) settings.list.find('a.MultiFile-remove').click();
378
+ return $(this);
379
+ },
380
+
381
+
382
+ /**
383
+ * This utility makes it easy to disable all 'empty' file elements in the document before submitting a form.
384
+ * It marks the affected elements so they can be easily re-enabled after the form submission or validation.
385
+ *
386
+ * Returns a jQuery collection of all affected elements.
387
+ *
388
+ * @name disableEmpty
389
+ * @type jQuery
390
+ * @cat Plugins/MultiFile
391
+ * @author Diego A. (http://www.fyneworks.com/)
392
+ *
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 || [];
435
+ if(args.constructor.toString().indexOf("Array")<0) 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];
444
+ for(var i=0;i<methods.length;i++){
445
+ method = methods[i]+''; // make sure that we have a STRING
446
+ if(method) (function(method){ // make sure that method is ISOLATED for the interception
447
+ $.fn.MultiFile.intercepted[method] = $.fn[method] || function(){};
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
456
+ };// for each method
457
+ }
458
+ });
459
+
460
+ /*--------------------------------------------------------*/
461
+
462
+ /*
463
+ ### Default Settings ###
464
+ eg.: You can override default control like this:
465
+ $.fn.MultiFile.options.accept = 'gif|jpg';
466
+ */
467
+ $.fn.MultiFile.options = { //$.extend($.fn.MultiFile, { options: {
468
+ accept: '', // accepted file extensions
469
+ max: -1, // maximum number of selectable files
470
+
471
+ // name to use for newly created elements
472
+ namePattern: '$name', // same name by default (which creates an array)
473
+
474
+ // STRING: collection lets you show messages in different languages
475
+ STRING: {
476
+ remove:'x',
477
+ denied:'You cannot select a $ext file.\nTry again...',
478
+ file:'$file',
479
+ selected:'File selected: $file',
480
+ duplicate:'This file has already been selected:\n$file'
481
+ },
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){
489
+ /*
490
+ ERROR! blockUI is not currently working in IE
491
+ if($.blockUI){
492
+ $.blockUI({
493
+ message: s.replace(/\n/gi,'<br/>'),
494
+ css: {
495
+ border:'none', padding:'15px', size:'12.0pt',
496
+ backgroundColor:'#900', color:'#fff',
497
+ opacity:'.8','-webkit-border-radius': '10px','-moz-border-radius': '10px'
498
+ }
499
+ });
500
+ window.setTimeout($.unblockUI, 2000);
501
+ }
502
+ else//{// save a byte!
503
+ */
504
+ alert(s);
505
+ //}// save a byte!
506
+ }
507
+ }; //} });
508
+
509
+ /*--------------------------------------------------------*/
510
+
511
+ /*
512
+ ### Additional Methods ###
513
+ Required functionality outside the plugin's scope
514
+ */
515
+
516
+ // Native input reset method - because this alone doesn't always work: $(element).val('').attr('value', '')[0].value = '';
517
+ $.fn.reset = function(){ return this.each(function(){ try{ this.reset(); }catch(e){} }); };
518
+
519
+ /*--------------------------------------------------------*/
520
+
521
+ /*
522
+ ### Default implementation ###
523
+ The plugin will attach itself to file inputs
524
+ with the class 'multi' when the page loads
525
+ */
526
+ $(function(){
527
+ //$("input:file.multi").MultiFile();
528
+ $("input[type=file].multi").MultiFile();
529
+ });
530
+
531
+
532
+
533
+ /*# AVOID COLLISIONS #*/
534
+ })(jQuery);
535
+ /*# AVOID COLLISIONS #*/
admin/js/jquery.MultiFile.pack.js CHANGED
@@ -1,11 +1,11 @@
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
- *
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
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,{}))
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
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
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/ngg.ajax.js CHANGED
@@ -1,117 +1,118 @@
1
- /*
2
- * Ajax Plugin for NextGEN gallery
3
- * Version: 1.4.1
4
- * Author : Alex Rabe
5
- */
6
- (function($) {
7
- nggAjax = {
8
- settings: {
9
- url: nggAjaxSetup.url,
10
- type: "POST",
11
- action: nggAjaxSetup.action,
12
- operation : nggAjaxSetup.operation,
13
- nonce: nggAjaxSetup.nonce,
14
- ids: nggAjaxSetup.ids,
15
- permission: nggAjaxSetup.permission,
16
- error: nggAjaxSetup.error,
17
- failure: nggAjaxSetup.failure,
18
- timeout: 10000
19
- },
20
-
21
- run: function( index ) {
22
- s = this.settings;
23
- var req = $.ajax({
24
- type: "POST",
25
- url: s.url,
26
- data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
27
- cache: false,
28
- timeout: 10000,
29
- success: function(msg){
30
- switch ( parseInt(msg) ) {
31
- case -1:
32
- nggProgressBar.addNote( nggAjax.settings.permission );
33
- break;
34
- case 0:
35
- nggProgressBar.addNote( nggAjax.settings.error );
36
- break;
37
- case 1:
38
- // show nothing, its better
39
- break;
40
- default:
41
- // Return the message
42
- nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg );
43
- break;
44
- }
45
-
46
- },
47
- error: function (msg) {
48
- nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg.responseText );
49
- },
50
- complete: function () {
51
- index++;
52
- nggProgressBar.increase( index );
53
- // parse the whole array
54
- if (index < nggAjax.settings.ids.length)
55
- nggAjax.run( index );
56
- else
57
- nggProgressBar.finished();
58
- }
59
- });
60
- },
61
-
62
- readIDs: function( index ) {
63
- s = this.settings;
64
- var req = $.ajax({
65
- type: "POST",
66
- url: s.url,
67
- data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
68
- dataType: "json",
69
- cache: false,
70
- timeout: 10000,
71
- success: function(msg){
72
- // join the array
73
- imageIDS = imageIDS.concat(msg);
74
- },
75
- error: function (msg) {
76
- nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg.responseText );
77
- },
78
- complete: function () {
79
- index++;
80
- nggProgressBar.increase( index );
81
- // parse the whole array
82
- if (index < nggAjax.settings.ids.length)
83
- nggAjax.readIDs( index );
84
- else {
85
- // and now run the image operation
86
- index = 0;
87
- nggAjax.settings.ids = imageIDS;
88
- nggAjax.settings.operation = nextOperation;
89
- nggAjax.settings.maxStep = imageIDS.length;
90
- nggProgressBar.init( nggAjax.settings );
91
- nggAjax.run( index );
92
- }
93
- }
94
- });
95
- },
96
-
97
- init: function( s ) {
98
-
99
- var index = 0;
100
-
101
- // get the settings
102
- this.settings = $.extend( {}, this.settings, {}, s || {} );
103
-
104
- // a gallery operation need first all image ids via ajax
105
- if ( this.settings.operation.substring(0, 8) == 'gallery_' ) {
106
- nextOperation = this.settings.operation.substring(8);
107
- //first run, get all the ids
108
- this.settings.operation = 'get_image_ids';
109
- imageIDS = new Array();
110
- this.readIDs( index );
111
- } else {
112
- // start the ajax process
113
- this.run( index );
114
- }
115
- }
116
- }
117
- }(jQuery));
 
1
+ /*
2
+ * Ajax Plugin for NextGEN gallery
3
+ * Version: 1.4.1
4
+ * Author : Alex Rabe
5
+ *
6
+ */
7
+ (function($) {
8
+ nggAjax = {
9
+ settings: {
10
+ url: nggAjaxSetup.url,
11
+ type: "POST",
12
+ action: nggAjaxSetup.action,
13
+ operation : nggAjaxSetup.operation,
14
+ nonce: nggAjaxSetup.nonce,
15
+ ids: nggAjaxSetup.ids,
16
+ permission: nggAjaxSetup.permission,
17
+ error: nggAjaxSetup.error,
18
+ failure: nggAjaxSetup.failure,
19
+ timeout: 10000
20
+ },
21
+
22
+ run: function( index ) {
23
+ s = this.settings;
24
+ var req = $.ajax({
25
+ type: "POST",
26
+ url: s.url,
27
+ data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
28
+ cache: false,
29
+ timeout: 10000,
30
+ success: function(msg){
31
+ switch ( parseInt(msg) ) {
32
+ case -1:
33
+ nggProgressBar.addNote( nggAjax.settings.permission );
34
+ break;
35
+ case 0:
36
+ nggProgressBar.addNote( nggAjax.settings.error );
37
+ break;
38
+ case 1:
39
+ // show nothing, its better
40
+ break;
41
+ default:
42
+ // Return the message
43
+ nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg );
44
+ break;
45
+ }
46
+
47
+ },
48
+ error: function (msg) {
49
+ nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg.responseText );
50
+ },
51
+ complete: function () {
52
+ index++;
53
+ nggProgressBar.increase( index );
54
+ // parse the whole array
55
+ if (index < nggAjax.settings.ids.length)
56
+ nggAjax.run( index );
57
+ else
58
+ nggProgressBar.finished();
59
+ }
60
+ });
61
+ },
62
+
63
+ readIDs: function( index ) {
64
+ s = this.settings;
65
+ var req = $.ajax({
66
+ type: "POST",
67
+ url: s.url,
68
+ data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
69
+ dataType: "json",
70
+ cache: false,
71
+ timeout: 10000,
72
+ success: function(msg){
73
+ // join the array
74
+ imageIDS = imageIDS.concat(msg);
75
+ },
76
+ error: function (msg) {
77
+ nggProgressBar.addNote( "<strong>ID " + nggAjax.settings.ids[index] + ":</strong> " + nggAjax.settings.failure, msg.responseText );
78
+ },
79
+ complete: function () {
80
+ index++;
81
+ nggProgressBar.increase( index );
82
+ // parse the whole array
83
+ if (index < nggAjax.settings.ids.length)
84
+ nggAjax.readIDs( index );
85
+ else {
86
+ // and now run the image operation
87
+ index = 0;
88
+ nggAjax.settings.ids = imageIDS;
89
+ nggAjax.settings.operation = nextOperation;
90
+ nggAjax.settings.maxStep = imageIDS.length;
91
+ nggProgressBar.init( nggAjax.settings );
92
+ nggAjax.run( index );
93
+ }
94
+ }
95
+ });
96
+ },
97
+
98
+ init: function( s ) {
99
+
100
+ var index = 0;
101
+
102
+ // get the settings
103
+ this.settings = $.extend( {}, this.settings, {}, s || {} );
104
+
105
+ // a gallery operation need first all image ids via ajax
106
+ if ( this.settings.operation.substring(0, 8) == 'gallery_' ) {
107
+ nextOperation = this.settings.operation.substring(8);
108
+ //first run, get all the ids
109
+ this.settings.operation = 'get_image_ids';
110
+ imageIDS = new Array();
111
+ this.readIDs( index );
112
+ } else {
113
+ // start the ajax process
114
+ this.run( index );
115
+ }
116
+ }
117
+ }
118
+ }(jQuery));
admin/js/ngg.autocomplete.js CHANGED
@@ -3,6 +3,7 @@
3
  * see http://jqueryui.com/demos/autocomplete/
4
  * Version: 1.0.1
5
  * Author : Alex Rabe
 
6
  */
7
  jQuery.fn.nggAutocomplete = function ( args ) {
8
 
@@ -73,4 +74,4 @@ jQuery.fn.nggAutocomplete = function ( args ) {
73
  // pass empty string as value to search for, displaying all results
74
  jQuery(obj + "_ac").autocomplete('search', search );
75
  });
76
- }
3
  * see http://jqueryui.com/demos/autocomplete/
4
  * Version: 1.0.1
5
  * Author : Alex Rabe
6
+ *
7
  */
8
  jQuery.fn.nggAutocomplete = function ( args ) {
9
 
74
  // pass empty string as value to search for, displaying all results
75
  jQuery(obj + "_ac").autocomplete('search', search );
76
  });
77
+ }
admin/js/ngg.progressbar.js CHANGED
@@ -1,95 +1,96 @@
1
- /*
2
- * Progress bar Plugin for NextGEN gallery
3
- * Version: 2.0.3
4
- * Author : Alex Rabe
5
- */
6
- (function($) {
7
- nggProgressBar = {
8
-
9
- settings: {
10
- id: 'progressbar',
11
- maxStep: 100,
12
- wait: false,
13
- header: '',
14
- init:false
15
- },
16
-
17
- init: function( s ) {
18
-
19
- s = this.settings = $.extend( {}, this.settings, {}, s || {} );
20
- width = Math.round( ( 100 / s.maxStep ) * 100 ) /100;
21
- // add the initial progressbar
22
- if ( $( "#" + s.id + "_dialog" ).length == 0) {
23
- s.header = (s.header.length > 0) ? s.header : '' ;
24
- $("body").append('<div id="' + s.id + '_dialog"><div id="' + s.id + '" class="progressborder"><div class="' + s.id + '"><span>0%</span></div></div></div>');
25
- $('html,body').scrollTop(0); // works only in IE, FF
26
- // we open the dialog
27
- $( "#" + s.id + "_dialog" ).dialog({
28
- width: 640,
29
- resizable : true,
30
- modal: true,
31
- title: s.header
32
- });
33
- }
34
- // get the pointer to the dialog
35
- div = $('#' + s.id + '_dialog');
36
- s.init = true;
37
- },
38
-
39
- addMessage: function( message ) {
40
- s = this.settings;
41
- if ( div.find("#" + s.id + "_message").length == 0)
42
- div.append('<div class="' + s.id + '_message"><span style="display:block" id="' + s.id + '_message">' + message + '</span></div>');
43
- else
44
- $("#" + s.id + "_message").html( message );
45
- },
46
-
47
- addNote: function( note, detail ) {
48
- s = this.settings;
49
- s.wait = true;
50
- if ( div.find("#" + s.id + "_note").length == 0)
51
- div.append('<ul id="' + s.id + '_note">&nbsp;</ul>');
52
-
53
- if (detail)
54
- $("#" + s.id + "_note").append("<li>" + note + "<div class='show_details'><span>[more]</span><br />" + detail + "</div></li>");
55
- else
56
- $("#" + s.id + "_note").append("<li>" + note + "</li>");
57
- // increase the height to show the note
58
- div.dialog("option", "height", 220);
59
- },
60
-
61
- increase: function( step ) {
62
- s = this.settings;
63
- var value = step * width + "%";
64
- var rvalue = Math.round (step * width) + "%" ;
65
- $("#" + s.id + " div").width( value );
66
- $("#" + s.id + " span").html( rvalue );
67
- },
68
-
69
- finished: function() {
70
- s = this.settings;
71
- $("#" + s.id + " div").width( '100%' );
72
- $("#" + s.id + " span").html( '100%' );
73
- // in the case we add a note , we should wait for a click
74
- if (s.wait) {
75
- $("#" + s.id).delay(1000).hide("slow");
76
- div.click(function () {
77
- $("#" + s.id + "_dialog").dialog("destroy");
78
- $("#" + s.id + "_dialog").remove();
79
- // In the casee it's the manage page, force a submit
80
- $('.nggform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"0\">");
81
- $('.nggform').submit();
82
- });
83
- } else {
84
-
85
- window.setTimeout(function() {
86
- $("#" + s.id + "_dialog" ).delay(4000).dialog("destroy");
87
- $("#" + s.id + "_dialog").remove();
88
- // In the casee it's the manage page, force a submit
89
- $('.nggform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"1\">");
90
- $('.nggform').delay(4000).submit();
91
- }, 1000);
92
- }
93
- }
94
- };
95
- })(jQuery);
 
1
+ /*
2
+ * Progress bar Plugin for NextGEN gallery
3
+ * Version: 2.0.3
4
+ * Author : Alex Rabe
5
+ *
6
+ */
7
+ (function($) {
8
+ nggProgressBar = {
9
+
10
+ settings: {
11
+ id: 'progressbar',
12
+ maxStep: 100,
13
+ wait: false,
14
+ header: '',
15
+ init:false
16
+ },
17
+
18
+ init: function( s ) {
19
+
20
+ s = this.settings = $.extend( {}, this.settings, {}, s || {} );
21
+ width = Math.round( ( 100 / s.maxStep ) * 100 ) /100;
22
+ // add the initial progressbar
23
+ if ( $( "#" + s.id + "_dialog" ).length == 0) {
24
+ s.header = (s.header.length > 0) ? s.header : '' ;
25
+ $("body").append('<div id="' + s.id + '_dialog"><div id="' + s.id + '" class="progressborder"><div class="' + s.id + '"><span>0%</span></div></div></div>');
26
+ $('html,body').scrollTop(0); // works only in IE, FF
27
+ // we open the dialog
28
+ $( "#" + s.id + "_dialog" ).dialog({
29
+ width: 640,
30
+ resizable : true,
31
+ modal: true,
32
+ title: s.header
33
+ });
34
+ }
35
+ // get the pointer to the dialog
36
+ div = $('#' + s.id + '_dialog');
37
+ s.init = true;
38
+ },
39
+
40
+ addMessage: function( message ) {
41
+ s = this.settings;
42
+ if ( div.find("#" + s.id + "_message").length == 0)
43
+ div.append('<div class="' + s.id + '_message"><span style="display:block" id="' + s.id + '_message">' + message + '</span></div>');
44
+ else
45
+ $("#" + s.id + "_message").html( message );
46
+ },
47
+
48
+ addNote: function( note, detail ) {
49
+ s = this.settings;
50
+ s.wait = true;
51
+ if ( div.find("#" + s.id + "_note").length == 0)
52
+ div.append('<ul id="' + s.id + '_note">&nbsp;</ul>');
53
+
54
+ if (detail)
55
+ $("#" + s.id + "_note").append("<li>" + note + "<div class='show_details'><span>[more]</span><br />" + detail + "</div></li>");
56
+ else
57
+ $("#" + s.id + "_note").append("<li>" + note + "</li>");
58
+ // increase the height to show the note
59
+ div.dialog("option", "height", 220);
60
+ },
61
+
62
+ increase: function( step ) {
63
+ s = this.settings;
64
+ var value = step * width + "%";
65
+ var rvalue = Math.round (step * width) + "%" ;
66
+ $("#" + s.id + " div").width( value );
67
+ $("#" + s.id + " span").html( rvalue );
68
+ },
69
+
70
+ finished: function() {
71
+ s = this.settings;
72
+ $("#" + s.id + " div").width( '100%' );
73
+ $("#" + s.id + " span").html( '100%' );
74
+ // in the case we add a note , we should wait for a click
75
+ if (s.wait) {
76
+ $("#" + s.id).delay(1000).hide("slow");
77
+ div.click(function () {
78
+ $("#" + s.id + "_dialog").dialog("destroy");
79
+ $("#" + s.id + "_dialog").remove();
80
+ // In the casee it's the manage page, force a submit
81
+ $('.nggform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"0\">");
82
+ $('.nggform').submit();
83
+ });
84
+ } else {
85
+
86
+ window.setTimeout(function() {
87
+ $("#" + s.id + "_dialog" ).delay(4000).dialog("destroy");
88
+ $("#" + s.id + "_dialog").remove();
89
+ // In the casee it's the manage page, force a submit
90
+ $('.nggform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"1\">");
91
+ $('.nggform').delay(4000).submit();
92
+ }, 1000);
93
+ }
94
+ }
95
+ };
96
+ })(jQuery);
admin/js/ngg_news_notice.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function($){
2
+ $('#wp-admin-bar-ngg-menu').pointer({
3
+ content: nggAdmin.content,
4
+ pointerClass: 'pointer ngg_latest_news_notice',
5
+ close: function(){
6
+ var data = {
7
+ action: 'hide_news_notice',
8
+ nonce: nggAdmin.nonce
9
+ }
10
+ jQuery.post(ajaxurl, data);
11
+ }
12
+ }).pointer('open');
13
+ });
admin/js/ngg_social_media.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
2
+ (function(d, s, id) {
3
+ var js, fjs = d.getElementsByTagName(s)[0];
4
+ if (d.getElementById(id)) return;
5
+ js = d.createElement(s); js.id = id;
6
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=66864567775";
7
+ fjs.parentNode.insertBefore(js, fjs);
8
+ }(document, 'script', 'facebook-jssdk'));
admin/js/sorter.js CHANGED
@@ -1,294 +1,294 @@
1
- /************************************************************************************************************
2
- (C) www.dhtmlgoodies.com, September 2005
3
-
4
- This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
5
-
6
- Terms of use:
7
- LGPL: See web page for more info.
8
-
9
- Thank you!
10
-
11
- www.dhtmlgoodies.com
12
- Alf Magne Kalleland
13
-
14
- //TODO : Contain a marker position error when the window will be scroll down
15
-
16
- ************************************************************************************************************/
17
- var operaBrowser = navigator.userAgent.indexOf('Opera') >=0 ? 1 : false;
18
- var webkitBrowser = navigator.userAgent.indexOf('Safari') >=0 ? false : false;
19
- var MSIE = navigator.userAgent.indexOf('MSIE')>= 0 ? true : false;
20
- var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;
21
-
22
- function cancelEvent()
23
- {
24
- return false;
25
- }
26
- var activeImage = false;
27
- var readyToMove = false;
28
- var moveTimer = -1;
29
- var dragDropDiv;
30
- var insertionMarker;
31
-
32
- var offsetX_marker = -3; // offset X - element that indicates destinaton of drop
33
- var offsetY_marker = 0; // offset Y - element that indicates destinaton of drop
34
-
35
- var firefoxOffsetX_marker = -3;
36
- var firefoxOffsetY_marker = -2;
37
-
38
- if(navigatorVersion<6 && MSIE){ /* IE 5.5 fix */
39
- offsetX_marker-=23;
40
- offsetY_marker-=10;
41
- }
42
-
43
- var destinationObject = false;
44
-
45
- var divXPositions = new Array();
46
- var divYPositions = new Array();
47
- var divWidth = new Array();
48
- var divHeight = new Array();
49
-
50
- var tmpLeft = 0;
51
- var tmpTop = 0;
52
-
53
- var eventDiff_x = 0;
54
- var eventDiff_y = 0;
55
-
56
- function getTopPos(inputObj)
57
- {
58
- var returnValue = inputObj.offsetTop;
59
- while((inputObj = inputObj.offsetParent) != null){
60
- if(inputObj.tagName!='HTML'){
61
- returnValue += (inputObj.offsetTop - inputObj.scrollTop);
62
- if(document.all)returnValue+=inputObj.clientTop;
63
- }
64
- }
65
- return returnValue;
66
- }
67
-
68
- function getLeftPos(inputObj)
69
- {
70
- var returnValue = inputObj.offsetLeft;
71
- while((inputObj = inputObj.offsetParent) != null){
72
- if(inputObj.tagName!='HTML'){
73
- returnValue += inputObj.offsetLeft;
74
- if(document.all)returnValue+=inputObj.clientLeft;
75
- }
76
- }
77
- return returnValue;
78
- }
79
-
80
- function selectImage(e)
81
- {
82
- if(document.all && !operaBrowser)e = event;
83
- var obj = this.parentNode;
84
- if(activeImage)activeImage.className='imageBox';
85
- obj.className = 'imageBoxHighlighted';
86
- activeImage = obj;
87
- readyToMove = true;
88
- moveTimer=0;
89
-
90
- tmpLeft = e.clientX + Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
91
- tmpTop = e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop);
92
-
93
- startMoveTimer();
94
-
95
- return false;
96
- }
97
-
98
- function startMoveTimer(){
99
- if(moveTimer>=0 && moveTimer<10){
100
- moveTimer++;
101
- setTimeout('startMoveTimer()',15);
102
- }
103
- if(moveTimer==10){
104
- getDivCoordinates();
105
- var subElements = dragDropDiv.getElementsByTagName('DIV');
106
- if(subElements.length>0){
107
- dragDropDiv.removeChild(subElements[0]);
108
- }
109
-
110
- jQuery("#dragDropContent").show();
111
- // dragDropDiv.style.display='block';
112
- var newDiv = activeImage.cloneNode(true);
113
- newDiv.className='imageBox';
114
- newDiv.id='';
115
- jQuery("#dragDropContent").append(newDiv);
116
- //dragDropDiv.appendChild(newDiv);
117
-
118
- jQuery("#dragDropContent").css("top" , tmpTop + 'px');
119
- jQuery("#dragDropContent").css("left" , tmpLeft + 'px');
120
- // dragDropDiv.style.top = tmpTop + 'px';
121
- // dragDropDiv.style.left = tmpLeft + 'px';
122
-
123
- }
124
- return false;
125
- }
126
-
127
- function dragDropEnd(ev)
128
- {
129
- readyToMove = false;
130
- moveTimer = -1;
131
-
132
- jQuery("#dragDropContent").hide();
133
- //dragDropDiv.style.display='none';
134
- jQuery("#insertionMarker").hide();
135
- //insertionMarker.style.display='none';
136
-
137
- if(destinationObject && destinationObject!=activeImage){
138
- var parentObj = destinationObject.parentNode;
139
- parentObj.insertBefore(activeImage,destinationObject);
140
- activeImage.className='imageBox';
141
- activeImage = false;
142
- destinationObject=false;
143
- getDivCoordinates();
144
- }
145
- return false;
146
- }
147
-
148
- function dragDropMove(e)
149
- {
150
- if(moveTimer==-1)
151
- return;
152
- if(document.all && !operaBrowser)
153
- e = event;
154
-
155
- if (webkitBrowser) {
156
- var leftPos = e.pageX - eventDiff_x;
157
- var topPos = e.pageY - eventDiff_y;
158
- } else {
159
- var leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x;
160
- var topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y;
161
- }
162
-
163
- // message = " topPos: <strong>" + topPos + "</strong> e.pageY: <strong>" + e.pageY + "</strong> e.clientY: <strong>" + e.clientY + "</strong> scrollTop: <strong>" + document.documentElement.scrollTop + "</strong>";
164
- // message += "<br /> leftPos: <strong>" + leftPos + "</strong> e.pageX: <strong>" + e.pageX + "</strong> e.clientX: <strong>" + e.clientX + "</strong> scrollLeft: <strong>" + document.documentElement.scrollLeft + "</strong>";
165
- //debug( message );
166
-
167
- dragDropDiv.style.top = topPos + 'px';
168
- dragDropDiv.style.left = leftPos + 'px';
169
-
170
- leftPos = leftPos + eventDiff_x;
171
- topPos = topPos + eventDiff_y;
172
-
173
- if(e.button!=1 && document.all && !operaBrowser)dragDropEnd(e);
174
- var elementFound = false;
175
- for(var prop in divXPositions){
176
- // message = (divXPositions[prop]/1) + " < " + leftPos/1 + " && " + (divXPositions[prop]/1 + divWidth[prop]*0.7) + " > " + (leftPos/1);
177
- // message += "<br />" + (divYPositions[prop]/1) + " < " + topPos/1 + " && " + (divYPositions[prop]/1 + divWidth[prop]) + " > " + (topPos/1);
178
- // debug( message );
179
- if( (divXPositions[prop]/1 < leftPos/1) && ( (divXPositions[prop]/1 + divWidth[prop]*0.7) > leftPos/1) && ( (divYPositions[prop]/1) < topPos/1) && (( (divYPositions[prop]/1) + divWidth[prop]) > topPos/1)) {
180
-
181
- // check for IE who support document.all
182
- if( document.all && !webkitBrowser ){
183
- offsetX = offsetX_marker;
184
- offsetY = offsetY_marker;
185
- }else{
186
- offsetX = firefoxOffsetX_marker;
187
- offsetY = firefoxOffsetY_marker;
188
- }
189
- jQuery("#insertionMarker").css("top", divYPositions[prop] + offsetY + 'px');
190
- //insertionMarker.style.top = divYPositions[prop] + offsetY + 'px';
191
- jQuery("#insertionMarker").css("left", divXPositions[prop] + offsetX + 'px');
192
- //insertionMarker.style.left = divXPositions[prop] + offsetX + 'px';
193
- jQuery("#insertionMarker").show();
194
- //insertionMarker.style.display='block';
195
- destinationObject = document.getElementById(prop);
196
- elementFound = true;
197
- break;
198
- }
199
- }
200
-
201
-
202
- if(!elementFound){
203
- jQuery("#insertionMarker").hide();
204
- //insertionMarker.style.display='none';
205
- destinationObject = false;
206
- }
207
-
208
- return false;
209
-
210
- }
211
-
212
- // brackets are not recognize by jQuery
213
- // see http://groups.google.com/group/jquery-en/browse_thread/thread/29438736a4369d7b
214
- function $$(selector, context){
215
- return jQuery(selector.replace(/(\[|\])/g, '\\$1'),context)
216
- }
217
-
218
- function getDivCoordinates()
219
- {
220
- var divs = document.getElementsByTagName('div');
221
- for(var no=0;no<divs.length;no++){
222
- if(divs[no].className=='imageBox' || divs[no].className=='imageBoxHighlighted' && divs[no].id){
223
- divXPositions[divs[no].id] = getLeftPos(divs[no]);
224
- divYPositions[divs[no].id] = getTopPos(divs[no]);
225
- divWidth[divs[no].id] = divs[no].offsetWidth;
226
- divHeight[divs[no].id] = divs[no].offsetHeight;
227
- // show coordinates
228
- // $$('#' + divs[no].id + ' span').html("X: " + getLeftPos(divs[no])+ " Y: " + getTopPos(divs[no]));
229
- }
230
- }
231
- }
232
-
233
- // seralize the ImageOrder
234
- function saveImageOrder()
235
- {
236
- var serial = "";
237
- var objects = document.getElementsByTagName('div');
238
- for(var no=0;no<objects.length;no++){
239
- if(objects[no].className=='imageBox' || objects[no].className=='imageBoxHighlighted'){
240
- if (serial.length > 0) serial = serial + '&'
241
- serial = serial + "sortArray[]=" + objects[no].id;
242
- }
243
- }
244
- jQuery('input[name=sortorder]').val(serial);
245
- // debug( 'This is the new order of the images(IDs) : <br>' + orderString );
246
-
247
- }
248
-
249
- function initGallery()
250
- {
251
- var divs = document.getElementsByTagName('div');
252
- for(var no=0;no<divs.length;no++){
253
- if(divs[no].className=='imageBox_theImage' || divs[no].className=='imageBox_label'){
254
- divs[no].onmousedown = selectImage;
255
- }
256
- }
257
-
258
- var insObj = document.getElementById('insertionMarker');
259
- var images = insObj.getElementsByTagName('IMG');
260
- document.body.onselectstart = cancelEvent;
261
- document.body.ondragstart = cancelEvent;
262
- document.body.onmouseup = dragDropEnd;
263
- document.body.onmousemove = dragDropMove;
264
-
265
-
266
- window.onresize = getDivCoordinates;
267
-
268
- dragDropDiv = document.getElementById('dragDropContent');
269
- // insertionMarker = document.getElementById('insertionMarker');
270
- jQuery("#insertionMarker").hide();
271
- getDivCoordinates();
272
-
273
- var list = document.getElementsByClassName('imageBox');
274
- var container = list[0].parentNode;
275
- var lastImage = list[list.length-1];
276
-
277
- var fooDiv = document.createElement('div');
278
- fooDiv.className = "imageBox";
279
- fooDiv.id = "foo";
280
- fooDiv.style.cssText = "visibility:hidden";
281
-
282
- if(lastImage.nextSibling){
283
- container.insertBefore(fooDiv,lastImage.nextSibling);
284
- } else {
285
- container.appendChild(fooDiv);
286
- }
287
-
288
- }
289
-
290
- function debug(value) {
291
- document.getElementById('debug').innerHTML = value;
292
- }
293
-
294
- window.onload = initGallery;
1
+ /************************************************************************************************************
2
+ (C) www.dhtmlgoodies.com, September 2005
3
+
4
+ This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
5
+
6
+ Terms of use:
7
+ LGPL: See web page for more info.
8
+
9
+ Thank you!
10
+
11
+ www.dhtmlgoodies.com
12
+ Alf Magne Kalleland
13
+
14
+ //TODO : Contain a marker position error when the window will be scroll down
15
+
16
+ ************************************************************************************************************/
17
+ var operaBrowser = navigator.userAgent.indexOf('Opera') >=0 ? 1 : false;
18
+ var webkitBrowser = navigator.userAgent.indexOf('Safari') >=0 ? false : false;
19
+ var MSIE = navigator.userAgent.indexOf('MSIE')>= 0 ? true : false;
20
+ var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;
21
+
22
+ function cancelEvent()
23
+ {
24
+ return false;
25
+ }
26
+ var activeImage = false;
27
+ var readyToMove = false;
28
+ var moveTimer = -1;
29
+ var dragDropDiv;
30
+ var insertionMarker;
31
+
32
+ var offsetX_marker = -3; // offset X - element that indicates destinaton of drop
33
+ var offsetY_marker = 0; // offset Y - element that indicates destinaton of drop
34
+
35
+ var firefoxOffsetX_marker = -3;
36
+ var firefoxOffsetY_marker = -2;
37
+
38
+ if(navigatorVersion<6 && MSIE){ /* IE 5.5 fix */
39
+ offsetX_marker-=23;
40
+ offsetY_marker-=10;
41
+ }
42
+
43
+ var destinationObject = false;
44
+
45
+ var divXPositions = new Array();
46
+ var divYPositions = new Array();
47
+ var divWidth = new Array();
48
+ var divHeight = new Array();
49
+
50
+ var tmpLeft = 0;
51
+ var tmpTop = 0;
52
+
53
+ var eventDiff_x = 0;
54
+ var eventDiff_y = 0;
55
+
56
+ function getTopPos(inputObj)
57
+ {
58
+ var returnValue = inputObj.offsetTop;
59
+ while((inputObj = inputObj.offsetParent) != null){
60
+ if(inputObj.tagName!='HTML'){
61
+ returnValue += (inputObj.offsetTop - inputObj.scrollTop);
62
+ if(document.all)returnValue+=inputObj.clientTop;
63
+ }
64
+ }
65
+ return returnValue;
66
+ }
67
+
68
+ function getLeftPos(inputObj)
69
+ {
70
+ var returnValue = inputObj.offsetLeft;
71
+ while((inputObj = inputObj.offsetParent) != null){
72
+ if(inputObj.tagName!='HTML'){
73
+ returnValue += inputObj.offsetLeft;
74
+ if(document.all)returnValue+=inputObj.clientLeft;
75
+ }
76
+ }
77
+ return returnValue;
78
+ }
79
+
80
+ function selectImage(e)
81
+ {
82
+ if(document.all && !operaBrowser)e = event;
83
+ var obj = this.parentNode;
84
+ if(activeImage)activeImage.className='imageBox';
85
+ obj.className = 'imageBoxHighlighted';
86
+ activeImage = obj;
87
+ readyToMove = true;
88
+ moveTimer=0;
89
+
90
+ tmpLeft = e.clientX + Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
91
+ tmpTop = e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop);
92
+
93
+ startMoveTimer();
94
+
95
+ return false;
96
+ }
97
+
98
+ function startMoveTimer(){
99
+ if(moveTimer>=0 && moveTimer<10){
100
+ moveTimer++;
101
+ setTimeout('startMoveTimer()',15);
102
+ }
103
+ if(moveTimer==10){
104
+ getDivCoordinates();
105
+ var subElements = dragDropDiv.getElementsByTagName('DIV');
106
+ if(subElements.length>0){
107
+ dragDropDiv.removeChild(subElements[0]);
108
+ }
109
+
110
+ jQuery("#dragDropContent").show();
111
+ // dragDropDiv.style.display='block';
112
+ var newDiv = activeImage.cloneNode(true);
113
+ newDiv.className='imageBox';
114
+ newDiv.id='';
115
+ jQuery("#dragDropContent").append(newDiv);
116
+ //dragDropDiv.appendChild(newDiv);
117
+
118
+ jQuery("#dragDropContent").css("top" , tmpTop + 'px');
119
+ jQuery("#dragDropContent").css("left" , tmpLeft + 'px');
120
+ // dragDropDiv.style.top = tmpTop + 'px';
121
+ // dragDropDiv.style.left = tmpLeft + 'px';
122
+
123
+ }
124
+ return false;
125
+ }
126
+
127
+ function dragDropEnd(ev)
128
+ {
129
+ readyToMove = false;
130
+ moveTimer = -1;
131
+
132
+ jQuery("#dragDropContent").hide();
133
+ //dragDropDiv.style.display='none';
134
+ jQuery("#insertionMarker").hide();
135
+ //insertionMarker.style.display='none';
136
+
137
+ if(destinationObject && destinationObject!=activeImage){
138
+ var parentObj = destinationObject.parentNode;
139
+ parentObj.insertBefore(activeImage,destinationObject);
140
+ activeImage.className='imageBox';
141
+ activeImage = false;
142
+ destinationObject=false;
143
+ getDivCoordinates();
144
+ }
145
+ return false;
146
+ }
147
+
148
+ function dragDropMove(e)
149
+ {
150
+ if(moveTimer==-1)
151
+ return;
152
+ if(document.all && !operaBrowser)
153
+ e = event;
154
+
155
+ if (webkitBrowser) {
156
+ var leftPos = e.pageX - eventDiff_x;
157
+ var topPos = e.pageY - eventDiff_y;
158
+ } else {
159
+ var leftPos = e.clientX + document.documentElement.scrollLeft - eventDiff_x;
160
+ var topPos = e.clientY + document.documentElement.scrollTop - eventDiff_y;
161
+ }
162
+
163
+ // message = " topPos: <strong>" + topPos + "</strong> e.pageY: <strong>" + e.pageY + "</strong> e.clientY: <strong>" + e.clientY + "</strong> scrollTop: <strong>" + document.documentElement.scrollTop + "</strong>";
164
+ // message += "<br /> leftPos: <strong>" + leftPos + "</strong> e.pageX: <strong>" + e.pageX + "</strong> e.clientX: <strong>" + e.clientX + "</strong> scrollLeft: <strong>" + document.documentElement.scrollLeft + "</strong>";
165
+ //debug( message );
166
+
167
+ dragDropDiv.style.top = topPos + 'px';
168
+ dragDropDiv.style.left = leftPos + 'px';
169
+
170
+ leftPos = leftPos + eventDiff_x;
171
+ topPos = topPos + eventDiff_y;
172
+
173
+ if(e.button!=1 && document.all && !operaBrowser)dragDropEnd(e);
174
+ var elementFound = false;
175
+ for(var prop in divXPositions){
176
+ // message = (divXPositions[prop]/1) + " < " + leftPos/1 + " && " + (divXPositions[prop]/1 + divWidth[prop]*0.7) + " > " + (leftPos/1);
177
+ // message += "<br />" + (divYPositions[prop]/1) + " < " + topPos/1 + " && " + (divYPositions[prop]/1 + divWidth[prop]) + " > " + (topPos/1);
178
+ // debug( message );
179
+ if( (divXPositions[prop]/1 < leftPos/1) && ( (divXPositions[prop]/1 + divWidth[prop]*0.7) > leftPos/1) && ( (divYPositions[prop]/1) < topPos/1) && (( (divYPositions[prop]/1) + divWidth[prop]) > topPos/1)) {
180
+
181
+ // check for IE who support document.all
182
+ if( document.all && !webkitBrowser ){
183
+ offsetX = offsetX_marker;
184
+ offsetY = offsetY_marker;
185
+ }else{
186
+ offsetX = firefoxOffsetX_marker;
187
+ offsetY = firefoxOffsetY_marker;
188
+ }
189
+ jQuery("#insertionMarker").css("top", divYPositions[prop] + offsetY + 'px');
190
+ //insertionMarker.style.top = divYPositions[prop] + offsetY + 'px';
191
+ jQuery("#insertionMarker").css("left", divXPositions[prop] + offsetX + 'px');
192
+ //insertionMarker.style.left = divXPositions[prop] + offsetX + 'px';
193
+ jQuery("#insertionMarker").show();
194
+ //insertionMarker.style.display='block';
195
+ destinationObject = document.getElementById(prop);
196
+ elementFound = true;
197
+ break;
198
+ }
199
+ }
200
+
201
+
202
+ if(!elementFound){
203
+ jQuery("#insertionMarker").hide();
204
+ //insertionMarker.style.display='none';
205
+ destinationObject = false;
206
+ }
207
+
208
+ return false;
209
+
210
+ }
211
+
212
+ // brackets are not recognize by jQuery
213
+ // see http://groups.google.com/group/jquery-en/browse_thread/thread/29438736a4369d7b
214
+ function $$(selector, context){
215
+ return jQuery(selector.replace(/(\[|\])/g, '\\$1'),context)
216
+ }
217
+
218
+ function getDivCoordinates()
219
+ {
220
+ var divs = document.getElementsByTagName('div');
221
+ for(var no=0;no<divs.length;no++){
222
+ if(divs[no].className=='imageBox' || divs[no].className=='imageBoxHighlighted' && divs[no].id){
223
+ divXPositions[divs[no].id] = getLeftPos(divs[no]);
224
+ divYPositions[divs[no].id] = getTopPos(divs[no]);
225
+ divWidth[divs[no].id] = divs[no].offsetWidth;
226
+ divHeight[divs[no].id] = divs[no].offsetHeight;
227
+ // show coordinates
228
+ // $$('#' + divs[no].id + ' span').html("X: " + getLeftPos(divs[no])+ " Y: " + getTopPos(divs[no]));
229
+ }
230
+ }
231
+ }
232
+
233
+ // seralize the ImageOrder
234
+ function saveImageOrder()
235
+ {
236
+ var serial = "";
237
+ var objects = document.getElementsByTagName('div');
238
+ for(var no=0;no<objects.length;no++){
239
+ if(objects[no].className=='imageBox' || objects[no].className=='imageBoxHighlighted'){
240
+ if (serial.length > 0) serial = serial + '&'
241
+ serial = serial + "sortArray[]=" + objects[no].id;
242
+ }
243
+ }
244
+ jQuery('input[name=sortorder]').val(serial);
245
+ // debug( 'This is the new order of the images(IDs) : <br>' + orderString );
246
+
247
+ }
248
+
249
+ function initGallery()
250
+ {
251
+ var divs = document.getElementsByTagName('div');
252
+ for(var no=0;no<divs.length;no++){
253
+ if(divs[no].className=='imageBox_theImage' || divs[no].className=='imageBox_label'){
254
+ divs[no].onmousedown = selectImage;
255
+ }
256
+ }
257
+
258
+ var insObj = document.getElementById('insertionMarker');
259
+ var images = insObj.getElementsByTagName('IMG');
260
+ document.body.onselectstart = cancelEvent;
261
+ document.body.ondragstart = cancelEvent;
262
+ document.body.onmouseup = dragDropEnd;
263
+ document.body.onmousemove = dragDropMove;
264
+
265
+
266
+ window.onresize = getDivCoordinates;
267
+
268
+ dragDropDiv = document.getElementById('dragDropContent');
269
+ // insertionMarker = document.getElementById('insertionMarker');
270
+ jQuery("#insertionMarker").hide();
271
+ getDivCoordinates();
272
+
273
+ var list = document.getElementsByClassName('imageBox');
274
+ var container = list[0].parentNode;
275
+ var lastImage = list[list.length-1];
276
+
277
+ var fooDiv = document.createElement('div');
278
+ fooDiv.className = "imageBox";
279
+ fooDiv.id = "foo";
280
+ fooDiv.style.cssText = "visibility:hidden";
281
+
282
+ if(lastImage.nextSibling){
283
+ container.insertBefore(fooDiv,lastImage.nextSibling);
284
+ } else {
285
+ container.appendChild(fooDiv);
286
+ }
287
+
288
+ }
289
+
290
+ function debug(value) {
291
+ document.getElementById('debug').innerHTML = value;
292
+ }
293
+
294
+ window.onload = initGallery;
admin/js/swfupload.handler.js CHANGED
@@ -1,153 +1,153 @@
1
- /**
2
- * NextGEN Gallery - SWFUpload Handler
3
- * http://alexrabe.boelinger.com/
4
- *
5
- * Built on top of the swfupload library
6
- * http://swfupload.org version 2.2.0
7
- *
8
- * version 1.0.3
9
- */
10
-
11
- // on load change the upload to swfupload
12
- function initSWFUpload() {
13
- jQuery(function() {
14
- jQuery("#uploadimage_btn").after("<input class='button-primary' type='button' name='uploadimage' id='swfupload_btn' value='" + ngg_swf_upload.customSettings.upload + "' />")
15
- .remove();
16
- jQuery("#swfupload_btn").click( function() { submitFiles(); } );
17
- jQuery("#imagefiles")
18
- .after("<div id='uploadQueue'></div>")
19
- .after("<input id='imagefiles' type='button' class='button-secondary uploadform' value='" + ngg_swf_upload.customSettings.browse + "' />")
20
- .after("<input type='text' id='txtFileName' readonly='readonly' />")
21
- .remove();
22
- jQuery("#imagefiles").click( function() { fileBrowse(); } );
23
- });
24
- }
25
-
26
- // call the upload dialog
27
- function fileBrowse() {
28
- jQuery("#txtFileName").val("");
29
- ngg_swf_upload.cancelUpload();
30
- ngg_swf_upload.selectFiles();
31
- }
32
-
33
- // called when a file is added
34
- function fileQueued(fileObj) {
35
- filesize = " (" + Math.round(fileObj.size/1024) + " kB) ";
36
- jQuery("#txtFileName").val(fileObj.name);
37
- jQuery("#uploadQueue")
38
- .append("<div id='" + fileObj.id + "' class='nggUploadItem'> [<a href='javascript:removeFile(\"" + fileObj.id + "\");'>" + ngg_swf_upload.customSettings.remove + "</a>] " + fileObj.name + filesize + "</div>")
39
- .children("div:last").slideDown("slow")
40
- .end();
41
- }
42
-
43
- // start the upload
44
- function submitFiles() {
45
- // check if a gallery is selected
46
- if (jQuery('#galleryselect').val() > "0") {
47
- nggProgressBar.init(nggAjaxOptions);
48
- // get old post_params
49
- post_params = ngg_swf_upload.getSetting("post_params");
50
- // update the selected gallery in the post_params
51
- post_params['galleryselect'] = jQuery('#galleryselect').val();
52
- ngg_swf_upload.setPostParams(post_params);
53
- ngg_swf_upload.startUpload();
54
- } else {
55
- jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"-1\">");
56
- jQuery("#uploadimage_form").submit();
57
- }
58
- }
59
-
60
- // called when a file will be removed
61
- function removeFile(fileID) {
62
- ngg_swf_upload.cancelUpload(fileID);
63
- jQuery("#" + fileID).hide("slow");
64
- jQuery("#" + fileID).remove();
65
- }
66
-
67
- // called before the uploads start
68
- function uploadStart(fileObj) {
69
- nggProgressBar.init(nggAjaxOptions);
70
- return true;
71
- }
72
-
73
- // called during the upload progress
74
- function uploadProgress(fileObj, bytesLoaded) {
75
- var percent = Math.ceil((bytesLoaded / fileObj.size) * 100);
76
- nggProgressBar.increase( percent );
77
- jQuery("#progressbar span").text(percent + "% - " + fileObj.name);
78
- }
79
-
80
- // called when the file is uploaded
81
- function uploadComplete(fileObj) {
82
- jQuery("#" + fileObj.id).hide("slow");
83
- jQuery("#" + fileObj.id).remove();
84
- if ( ngg_swf_upload.getStats().files_queued == 0) {
85
- nggProgressBar.finished();
86
- jQuery("#uploadimage_form").submit();
87
- }
88
- }
89
-
90
- // called when all files are uploaded
91
- function uploadSuccess(fileObj, server_data) {
92
- // Show any error message
93
- if (server_data != 0){
94
- nggProgressBar.addNote("<strong>ERROR</strong>: " + fileObj.name + " : " + server_data);
95
- }
96
- // Upload the next file until queue is empty
97
- if ( ngg_swf_upload.getStats().files_queued > 0) {
98
- ngg_swf_upload.startUpload();
99
- } else {
100
- // server_data could be add as hidden field
101
- jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + server_data + "\">");
102
- }
103
- }
104
-
105
- // called on error
106
- function uploadError(fileObj, error_code, message) {
107
- var error_name = "";
108
- switch(error_code) {
109
- case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
110
- error_name = "HTTP ERROR";
111
- break;
112
- case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
113
- error_name = "MISSING UPLOAD URL";
114
- break;
115
- case SWFUpload.UPLOAD_ERROR.IO_ERROR:
116
- error_name = "IO FAILURE";
117
- break;
118
- case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
119
- error_name = "SECURITY ERROR";
120
- break;
121
- case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
122
- error_name = "UPLOAD LIMIT EXCEEDED";
123
- break;
124
- case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
125
- error_name = "UPLOAD FAILED";
126
- break;
127
- case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
128
- error_name = "SPECIFIED FILE ID NOT FOUND";
129
- break;
130
- case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
131
- error_name = "FILE VALIDATION FAILED";
132
- break;
133
- case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
134
- error_name = "FILE CANCELLED";
135
- return;
136
- break;
137
- case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
138
- error_name = "FILE STOPPED";
139
- break;
140
- default:
141
- error_name = "UNKNOWN";
142
- break;
143
- }
144
- nggProgressBar.addNote("<strong>ERROR " + error_name + " </strong>: " + fileObj.name + " : " + message);
145
- jQuery("#" + fileObj.id).hide("slow");
146
- jQuery("#" + fileObj.id).remove();
147
- if ( ngg_swf_upload.getStats().files_queued > 0) {
148
- ngg_swf_upload.startUpload();
149
- } else {
150
- jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + error_name + "\">");
151
- jQuery("#uploadimage_form").submit();
152
- }
153
- }
1
+ /**
2
+ * NextGEN Gallery - SWFUpload Handler
3
+ * http://www.nextgen-gallery.com/
4
+ *
5
+ * Built on top of the swfupload library
6
+ * http://swfupload.org version 2.2.0
7
+ *
8
+ * version 1.0.3
9
+ */
10
+
11
+ // on load change the upload to swfupload
12
+ function initSWFUpload() {
13
+ jQuery(function() {
14
+ jQuery("#uploadimage_btn").after("<input class='button-primary' type='button' name='uploadimage' id='swfupload_btn' value='" + ngg_swf_upload.customSettings.upload + "' />")
15
+ .remove();
16
+ jQuery("#swfupload_btn").click( function() { submitFiles(); } );
17
+ jQuery("#imagefiles")
18
+ .after("<div id='uploadQueue'></div>")
19
+ .after("<input id='imagefiles' type='button' class='button-secondary uploadform' value='" + ngg_swf_upload.customSettings.browse + "' />")
20
+ .after("<input type='text' id='txtFileName' readonly='readonly' />")
21
+ .remove();
22
+ jQuery("#imagefiles").click( function() { fileBrowse(); } );
23
+ });
24
+ }
25
+
26
+ // call the upload dialog
27
+ function fileBrowse() {
28
+ jQuery("#txtFileName").val("");
29
+ ngg_swf_upload.cancelUpload();
30
+ ngg_swf_upload.selectFiles();
31
+ }
32
+
33
+ // called when a file is added
34
+ function fileQueued(fileObj) {
35
+ filesize = " (" + Math.round(fileObj.size/1024) + " kB) ";
36
+ jQuery("#txtFileName").val(fileObj.name);
37
+ jQuery("#uploadQueue")
38
+ .append("<div id='" + fileObj.id + "' class='nggUploadItem'> [<a href='javascript:removeFile(\"" + fileObj.id + "\");'>" + ngg_swf_upload.customSettings.remove + "</a>] " + fileObj.name + filesize + "</div>")
39
+ .children("div:last").slideDown("slow")
40
+ .end();
41
+ }
42
+
43
+ // start the upload
44
+ function submitFiles() {
45
+ // check if a gallery is selected
46
+ if (jQuery('#galleryselect').val() > "0") {
47
+ nggProgressBar.init(nggAjaxOptions);
48
+ // get old post_params
49
+ post_params = ngg_swf_upload.getSetting("post_params");
50
+ // update the selected gallery in the post_params
51
+ post_params['galleryselect'] = jQuery('#galleryselect').val();
52
+ ngg_swf_upload.setPostParams(post_params);
53
+ ngg_swf_upload.startUpload();
54
+ } else {
55
+ jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"-1\">");
56
+ jQuery("#uploadimage_form").submit();
57
+ }
58
+ }
59
+
60
+ // called when a file will be removed
61
+ function removeFile(fileID) {
62
+ ngg_swf_upload.cancelUpload(fileID);
63
+ jQuery("#" + fileID).hide("slow");
64
+ jQuery("#" + fileID).remove();
65
+ }
66
+
67
+ // called before the uploads start
68
+ function uploadStart(fileObj) {
69
+ nggProgressBar.init(nggAjaxOptions);
70
+ return true;
71
+ }
72
+
73
+ // called during the upload progress
74
+ function uploadProgress(fileObj, bytesLoaded) {
75
+ var percent = Math.ceil((bytesLoaded / fileObj.size) * 100);
76
+ nggProgressBar.increase( percent );
77
+ jQuery("#progressbar span").text(percent + "% - " + fileObj.name);
78
+ }
79
+
80
+ // called when the file is uploaded
81
+ function uploadComplete(fileObj) {
82
+ jQuery("#" + fileObj.id).hide("slow");
83
+ jQuery("#" + fileObj.id).remove();
84
+ if ( ngg_swf_upload.getStats().files_queued == 0) {
85
+ nggProgressBar.finished();
86
+ jQuery("#uploadimage_form").submit();
87
+ }
88
+ }
89
+
90
+ // called when all files are uploaded
91
+ function uploadSuccess(fileObj, server_data) {
92
+ // Show any error message
93
+ if (server_data != 0){
94
+ nggProgressBar.addNote("<strong>ERROR</strong>: " + fileObj.name + " : " + server_data);
95
+ }
96
+ // Upload the next file until queue is empty
97
+ if ( ngg_swf_upload.getStats().files_queued > 0) {
98
+ ngg_swf_upload.startUpload();
99
+ } else {
100
+ // server_data could be add as hidden field
101
+ jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + server_data + "\">");
102
+ }
103
+ }
104
+
105
+ // called on error
106
+ function uploadError(fileObj, error_code, message) {
107
+ var error_name = "";
108
+ switch(error_code) {
109
+ case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
110
+ error_name = "HTTP ERROR";
111
+ break;
112
+ case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
113
+ error_name = "MISSING UPLOAD URL";
114
+ break;
115
+ case SWFUpload.UPLOAD_ERROR.IO_ERROR:
116
+ error_name = "IO FAILURE";
117
+ break;
118
+ case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
119
+ error_name = "SECURITY ERROR";
120
+ break;
121
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
122
+ error_name = "UPLOAD LIMIT EXCEEDED";
123
+ break;
124
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
125
+ error_name = "UPLOAD FAILED";
126
+ break;
127
+ case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
128
+ error_name = "SPECIFIED FILE ID NOT FOUND";
129
+ break;
130
+ case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
131
+ error_name = "FILE VALIDATION FAILED";
132
+ break;
133
+ case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
134
+ error_name = "FILE CANCELLED";
135
+ return;
136
+ break;
137
+ case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
138
+ error_name = "FILE STOPPED";
139
+ break;
140
+ default:
141
+ error_name = "UNKNOWN";
142
+ break;
143
+ }
144
+ nggProgressBar.addNote("<strong>ERROR " + error_name + " </strong>: " + fileObj.name + " : " + message);
145
+ jQuery("#" + fileObj.id).hide("slow");
146
+ jQuery("#" + fileObj.id).remove();
147
+ if ( ngg_swf_upload.getStats().files_queued > 0) {
148
+ ngg_swf_upload.startUpload();
149
+ } else {
150
+ jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + error_name + "\">");
151
+ jQuery("#uploadimage_form").submit();
152
+ }
153
+ }
admin/manage-galleries.php CHANGED
@@ -1,426 +1,427 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
-
5
- // *** show main gallery list
6
- function nggallery_manage_gallery_main() {
7
-
8
- global $ngg, $nggdb, $wp_query;
9
-
10
- //Build the pagination for more than 25 galleries
11
- $_GET['paged'] = isset($_GET['paged']) && ($_GET['paged'] > 0) ? absint($_GET['paged']) : 1;
12
-
13
- $items_per_page = 25;
14
-
15
- $start = ( $_GET['paged'] - 1 ) * $items_per_page;
16
-
17
- $order = ( isset ( $_GET['order'] ) && $_GET['order'] == 'desc' ) ? 'DESC' : 'ASC';
18
- $orderby = ( isset ( $_GET['orderby'] ) && ( in_array( $_GET['orderby'], array('gid', 'title', 'author') )) ) ? $_GET['orderby'] : 'gid';
19
-
20
- $gallerylist = $nggdb->find_all_galleries( $orderby, $order , TRUE, $items_per_page, $start, false);
21
- $wp_list_table = new _NGG_Galleries_List_Table('nggallery-manage-gallery');
22
-
23
- ?>
24
- <script type="text/javascript">
25
- <!--
26
- function checkAll(form)
27
- {
28
- for (i = 0, n = form.elements.length; i < n; i++) {
29
- if(form.elements[i].type == "checkbox") {
30
- if(form.elements[i].name == "doaction[]") {
31
- if(form.elements[i].checked == true)
32
- form.elements[i].checked = false;
33
- else
34
- form.elements[i].checked = true;
35
- }
36
- }
37
- }
38
- }
39
-
40
- function getNumChecked(form)
41
- {
42
- var num = 0;
43
- for (i = 0, n = form.elements.length; i < n; i++) {
44
- if(form.elements[i].type == "checkbox") {
45
- if(form.elements[i].name == "doaction[]")
46
- if(form.elements[i].checked == true)
47
- num++;
48
- }
49
- }
50
- return num;
51
- }
52
-
53
- // this function check for a the number of selected images, sumbmit false when no one selected
54
- function checkSelected() {
55
-
56
- if (typeof document.activeElement == "undefined" && document.addEventListener) {
57
- document.addEventListener("focus", function (e) {
58
- document.activeElement = e.target;
59
- }, true);
60
- }
61
-
62
- if ( document.activeElement.name == 'post_paged' )
63
- return true;
64
-
65
- var numchecked = getNumChecked(document.getElementById('editgalleries'));
66
-
67
- if(numchecked < 1) {
68
- alert('<?php echo esc_js(__('No images selected', 'nggallery')); ?>');
69
- return false;
70
- }
71
-
72
- actionId = jQuery('#bulkaction').val();
73
-
74
- switch (actionId) {
75
- case "resize_images":
76
- showDialog('resize_images', '<?php echo esc_js(__('Resize images','nggallery')); ?>');
77
- return false;
78
- break;
79
- case "new_thumbnail":
80
- showDialog('new_thumbnail', '<?php echo esc_js(__('Create new thumbnails','nggallery')); ?>');
81
- return false;
82
- break;
83
- }
84
-
85
- return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.",'nggallery')), "' + numchecked + '") ; ?>');
86
- }
87
-
88
- function showDialog( windowId, title ) {
89
- var form = document.getElementById('editgalleries');
90
- var elementlist = "";
91
- for (i = 0, n = form.elements.length; i < n; i++) {
92
- if(form.elements[i].type == "checkbox") {
93
- if(form.elements[i].name == "doaction[]")
94
- if(form.elements[i].checked == true)
95
- if (elementlist == "")
96
- elementlist = form.elements[i].value
97
- else
98
- elementlist += "," + form.elements[i].value ;
99
- }
100
- }
101
- jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
102
- jQuery("#" + windowId + "_imagelist").val(elementlist);
103
- // now show the dialog
104
- jQuery( "#" + windowId ).dialog({
105
- width: 640,
106
- resizable : false,
107
- modal: true,
108
- title: title
109
- });
110
- jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
111
- }
112
-
113
- function showAddGallery() {
114
- jQuery( "#addGallery").dialog({
115
- width: 640,
116
- resizable : false,
117
- modal: true,
118
- title: '<?php echo esc_js(__('Add new gallery','nggallery')); ?>'
119
- });
120
- jQuery("#addGallery .dialog-cancel").click(function() { jQuery( "#addGallery" ).dialog("close"); });
121
- }
122
- //-->
123
- </script>
124
- <div class="wrap">
125
- <?php screen_icon( 'nextgen-gallery' ); ?>
126
- <h2><?php echo _n( 'Gallery', 'Galleries', 2, 'nggallery'); ?></h2>
127
- <form class="search-form" action="" method="get">
128
- <p class="search-box">
129
- <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'nggallery' ); ?>:</label>
130
- <input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
131
- <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
132
- <input type="submit" value="<?php _e( 'Search Images', 'nggallery' ); ?>" class="button" />
133
- </p>
134
- </form>
135
- <form id="editgalleries" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;paged=' . $_GET['paged']; ?>" accept-charset="utf-8">
136
- <?php wp_nonce_field('ngg_bulkgallery') ?>
137
- <input type="hidden" name="page" value="manage-galleries" />
138
-
139
- <div class="tablenav top">
140
-
141
- <div class="alignleft actions">
142
- <?php if ( function_exists('json_encode') ) : ?>
143
- <select name="bulkaction" id="bulkaction">
144
- <option value="no_action" ><?php _e("Bulk actions",'nggallery'); ?></option>
145
- <option value="delete_gallery" ><?php _e("Delete",'nggallery'); ?></option>
146
- <option value="set_watermark" ><?php _e("Set watermark",'nggallery'); ?></option>
147
- <option value="new_thumbnail" ><?php _e("Create new thumbnails",'nggallery'); ?></option>
148
- <option value="resize_images" ><?php _e("Resize images",'nggallery'); ?></option>
149
- <option value="import_meta" ><?php _e("Import metadata",'nggallery'); ?></option>
150
- <option value="recover_images" ><?php _e("Recover from backup",'nggallery'); ?></option>
151
- </select>
152
- <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','nggallery'); ?>" onclick="if ( !checkSelected() ) return false;" />
153
- <?php endif; ?>
154
- <?php if ( current_user_can('NextGEN Upload images') && nggGallery::current_user_can( 'NextGEN Add new gallery' ) ) : ?>
155
- <input name="doaction" class="button-secondary action" type="submit" onclick="showAddGallery(); return false;" value="<?php _e('Add new gallery', 'nggallery') ?>"/>
156
- <?php endif; ?>
157
- </div>
158
-
159
-
160
- <?php $ngg->manage_page->pagination( 'top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
161
-
162
- </div>
163
- <table class="wp-list-table widefat fixed" cellspacing="0">
164
- <thead>
165
- <tr>
166
- <?php $wp_list_table->print_column_headers(true); ?>
167
- </tr>
168
- </thead>
169
- <tfoot>
170
- <tr>
171
- <?php $wp_list_table->print_column_headers(false); ?>
172
- </tr>
173
- </tfoot>
174
- <tbody id="the-list">
175
- <?php
176
-
177
- if($gallerylist) {
178
- //get the columns
179
- $gallery_columns = $wp_list_table->get_columns();
180
- $hidden_columns = get_hidden_columns('nggallery-manage-gallery');
181
- $num_columns = count($gallery_columns) - count($hidden_columns);
182
-
183
- foreach($gallerylist as $gallery) {
184
- $alternate = ( !isset($alternate) || $alternate == 'class="alternate"' ) ? '' : 'class="alternate"';
185
- $gid = $gallery->gid;
186
- $name = (empty($gallery->title) ) ? $gallery->name : $gallery->title;
187
- $author_user = get_userdata( (int) $gallery->author );
188
- ?>
189
- <tr id="gallery-<?php echo $gid ?>" <?php echo $alternate; ?> >
190
- <?php
191
- foreach($gallery_columns as $gallery_column_key => $column_display_name) {
192
- $class = "class=\"$gallery_column_key column-$gallery_column_key\"";
193
-
194
- $style = '';
195
- if ( in_array($gallery_column_key, $hidden_columns) )
196
- $style = ' style="display:none;"';
197
-
198
- $attributes = "$class$style";
199
-
200
- switch ($gallery_column_key) {
201
- case 'cb' :
202
- ?>
203
- <th scope="row" class="column-cb check-column">
204
- <?php if (nggAdmin::can_manage_this_gallery($gallery->author)) { ?>
205
- <input name="doaction[]" type="checkbox" value="<?php echo $gid ?>" />
206
- <?php } ?>
207
- </th>
208
- <?php
209
- break;
210
- case 'id' :
211
- ?>
212
- <td <?php echo $attributes ?>><?php echo $gid; ?></td>
213
- <?php
214
- break;
215
- case 'title' :
216
- ?>
217
- <td class="title column-title">
218
- <?php if (nggAdmin::can_manage_this_gallery($gallery->author)) { ?>
219
- <a href="<?php echo wp_nonce_url( $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $gid, 'ngg_editgallery')?>" class='edit' title="<?php _e('Edit'); ?>" >
220
- <?php echo esc_html( nggGallery::i18n($name) ); ?>
221
- </a>
222
- <?php } else { ?>
223
- <?php echo esc_html( nggGallery::i18n($gallery->title) ); ?>
224
- <?php } ?>
225
- <div class="row-actions"></div>
226
- </td>
227
- <?php
228
- break;
229
- case 'description' :
230
- ?>
231
- <td <?php echo $attributes ?>><?php echo esc_html( nggGallery::i18n($gallery->galdesc) ); ?>&nbsp;</td>
232
- <?php
233
- break;
234
- case 'author' :
235
- ?>
236
- <td <?php echo $attributes ?>><?php echo esc_html( $author_user->display_name ); ?></td>
237
- <?php
238
- break;
239
- case 'page_id' :
240
- ?>
241
- <td <?php echo $attributes ?>><?php echo $gallery->pageid; ?></td>
242
- <?php
243
- break;
244
- case 'quantity' :
245
- ?>
246
- <td <?php echo $attributes ?>><?php echo $gallery->counter; ?></td>
247
- <?php
248
- break;
249
- default :
250
- ?>
251
- <td <?php echo $attributes ?>><?php do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $gid); ?></td>
252
- <?php
253
- break;
254
- }
255
- } ?>
256
- </tr>
257
- <?php
258
- }
259
- } else {
260
- echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
261
- }
262
- ?>
263
- </tbody>
264
- </table>
265
- <div class="tablenav bottom">
266
- <?php $ngg->manage_page->pagination( 'bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
267
- </div>
268
- </form>
269
- </div>
270
- <!-- #addGallery -->
271
- <div id="addGallery" style="display: none;" >
272
- <form id="form-tags" method="POST" accept-charset="utf-8">
273
- <?php wp_nonce_field('ngg_addgallery'); ?>
274
- <input type="hidden" name="page" value="manage-galleries" />
275
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
276
- <tr>
277
- <td>
278
- <strong><?php _e('New Gallery', 'nggallery') ;?>:</strong> <input type="text" size="35" name="galleryname" value="" /><br />
279
- <?php if(!is_multisite()) { ?>
280
- <?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $ngg->options['gallerypath']; ?></strong><br />
281
- <?php } ?>
282
- <i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i>
283
- </td>
284
- </tr>
285
- <?php do_action('ngg_add_new_gallery_form'); ?>
286
- <tr align="right">
287
- <td class="submit">
288
- <input class="button-primary" type="submit" name="addgallery" value="<?php _e('OK','nggallery'); ?>" />
289
- &nbsp;
290
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
291
- </td>
292
- </tr>
293
- </table>
294
- </form>
295
- </div>
296
- <!-- /#addGallery -->
297
-
298
- <!-- #resize_images -->
299
- <div id="resize_images" style="display: none;" >
300
- <form id="form-resize-images" method="POST" accept-charset="utf-8">
301
- <?php wp_nonce_field('ngg_thickbox_form') ?>
302
- <input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
303
- <input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
304
- <input type="hidden" name="page" value="manage-galleries" />
305
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
306
- <tr valign="top">
307
- <td>
308
- <strong><?php _e('Resize Images to', 'nggallery'); ?>:</strong>
309
- </td>
310
- <td>
311
- <input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
312
- <br /><small><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></small>
313
- </td>
314
- </tr>
315
- <tr align="right">
316
- <td colspan="2" class="submit">
317
- <input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php _e('OK', 'nggallery'); ?>" />
318
- &nbsp;
319
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
320
- </td>
321
- </tr>
322
- </table>
323
- </form>
324
- </div>
325
- <!-- /#resize_images -->
326
-
327
- <!-- #new_thumbnail -->
328
- <div id="new_thumbnail" style="display: none;" >
329
- <form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
330
- <?php wp_nonce_field('ngg_thickbox_form') ?>
331
- <input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
332
- <input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
333
- <input type="hidden" name="page" value="manage-galleries" />
334
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
335
- <tr valign="top">
336
- <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
337
- <td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
338
- <br /><small><?php _e('These values are maximum values ','nggallery') ?></small></td>
339
- </tr>
340
- <tr valign="top">
341
- <th align="left"><?php _e('Set fix dimension','nggallery') ?></th>
342
- <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
343
- <br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
344
- </tr>
345
- <tr align="right">
346
- <td colspan="2" class="submit">
347
- <input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
348
- &nbsp;
349
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
350
- </td>
351
- </tr>
352
- </table>
353
- </form>
354
- </div>
355
- <!-- /#new_thumbnail -->
356
-
357
- <?php
358
- }
359
-
360
- /**
361
- * Construtor class to create the table layout
362
- *
363
- * @package WordPress
364
- * @subpackage List_Table
365
- * @since 1.8.0
366
- * @access private
367
- */
368
- class _NGG_Galleries_List_Table extends WP_List_Table {
369
- var $_screen;
370
- var $_columns;
371
-
372
- function _NGG_Galleries_List_Table( $screen ) {
373
- if ( is_string( $screen ) )
374
- $screen = convert_to_screen( $screen );
375
-
376
- $this->_screen = $screen;
377
- $this->_columns = array() ;
378
-
379
- add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
380
- }
381
-
382
- function get_column_info() {
383
- $columns = get_column_headers( $this->_screen );
384
- $hidden = get_hidden_columns( $this->_screen );
385
- $_sortable = $this->get_sortable_columns();
386
-
387
- foreach ( $_sortable as $id => $data ) {
388
- if ( empty( $data ) )
389
- continue;
390
-
391
- $data = (array) $data;
392
- if ( !isset( $data[1] ) )
393
- $data[1] = false;
394
-
395
- $sortable[$id] = $data;
396
- }
397
-
398
- return array( $columns, $hidden, $sortable );
399
- }
400
-
401
- // define the columns to display, the syntax is 'internal name' => 'display name'
402
- function get_columns() {
403
- $columns = array();
404
-
405
- $columns['cb'] = '<input name="checkall" type="checkbox" onclick="checkAll(document.getElementById(\'editgalleries\'));" />';
406
- $columns['id'] = __('ID');
407
- $columns['title'] = _n( 'Gallery', 'Galleries', 1, 'nggallery');
408
- $columns['description'] = __('Description', 'nggallery');
409
- $columns['author'] = __('Author', 'nggallery');
410
- $columns['page_id'] = __('Page ID', 'nggallery');
411
- $columns['quantity'] = _n( 'Image', 'Images', 2, 'nggallery' );
412
-
413
- $columns = apply_filters('ngg_manage_gallery_columns', $columns);
414
-
415
- return $columns;
416
- }
417
-
418
- function get_sortable_columns() {
419
- return array(
420
- 'id' => array( 'gid', true ),
421
- 'title' => 'title',
422
- 'author' => 'author'
423
- );
424
- }
425
- }
 
426
  ?>
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ // *** show main gallery list
6
+ function nggallery_manage_gallery_main() {
7
+
8
+ global $ngg, $nggdb, $wp_query;
9
+
10
+ //Build the pagination for more than 25 galleries
11
+ $_GET['paged'] = isset($_GET['paged']) && ($_GET['paged'] > 0) ? absint($_GET['paged']) : 1;
12
+
13
+ $items_per_page = 25;
14
+
15
+ $start = ( $_GET['paged'] - 1 ) * $items_per_page;
16
+
17
+ $order = ( isset ( $_GET['order'] ) && $_GET['order'] == 'desc' ) ? 'DESC' : 'ASC';
18
+ $orderby = ( isset ( $_GET['orderby'] ) && ( in_array( $_GET['orderby'], array('gid', 'title', 'author') )) ) ? $_GET['orderby'] : 'gid';
19
+
20
+ $gallerylist = $nggdb->find_all_galleries( $orderby, $order , TRUE, $items_per_page, $start, false);
21
+ $wp_list_table = new _NGG_Galleries_List_Table('nggallery-manage-gallery');
22
+
23
+ ?>
24
+ <script type="text/javascript">
25
+ <!--
26
+ function checkAll(form)
27
+ {
28
+ for (i = 0, n = form.elements.length; i < n; i++) {
29
+ if(form.elements[i].type == "checkbox") {
30
+ if(form.elements[i].name == "doaction[]") {
31
+ if(form.elements[i].checked == true)
32
+ form.elements[i].checked = false;
33
+ else
34
+ form.elements[i].checked = true;
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ function getNumChecked(form)
41
+ {
42
+ var num = 0;
43
+ for (i = 0, n = form.elements.length; i < n; i++) {
44
+ if(form.elements[i].type == "checkbox") {
45
+ if(form.elements[i].name == "doaction[]")
46
+ if(form.elements[i].checked == true)
47
+ num++;
48
+ }
49
+ }
50
+ return num;
51
+ }
52
+
53
+ // this function check for a the number of selected images, sumbmit false when no one selected
54
+ function checkSelected() {
55
+
56
+ if (typeof document.activeElement == "undefined" && document.addEventListener) {
57
+ document.addEventListener("focus", function (e) {
58
+ document.activeElement = e.target;
59
+ }, true);
60
+ }
61
+
62
+ if ( document.activeElement.name == 'post_paged' )
63
+ return true;
64
+
65
+ var numchecked = getNumChecked(document.getElementById('editgalleries'));
66
+
67
+ if(numchecked < 1) {
68
+ alert('<?php echo esc_js(__('No images selected', 'nggallery')); ?>');
69
+ return false;
70
+ }
71
+
72
+ actionId = jQuery('#bulkaction').val();
73
+
74
+ switch (actionId) {
75
+ case "resize_images":
76
+ showDialog('resize_images', '<?php echo esc_js(__('Resize images','nggallery')); ?>');
77
+ return false;
78
+ break;
79
+ case "new_thumbnail":
80
+ showDialog('new_thumbnail', '<?php echo esc_js(__('Create new thumbnails','nggallery')); ?>');
81
+ return false;
82
+ break;
83
+ }
84
+
85
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.",'nggallery')), "' + numchecked + '") ; ?>');
86
+ }
87
+
88
+ function showDialog( windowId, title ) {
89
+ var form = document.getElementById('editgalleries');
90
+ var elementlist = "";
91
+ for (i = 0, n = form.elements.length; i < n; i++) {
92
+ if(form.elements[i].type == "checkbox") {
93
+ if(form.elements[i].name == "doaction[]")
94
+ if(form.elements[i].checked == true)
95
+ if (elementlist == "")
96
+ elementlist = form.elements[i].value
97
+ else
98
+ elementlist += "," + form.elements[i].value ;
99
+ }
100
+ }
101
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
102
+ jQuery("#" + windowId + "_imagelist").val(elementlist);
103
+ // now show the dialog
104
+ jQuery( "#" + windowId ).dialog({
105
+ width: 640,
106
+ resizable : false,
107
+ modal: true,
108
+ title: title
109
+ });
110
+ jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
111
+ }
112
+
113
+ function showAddGallery() {
114
+ jQuery( "#addGallery").dialog({
115
+ width: 640,
116
+ resizable : false,
117
+ modal: true,
118
+ title: '<?php echo esc_js(__('Add new gallery','nggallery')); ?>'
119
+ });
120
+ jQuery("#addGallery .dialog-cancel").click(function() { jQuery( "#addGallery" ).dialog("close"); });
121
+ }
122
+ //-->
123
+ </script>
124
+ <div class="wrap">
125
+ <?php include('templates/social_media_buttons.php'); ?>
126
+ <?php screen_icon( 'nextgen-gallery' ); ?>
127
+ <h2><?php echo _n( 'Gallery', 'Galleries', 2, 'nggallery'); ?></h2>
128
+ <form class="search-form" action="" method="get">
129
+ <p class="search-box">
130
+ <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'nggallery' ); ?>:</label>
131
+ <input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
132
+ <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
133
+ <input type="submit" value="<?php _e( 'Search Images', 'nggallery' ); ?>" class="button" />
134
+ </p>
135
+ </form>
136
+ <form id="editgalleries" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;paged=' . $_GET['paged']; ?>" accept-charset="utf-8">
137
+ <?php wp_nonce_field('ngg_bulkgallery') ?>
138
+ <input type="hidden" name="page" value="manage-galleries" />
139
+
140
+ <div class="tablenav top">
141
+
142
+ <div class="alignleft actions">
143
+ <?php if ( function_exists('json_encode') ) : ?>
144
+ <select name="bulkaction" id="bulkaction">
145
+ <option value="no_action" ><?php _e("Bulk actions",'nggallery'); ?></option>
146
+ <option value="delete_gallery" ><?php _e("Delete",'nggallery'); ?></option>
147
+ <option value="set_watermark" ><?php _e("Set watermark",'nggallery'); ?></option>
148
+ <option value="new_thumbnail" ><?php _e("Create new thumbnails",'nggallery'); ?></option>
149
+ <option value="resize_images" ><?php _e("Resize images",'nggallery'); ?></option>
150
+ <option value="import_meta" ><?php _e("Import metadata",'nggallery'); ?></option>
151
+ <option value="recover_images" ><?php _e("Recover from backup",'nggallery'); ?></option>
152
+ </select>
153
+ <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','nggallery'); ?>" onclick="if ( !checkSelected() ) return false;" />
154
+ <?php endif; ?>
155
+ <?php if ( current_user_can('NextGEN Upload images') && nggGallery::current_user_can( 'NextGEN Add new gallery' ) ) : ?>
156
+ <input name="doaction" class="button-secondary action" type="submit" onclick="showAddGallery(); return false;" value="<?php _e('Add new gallery', 'nggallery') ?>"/>
157
+ <?php endif; ?>
158
+ </div>
159
+
160
+
161
+ <?php $ngg->manage_page->pagination( 'top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
162
+
163
+ </div>
164
+ <table class="wp-list-table widefat fixed" cellspacing="0">
165
+ <thead>
166
+ <tr>
167
+ <?php $wp_list_table->print_column_headers(true); ?>
168
+ </tr>
169
+ </thead>
170
+ <tfoot>
171
+ <tr>
172
+ <?php $wp_list_table->print_column_headers(false); ?>
173
+ </tr>
174
+ </tfoot>
175
+ <tbody id="the-list">
176
+ <?php
177
+
178
+ if($gallerylist) {
179
+ //get the columns
180
+ $gallery_columns = $wp_list_table->get_columns();
181
+ $hidden_columns = get_hidden_columns('nggallery-manage-gallery');
182
+ $num_columns = count($gallery_columns) - count($hidden_columns);
183
+
184
+ foreach($gallerylist as $gallery) {
185
+ $alternate = ( !isset($alternate) || $alternate == 'class="alternate"' ) ? '' : 'class="alternate"';
186
+ $gid = $gallery->gid;
187
+ $name = (empty($gallery->title) ) ? $gallery->name : $gallery->title;
188
+ $author_user = get_userdata( (int) $gallery->author );
189
+ ?>
190
+ <tr id="gallery-<?php echo $gid ?>" <?php echo $alternate; ?> >
191
+ <?php
192
+ foreach($gallery_columns as $gallery_column_key => $column_display_name) {
193
+ $class = "class=\"$gallery_column_key column-$gallery_column_key\"";
194
+
195
+ $style = '';
196
+ if ( in_array($gallery_column_key, $hidden_columns) )
197
+ $style = ' style="display:none;"';
198
+
199
+ $attributes = "$class$style";
200
+
201
+ switch ($gallery_column_key) {
202
+ case 'cb' :
203
+ ?>
204
+ <th scope="row" class="column-cb check-column">
205
+ <?php if (nggAdmin::can_manage_this_gallery($gallery->author)) { ?>
206
+ <input name="doaction[]" type="checkbox" value="<?php echo $gid ?>" />
207
+ <?php } ?>
208
+ </th>
209
+ <?php
210
+ break;
211
+ case 'id' :
212
+ ?>
213
+ <td <?php echo $attributes ?>><?php echo $gid; ?></td>
214
+ <?php
215
+ break;
216
+ case 'title' :
217
+ ?>
218
+ <td class="title column-title">
219
+ <?php if (nggAdmin::can_manage_this_gallery($gallery->author)) { ?>
220
+ <a href="<?php echo wp_nonce_url( $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $gid, 'ngg_editgallery')?>" class='edit' title="<?php _e('Edit'); ?>" >
221
+ <?php echo esc_html( nggGallery::i18n($name) ); ?>
222
+ </a>
223
+ <?php } else { ?>
224
+ <?php echo esc_html( nggGallery::i18n($gallery->title) ); ?>
225
+ <?php } ?>
226
+ <div class="row-actions"></div>
227
+ </td>
228
+ <?php
229
+ break;
230
+ case 'description' :
231
+ ?>
232
+ <td <?php echo $attributes ?>><?php echo esc_html( nggGallery::i18n($gallery->galdesc) ); ?>&nbsp;</td>
233
+ <?php
234
+ break;
235
+ case 'author' :
236
+ ?>
237
+ <td <?php echo $attributes ?>><?php echo esc_html( $author_user->display_name ); ?></td>
238
+ <?php
239
+ break;
240
+ case 'page_id' :
241
+ ?>
242
+ <td <?php echo $attributes ?>><?php echo $gallery->pageid; ?></td>
243
+ <?php
244
+ break;
245
+ case 'quantity' :
246
+ ?>
247
+ <td <?php echo $attributes ?>><?php echo $gallery->counter; ?></td>
248
+ <?php
249
+ break;
250
+ default :
251
+ ?>
252
+ <td <?php echo $attributes ?>><?php do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $gid); ?></td>
253
+ <?php
254
+ break;
255
+ }
256
+ } ?>
257
+ </tr>
258
+ <?php
259
+ }
260
+ } else {
261
+ echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
262
+ }
263
+ ?>
264
+ </tbody>
265
+ </table>
266
+ <div class="tablenav bottom">
267
+ <?php $ngg->manage_page->pagination( 'bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
268
+ </div>
269
+ </form>
270
+ </div>
271
+ <!-- #addGallery -->
272
+ <div id="addGallery" style="display: none;" >
273
+ <form id="form-tags" method="POST" accept-charset="utf-8">
274
+ <?php wp_nonce_field('ngg_addgallery'); ?>
275
+ <input type="hidden" name="page" value="manage-galleries" />
276
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
277
+ <tr>
278
+ <td>
279
+ <strong><?php _e('New Gallery', 'nggallery') ;?>:</strong> <input type="text" size="35" name="galleryname" value="" /><br />
280
+ <?php if(!is_multisite()) { ?>
281
+ <?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $ngg->options['gallerypath']; ?></strong><br />
282
+ <?php } ?>
283
+ <i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i>
284
+ </td>
285
+ </tr>
286
+ <?php do_action('ngg_add_new_gallery_form'); ?>
287
+ <tr align="right">
288
+ <td class="submit">
289
+ <input class="button-primary" type="submit" name="addgallery" value="<?php _e('OK','nggallery'); ?>" />
290
+ &nbsp;
291
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
292
+ </td>
293
+ </tr>
294
+ </table>
295
+ </form>
296
+ </div>
297
+ <!-- /#addGallery -->
298
+
299
+ <!-- #resize_images -->
300
+ <div id="resize_images" style="display: none;" >
301
+ <form id="form-resize-images" method="POST" accept-charset="utf-8">
302
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
303
+ <input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
304
+ <input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
305
+ <input type="hidden" name="page" value="manage-galleries" />
306
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
307
+ <tr valign="top">
308
+ <td>
309
+ <strong><?php _e('Resize Images to', 'nggallery'); ?>:</strong>
310
+ </td>
311
+ <td>
312
+ <input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
313
+ <br /><small><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></small>
314
+ </td>
315
+ </tr>
316
+ <tr align="right">
317
+ <td colspan="2" class="submit">
318
+ <input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php _e('OK', 'nggallery'); ?>" />
319
+ &nbsp;
320
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
321
+ </td>
322
+ </tr>
323
+ </table>
324
+ </form>
325
+ </div>
326
+ <!-- /#resize_images -->
327
+
328
+ <!-- #new_thumbnail -->
329
+ <div id="new_thumbnail" style="display: none;" >
330
+ <form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
331
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
332
+ <input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
333
+ <input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
334
+ <input type="hidden" name="page" value="manage-galleries" />
335
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
336
+ <tr valign="top">
337
+ <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
338
+ <td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
339
+ <br /><small><?php _e('These values are maximum values ','nggallery') ?></small></td>
340
+ </tr>
341
+ <tr valign="top">
342
+ <th align="left"><?php _e('Set fix dimension','nggallery') ?></th>
343
+ <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
344
+ <br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
345
+ </tr>
346
+ <tr align="right">
347
+ <td colspan="2" class="submit">
348
+ <input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
349
+ &nbsp;
350
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
351
+ </td>
352
+ </tr>
353
+ </table>
354
+ </form>
355
+ </div>
356
+ <!-- /#new_thumbnail -->
357
+
358
+ <?php
359
+ }
360
+
361
+ /**
362
+ * Construtor class to create the table layout
363
+ *
364
+ * @package WordPress
365
+ * @subpackage List_Table
366
+ * @since 1.8.0
367
+ * @access private
368
+ */
369
+ class _NGG_Galleries_List_Table extends WP_List_Table {
370
+ var $_screen;
371
+ var $_columns;
372
+
373
+ function _NGG_Galleries_List_Table( $screen ) {
374
+ if ( is_string( $screen ) )
375
+ $screen = convert_to_screen( $screen );
376
+
377
+ $this->_screen = $screen;
378
+ $this->_columns = array() ;
379
+
380
+ add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
381
+ }
382
+
383
+ function get_column_info() {
384
+ $columns = get_column_headers( $this->_screen );
385
+ $hidden = get_hidden_columns( $this->_screen );
386
+ $_sortable = $this->get_sortable_columns();
387
+
388
+ foreach ( $_sortable as $id => $data ) {
389
+ if ( empty( $data ) )
390
+ continue;
391
+
392
+ $data = (array) $data;
393
+ if ( !isset( $data[1] ) )
394
+ $data[1] = false;
395
+
396
+ $sortable[$id] = $data;
397
+ }
398
+
399
+ return array( $columns, $hidden, $sortable );
400
+ }
401
+
402
+ // define the columns to display, the syntax is 'internal name' => 'display name'
403
+ function get_columns() {
404
+ $columns = array();
405
+
406
+ $columns['cb'] = '<input name="checkall" type="checkbox" onclick="checkAll(document.getElementById(\'editgalleries\'));" />';
407
+ $columns['id'] = __('ID');
408
+ $columns['title'] = _n( 'Gallery', 'Galleries', 1, 'nggallery');
409
+ $columns['description'] = __('Description', 'nggallery');
410
+ $columns['author'] = __('Author', 'nggallery');
411
+ $columns['page_id'] = __('Page ID', 'nggallery');
412
+ $columns['quantity'] = _n( 'Image', 'Images', 2, 'nggallery' );
413
+
414
+ $columns = apply_filters('ngg_manage_gallery_columns', $columns);
415
+
416
+ return $columns;
417
+ }
418
+
419
+ function get_sortable_columns() {
420
+ return array(
421
+ 'id' => array( 'gid', true ),
422
+ 'title' => 'title',
423
+ 'author' => 'author'
424
+ );
425
+ }
426
+ }
427
  ?>
admin/manage-images.php CHANGED
@@ -1,710 +1,711 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.');}
4
-
5
- function nggallery_picturelist() {
6
- // *** show picture list
7
- global $wpdb, $nggdb, $user_ID, $ngg;
8
-
9
- // Look if its a search result
10
- $is_search = isset ($_GET['s']) ? true : false;
11
- $counter = 0;
12
-
13
- $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
14
-
15
- if ($is_search) {
16
-
17
- // fetch the imagelist
18
- $picturelist = $ngg->manage_page->search_result;
19
-
20
- // we didn't set a gallery or a pagination
21
- $act_gid = 0;
22
- $_GET['paged'] = 1;
23
- $page_links = false;
24
-
25
- } else {
26
-
27
- // GET variables
28
- $act_gid = $ngg->manage_page->gid;
29
-
30
- // Load the gallery metadata
31
- $gallery = $nggdb->find_gallery($act_gid);
32
-
33
- if (!$gallery) {
34
- nggGallery::show_error(__('Gallery not found.', 'nggallery'));
35
- return;
36
- }
37
-
38
- // Check if you have the correct capability
39
- if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
40
- nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
41
- return;
42
- }
43
-
44
- // look for pagination
45
- $_GET['paged'] = isset($_GET['paged']) && ($_GET['paged'] > 0) ? absint($_GET['paged']) : 1;
46
-
47
- $start = ( $_GET['paged'] - 1 ) * 50;
48
-
49
- // get picture values
50
- $picturelist = $nggdb->get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false, 50, $start );
51
-
52
- // get the current author
53
- $act_author_user = get_userdata( (int) $gallery->author );
54
-
55
- }
56
-
57
- // list all galleries
58
- $gallerylist = $nggdb->find_all_galleries();
59
-
60
- //get the columns
61
- $image_columns = $wp_list_table->get_columns();
62
- $hidden_columns = get_hidden_columns('nggallery-manage-images');
63
- $num_columns = count($image_columns) - count($hidden_columns);
64
-
65
- $attr = (nggGallery::current_user_can( 'NextGEN Edit gallery options' )) ? '' : 'disabled="disabled"';
66
-
67
- ?>
68
- <script type="text/javascript">
69
- <!--
70
- function showDialog( windowId, title ) {
71
- var form = document.getElementById('updategallery');
72
- var elementlist = "";
73
- for (i = 0, n = form.elements.length; i < n; i++) {
74
- if(form.elements[i].type == "checkbox") {
75
- if(form.elements[i].name == "doaction[]")
76
- if(form.elements[i].checked == true)
77
- if (elementlist == "")
78
- elementlist = form.elements[i].value
79
- else
80
- elementlist += "," + form.elements[i].value ;
81
- }
82
- }
83
- jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
84
- jQuery("#" + windowId + "_imagelist").val(elementlist);
85
- // now show the dialog
86
- jQuery( "#" + windowId ).dialog({
87
- width: 640,
88
- resizable : false,
89
- modal: true,
90
- title: title
91
- });
92
- jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
93
- }
94
-
95
- jQuery(function (){
96
- // load a content via ajax
97
- jQuery('a.ngg-dialog').click(function() {
98
- if ( jQuery( "#spinner" ).length == 0)
99
- jQuery("body").append('<div id="spinner"></div>');
100
- var $this = jQuery(this);
101
- var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
102
- var width = ( results ) ? results[1] : 600;
103
- var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
104
- var height = ( results ) ? results[1] : 440;
105
- jQuery('#spinner').fadeIn();
106
- var dialog = jQuery('<div style="display:hidden"></div>').appendTo('body');
107
- // load the remote content
108
- dialog.load(
109
- this.href,
110
- {},
111
- function () {
112
- jQuery('#spinner').hide();
113
- dialog.dialog({
114
- title: ($this.attr('title')) ? $this.attr('title') : '',
115
- width: width,
116
- height: height,
117
- modal: true,
118
- resizable: false,
119
- close: function() { dialog.remove(); }
120
- }).width(width - 30).height(height - 30);
121
- }
122
- );
123
- //prevent the browser to follow the link
124
- return false;
125
- });
126
- });
127
-
128
- function checkAll(form)
129
- {
130
- for (i = 0, n = form.elements.length; i < n; i++) {
131
- if(form.elements[i].type == "checkbox") {
132
- if(form.elements[i].name == "doaction[]") {
133
- if(form.elements[i].checked == true)
134
- form.elements[i].checked = false;
135
- else
136
- form.elements[i].checked = true;
137
- }
138
- }
139
- }
140
- }
141
-
142
- function getNumChecked(form)
143
- {
144
- var num = 0;
145
- for (i = 0, n = form.elements.length; i < n; i++) {
146
- if(form.elements[i].type == "checkbox") {
147
- if(form.elements[i].name == "doaction[]")
148
- if(form.elements[i].checked == true)
149
- num++;
150
- }
151
- }
152
- return num;
153
- }
154
-
155
- // this function check for a the number of selected images, sumbmit false when no one selected
156
- function checkSelected() {
157
-
158
- var numchecked = getNumChecked(document.getElementById('updategallery'));
159
-
160
- if (typeof document.activeElement == "undefined" && document.addEventListener) {
161
- document.addEventListener("focus", function (e) {
162
- document.activeElement = e.target;
163
- }, true);
164
- }
165
-
166
- if ( document.activeElement.name == 'post_paged' )
167
- return true;
168
-
169
- if(numchecked < 1) {
170
- alert('<?php echo esc_js(__('No images selected', 'nggallery')); ?>');
171
- return false;
172
- }
173
-
174
- actionId = jQuery('#bulkaction').val();
175
-
176
- switch (actionId) {
177
- case "copy_to":
178
- showDialog('selectgallery', '<?php echo esc_js(__('Copy image to...','nggallery')); ?>');
179
- return false;
180
- break;
181
- case "move_to":
182
- showDialog('selectgallery', '<?php echo esc_js(__('Move image to...','nggallery')); ?>');
183
- return false;
184
- break;
185
- case "add_tags":
186
- showDialog('entertags', '<?php echo esc_js(__('Add new tags','nggallery')); ?>');
187
- return false;
188
- break;
189
- case "delete_tags":
190
- showDialog('entertags', '<?php echo esc_js(__('Delete tags','nggallery')); ?>');
191
- return false;
192
- break;
193
- case "overwrite_tags":
194
- showDialog('entertags', '<?php echo esc_js(__('Overwrite','nggallery')); ?>');
195
- return false;
196
- break;
197
- case "resize_images":
198
- showDialog('resize_images', '<?php echo esc_js(__('Resize images','nggallery')); ?>');
199
- return false;
200
- break;
201
- case "new_thumbnail":
202
- showDialog('new_thumbnail', '<?php echo esc_js(__('Create new thumbnails','nggallery')); ?>');
203
- return false;
204
- break;
205
- }
206
-
207
- return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.",'nggallery')), "' + numchecked + '") ; ?>');
208
- }
209
-
210
- jQuery(document).ready( function() {
211
- // close postboxes that should be closed
212
- jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
213
- postboxes.add_postbox_toggles('ngg-manage-gallery');
214
- });
215
-
216
- //-->
217
- </script>
218
- <div class="wrap">
219
- <?php screen_icon( 'nextgen-gallery' ); ?>
220
- <?php if ($is_search) :?>
221
- <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html( get_search_query() ) ); ?></h2>
222
- <form class="search-form" action="" method="get">
223
- <p class="search-box">
224
- <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'nggallery' ); ?>:</label>
225
- <input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
226
- <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
227
- <input type="submit" value="<?php _e( 'Search Images', 'nggallery' ); ?>" class="button" />
228
- </p>
229
- </form>
230
-
231
- <br style="clear: both;" />
232
-
233
- <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query(); ?>" accept-charset="utf-8">
234
- <?php wp_nonce_field('ngg_updategallery') ?>
235
- <input type="hidden" name="page" value="manage-images" />
236
-
237
- <?php else :?>
238
- <h2><?php echo _n( 'Gallery', 'Galleries', 1, 'nggallery' ); ?> : <?php echo esc_html ( nggGallery::i18n($gallery->title) ); ?></h2>
239
-
240
- <br style="clear: both;" />
241
-
242
- <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . $_GET['paged']; ?>" accept-charset="utf-8">
243
- <?php wp_nonce_field('ngg_updategallery') ?>
244
- <input type="hidden" name="page" value="manage-images" />
245
-
246
- <?php if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' )) : ?>
247
- <div id="poststuff">
248
- <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
249
- <div id="gallerydiv" class="postbox <?php echo postbox_classes('gallerydiv', 'ngg-manage-gallery'); ?>" >
250
- <h3><?php _e('Gallery settings', 'nggallery') ?><small> (<?php _e('Click here for more settings', 'nggallery') ?>)</small></h3>
251
- <div class="inside">
252
- <table class="form-table" >
253
- <tr>
254
- <th align="left"><?php _e('Title') ?>:</th>
255
- <th align="left"><input <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery title' ); ?> type="text" size="50" name="title" value="<?php echo $gallery->title; ?>" /></th>
256
- <th align="right"><?php _e('Page Link to', 'nggallery') ?>:</th>
257
- <th align="left">
258
- <select <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery page id' ); ?> name="pageid" style="width:95%">
259
- <option value="0" ><?php _e('Not linked', 'nggallery') ?></option>
260
- <?php parent_dropdown($gallery->pageid); ?>
261
- </select>
262
- </th>
263
- </tr>
264
- <tr>
265
- <th align="left"><?php _e('Description') ?>:</th>
266
- <th align="left"><textarea <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery description' ); ?> name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo $gallery->galdesc; ?></textarea></th>
267
- <th align="right"><?php _e('Preview image', 'nggallery') ?>:</th>
268
- <th align="left">
269
- <select <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery preview pic' ); ?> name="previewpic" style="width:95%" >
270
- <option value="0" ><?php _e('No Picture', 'nggallery') ?></option>
271
- <?php
272
- // ensure that a preview pic from a other page is still shown here
273
- if ( intval($gallery->previewpic) != 0) {
274
- if ( !array_key_exists ($gallery->previewpic, $picturelist )){
275
- $previewpic = $nggdb->find_image($gallery->previewpic);
276
- if ($previewpic)
277
- echo '<option value="'.$previewpic->pid.'" selected="selected" >'.$previewpic->pid.' - ' . esc_attr( $previewpic->filename ) . '</option>'."\n";
278
- }
279
- }
280
- if(is_array($picturelist)) {
281
- foreach($picturelist as $picture) {
282
- if ($picture->exclude) continue;
283
- $selected = ($picture->pid == $gallery->previewpic) ? 'selected="selected" ' : '';
284
- echo '<option value="'.$picture->pid.'" '.$selected.'>'.$picture->pid.' - ' . esc_attr( $picture->filename ) . '</option>'."\n";
285
- }
286
- }
287
- ?>
288
- </select>
289
- </th>
290
- </tr>
291
- <tr>
292
- <th align="left"><?php _e('Path', 'nggallery') ?>:</th>
293
- <th align="left"><input <?php if ( is_multisite() ) echo 'readonly = "readonly"'; ?> <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery path' ); ?> type="text" size="50" name="path" value="<?php echo $gallery->path; ?>" /></th>
294
- <th align="right"><?php _e('Author', 'nggallery'); ?>:</th>
295
- <th align="left">
296
- <?php
297
- $editable_ids = $ngg->manage_page->get_editable_user_ids( $user_ID );
298
- if ( $editable_ids && count( $editable_ids ) > 1 && nggGallery::current_user_can( 'NextGEN Edit gallery author') )
299
- wp_dropdown_users( array('include' => $editable_ids, 'name' => 'author', 'selected' => empty( $gallery->author ) ? 0 : $gallery->author ) );
300
- else
301
- echo $act_author_user->display_name;
302
- ?>
303
- </th>
304
- </tr>
305
- <?php if(current_user_can( 'publish_pages' )) : ?>
306
- <tr>
307
- <th align="left">&nbsp;</th>
308
- <th align="left">&nbsp;</th>
309
- <th align="right"><?php _e('Create new page', 'nggallery') ?>:</th>
310
- <th align="left">
311
- <select name="parent_id" style="width:95%">
312
- <option value="0"><?php _e ('Main page (No parent)', 'nggallery'); ?></option>
313
- <?php parent_dropdown (); ?>
314
- </select>
315
- <input class="button-secondary action" type="submit" name="addnewpage" value="<?php _e ('Add page', 'nggallery'); ?>" id="group"/>
316
- </th>
317
- </tr>
318
- <?php endif; ?>
319
- <?php do_action('ngg_manage_gallery_settings', $act_gid); ?>
320
-
321
- </table>
322
-
323
- <div class="submit">
324
- <input type="submit" class="button-secondary" name="scanfolder" value="<?php _e("Scan Folder for new images",'nggallery'); ?> " />
325
- <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes",'nggallery'); ?>" />
326
- </div>
327
-
328
- </div>
329
- </div>
330
- </div> <!-- poststuff -->
331
- <?php endif; ?>
332
-
333
- <?php endif; ?>
334
-
335
- <div class="tablenav top ngg-tablenav">
336
- <?php $ngg->manage_page->pagination( 'top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
337
- <div class="alignleft actions">
338
- <select id="bulkaction" name="bulkaction">
339
- <option value="no_action" ><?php _e("Bulk actions",'nggallery'); ?></option>
340
- <option value="set_watermark" ><?php _e("Set watermark",'nggallery'); ?></option>
341
- <option value="new_thumbnail" ><?php _e("Create new thumbnails",'nggallery'); ?></option>
342
- <option value="resize_images" ><?php _e("Resize images",'nggallery'); ?></option>
343
- <option value="recover_images" ><?php _e("Recover from backup",'nggallery'); ?></option>
344
- <option value="delete_images" ><?php _e("Delete images",'nggallery'); ?></option>
345
- <option value="import_meta" ><?php _e("Import metadata",'nggallery'); ?></option>
346
- <option value="rotate_cw" ><?php _e("Rotate images clockwise",'nggallery'); ?></option>
347
- <option value="rotate_ccw" ><?php _e("Rotate images counter-clockwise",'nggallery'); ?></option>
348
- <option value="copy_to" ><?php _e("Copy to...",'nggallery'); ?></option>
349
- <option value="move_to"><?php _e("Move to...",'nggallery'); ?></option>
350
- <option value="add_tags" ><?php _e("Add tags",'nggallery'); ?></option>
351
- <option value="delete_tags" ><?php _e("Delete tags",'nggallery'); ?></option>
352
- <option value="overwrite_tags" ><?php _e("Overwrite tags",'nggallery'); ?></option>
353
- </select>
354
- <input class="button-secondary" type="submit" name="showThickbox" value="<?php _e('Apply', 'nggallery'); ?>" onclick="if ( !checkSelected() ) return false;" />
355
-
356
- <?php if (($ngg->options['galSort'] == "sortorder") && (!$is_search) ) { ?>
357
- <input class="button-secondary" type="submit" name="sortGallery" value="<?php _e('Sort gallery', 'nggallery');?>" />
358
- <?php } ?>
359
-
360
- <input type="submit" name="updatepictures" class="button-primary action" value="<?php _e('Save Changes', 'nggallery');?>" />
361
- </div>
362
- </div>
363
-
364
- <table id="ngg-listimages" class="widefat fixed" cellspacing="0" >
365
-
366
- <thead>
367
- <tr>
368
- <?php $wp_list_table->print_column_headers(true); ?>
369
- </tr>
370
- </thead>
371
- <tfoot>
372
- <tr>
373
- <?php $wp_list_table->print_column_headers(false); ?>
374
- </tr>
375
- </tfoot>
376
- <tbody id="the-list">
377
- <?php
378
- if($picturelist) {
379
-
380
- $thumbsize = '';
381
-
382
- if ($ngg->options['thumbfix'])
383
- $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
384
-
385
- foreach($picturelist as $picture) {
386
-
387
- //for search result we need to check the capatibiliy
388
- if ( !nggAdmin::can_manage_this_gallery($picture->author) && $is_search )
389
- continue;
390
-
391
- $counter++;
392
- $pid = (int) $picture->pid;
393
- $alternate = ( !isset($alternate) || $alternate == 'alternate' ) ? '' : 'alternate';
394
- $exclude = ( $picture->exclude ) ? 'checked="checked"' : '';
395
- $date = mysql2date(get_option('date_format'), $picture->imagedate);
396
- $time = mysql2date(get_option('time_format'), $picture->imagedate);
397
-
398
- ?>
399
- <tr id="picture-<?php echo $pid ?>" class="<?php echo $alternate ?> iedit" valign="top">
400
- <?php
401
- foreach($image_columns as $image_column_key => $column_display_name) {
402
- $class = "class='$image_column_key column-$image_column_key'";
403
-
404
- $style = '';
405
- if ( in_array($image_column_key, $hidden_columns) )
406
- $style = ' style="display:none;"';
407
-
408
- $attributes = $class . $style;
409
-
410
- switch ($image_column_key) {
411
- case 'cb' :
412
- $attributes = 'class="column-cb check-column"' . $style;
413
- ?>
414
- <th <?php echo $attributes ?> scope="row"><input name="doaction[]" type="checkbox" value="<?php echo $pid ?>" /></th>
415
- <?php
416
- break;
417
- case 'id' :
418
- ?>
419
- <td <?php echo $attributes ?> style=""><?php echo $pid; ?>
420
- <input type="hidden" name="pid[]" value="<?php echo $pid ?>" />
421
- </td>
422
- <?php
423
- break;
424
- case 'filename' :
425
- $attributes = 'class="title column-filename column-title"' . $style;
426
- ?>
427
- <td <?php echo $attributes ?>>
428
- <strong><a href="<?php echo esc_url( $picture->imageURL ); ?>" class="thickbox" title="<?php echo esc_attr ($picture->filename); ?>">
429
- <?php echo ( empty($picture->alttext) ) ? esc_html( $picture->filename ) : esc_html( stripslashes(nggGallery::i18n($picture->alttext)) ); ?>
430
- </a></strong>
431
- <br /><?php echo $date; ?>
432
- <?php if ( !empty($picture->meta_data) ): ?>
433
- <br /><?php echo $picture->meta_data['width']; ?> x <?php echo $picture->meta_data['height']; ?> <?php _e('pixel', 'nggallery'); ?>
434
-
435
- <?php endif; ?>
436
- <p>
437
- <?php
438
- $actions = array();
439
- $actions['view'] = '<a class="shutter" href="' . esc_url( $picture->imageURL ) . '" title="' . esc_attr( sprintf(__('View "%s"'), sanitize_title ($picture->filename) )) . '">' . __('View', 'nggallery') . '</a>';
440
- $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
441
- $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
442
- $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate','nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
443
- if ( current_user_can( 'publish_posts' ) )
444
- $actions['publish'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/publish.php?id=' . $pid . '&h=230" title="' . __('Publish this image','nggallery') . '">' . __('Publish', 'nggallery') . '</a>';
445
- if ( file_exists( $picture->imagePath . '_backup' ) )
446
- $actions['recover'] = '<a class="confirmrecover" href="' .wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=recoverpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_recoverpicture'). '" title="' . __('Recover','nggallery') . '" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Recover "%s" ?' , 'nggallery'), $picture->filename)). '\');if(check==false) return false;">' . __('Recover', 'nggallery') . '</a>';
447
- $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture'). '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s" ?' , 'nggallery'), $picture->filename)). '\');if(check==false) return false;">' . __('Delete') . '</a>';
448
- $action_count = count($actions);
449
- $i = 0;
450
- echo '<div class="row-actions">';
451
- foreach ( $actions as $action => $link ) {
452
- ++$i;
453
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
454
- echo "<span class='$action'>$link$sep</span>";
455
- }
456
- echo '</div>';
457
- ?></p>
458
- </td>
459
- <?php
460
- break;
461
- case 'thumbnail' :
462
- $attributes = 'class="id column-thumbnail media-icon"' . $style;
463
- ?>
464
- <td <?php echo $attributes ?>><a href="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->imageURL) ); ?>" class="shutter" title="<?php echo $picture->filename ?>">
465
- <img class="thumb" src="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->thumbURL) ); ?>" id="thumb<?php echo $pid ?>" />
466
- </a>
467
- </td>
468
- <?php
469
- break;
470
- case 'alt_title_desc' :
471
- ?>
472
- <td <?php echo $attributes ?>>
473
- <input name="alttext[<?php echo $pid ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext) ?>" /><br/>
474
- <textarea name="description[<?php echo $pid ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description) ?></textarea>
475
- </td>
476
- <?php
477
- break;
478
- case 'exclude' :
479
- ?>
480
- <td <?php echo $attributes ?>><input name="exclude[<?php echo $pid ?>]" type="checkbox" value="1" <?php echo $exclude ?> /></td>
481
- <?php
482
- break;
483
- case 'tags' :
484
- $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names');
485
- if (is_array ($picture->tags) ) $picture->tags = implode(', ', $picture->tags);
486
- ?>
487
- <td <?php echo $attributes ?>><textarea name="tags[<?php echo $pid ?>]" style="width:95%;" rows="2"><?php echo $picture->tags ?></textarea></td>
488
- <?php
489
- break;
490
- default :
491
- ?>
492
- <td <?php echo $attributes ?>><?php do_action('ngg_manage_image_custom_column', $image_column_key, $pid); ?></td>
493
- <?php
494
- break;
495
- }
496
- ?>
497
- <?php } ?>
498
- </tr>
499
- <?php
500
- }
501
- }
502
-
503
- // In the case you have no capaptibility to see the search result
504
- if ( $counter == 0 )
505
- echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>'.__('No entries found','nggallery').'</strong></td></tr>';
506
-
507
- ?>
508
-
509
- </tbody>
510
- </table>
511
- <div class="tablenav bottom">
512
- <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e('Save Changes', 'nggallery'); ?>" />
513
- <?php $ngg->manage_page->pagination( 'bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
514
- </div>
515
- </form>
516
- <br class="clear"/>
517
- </div><!-- /#wrap -->
518
-
519
- <!-- #entertags -->
520
- <div id="entertags" style="display: none;" >
521
- <form id="form-tags" method="POST" accept-charset="utf-8">
522
- <?php wp_nonce_field('ngg_thickbox_form') ?>
523
- <input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
524
- <input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
525
- <input type="hidden" name="page" value="manage-images" />
526
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
527
- <tr>
528
- <th><?php _e("Enter the tags",'nggallery'); ?> : <input name="taglist" type="text" style="width:90%" value="" /></th>
529
- </tr>
530
- <tr align="right">
531
- <td class="submit">
532
- <input class="button-primary" type="submit" name="TB_EditTags" value="<?php _e("OK",'nggallery'); ?>" />
533
- &nbsp;
534
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e("Cancel",'nggallery'); ?>&nbsp;" />
535
- </td>
536
- </tr>
537
- </table>
538
- </form>
539
- </div>
540
- <!-- /#entertags -->
541
-
542
- <!-- #selectgallery -->
543
- <div id="selectgallery" style="display: none;" >
544
- <form id="form-select-gallery" method="POST" accept-charset="utf-8">
545
- <?php wp_nonce_field('ngg_thickbox_form') ?>
546
- <input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
547
- <input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
548
- <input type="hidden" name="page" value="manage-images" />
549
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
550
- <tr>
551
- <th>
552
- <?php _e('Select the destination gallery:', 'nggallery'); ?>&nbsp;
553
- <select name="dest_gid" style="width:90%" >
554
- <?php
555
- foreach ($gallerylist as $gallery) {
556
- if ($gallery->gid != $act_gid) {
557
- ?>
558
- <option value="<?php echo $gallery->gid; ?>" ><?php echo $gallery->gid; ?> - <?php echo esc_attr( stripslashes($gallery->title) ); ?></option>
559
- <?php
560
- }
561
- }
562
- ?>
563
- </select>
564
- </th>
565
- </tr>
566
- <tr align="right">
567
- <td class="submit">
568
- <input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php _e("OK",'nggallery'); ?>" />
569
- &nbsp;
570
- <input class="button-secondary dialog-cancel" type="reset" value="<?php _e("Cancel",'nggallery'); ?>" />
571
- </td>
572
- </tr>
573
- </table>
574
- </form>
575
- </div>
576
- <!-- /#selectgallery -->
577
-
578
- <!-- #resize_images -->
579
- <div id="resize_images" style="display: none;" >
580
- <form id="form-resize-images" method="POST" accept-charset="utf-8">
581
- <?php wp_nonce_field('ngg_thickbox_form') ?>
582
- <input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
583
- <input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
584
- <input type="hidden" name="page" value="manage-images" />
585
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
586
- <tr valign="top">
587
- <td>
588
- <strong><?php _e('Resize Images to', 'nggallery'); ?>:</strong>
589
- </td>
590
- <td>
591
- <input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
592
- <br /><small><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></small>
593
- </td>
594
- </tr>
595
- <tr align="right">
596
- <td colspan="2" class="submit">
597
- <input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php _e('OK', 'nggallery'); ?>" />
598
- &nbsp;
599
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
600
- </td>
601
- </tr>
602
- </table>
603
- </form>
604
- </div>
605
- <!-- /#resize_images -->
606
-
607
- <!-- #new_thumbnail -->
608
- <div id="new_thumbnail" style="display: none;" >
609
- <form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
610
- <?php wp_nonce_field('ngg_thickbox_form') ?>
611
- <input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
612
- <input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
613
- <input type="hidden" name="page" value="manage-images" />
614
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
615
- <tr valign="top">
616
- <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
617
- <td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
618
- <br /><small><?php _e('These values are maximum values ','nggallery') ?></small></td>
619
- </tr>
620
- <tr valign="top">
621
- <th align="left"><?php _e('Set fix dimension','nggallery') ?></th>
622
- <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
623
- <br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
624
- </tr>
625
- <tr align="right">
626
- <td colspan="2" class="submit">
627
- <input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
628
- &nbsp;
629
- <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
630
- </td>
631
- </tr>
632
- </table>
633
- </form>
634
- </div>
635
- <!-- /#new_thumbnail -->
636
-
637
- <script type="text/javascript">
638
- /* <![CDATA[ */
639
- jQuery(document).ready(function(){columns.init('nggallery-manage-images');});
640
- /* ]]> */
641
- </script>
642
- <?php
643
- }
644
-
645
- /**
646
- * Construtor class to create the table layout
647
- *
648
- * @package WordPress
649
- * @subpackage List_Table
650
- * @since 1.8.0
651
- * @access private
652
- */
653
- class _NGG_Images_List_Table extends WP_List_Table {
654
- var $_screen;
655
- var $_columns;
656
-
657
- function _NGG_Images_List_Table( $screen ) {
658
- if ( is_string( $screen ) )
659
- $screen = convert_to_screen( $screen );
660
-
661
- $this->_screen = $screen;
662
- $this->_columns = array() ;
663
-
664
- add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
665
- }
666
-
667
- function get_column_info() {
668
-
669
- $columns = get_column_headers( $this->_screen );
670
- $hidden = get_hidden_columns( $this->_screen );
671
- $_sortable = $this->get_sortable_columns();
672
- $sortable = array();
673
-
674
- foreach ( $_sortable as $id => $data ) {
675
- if ( empty( $data ) )
676
- continue;
677
-
678
- $data = (array) $data;
679
- if ( !isset( $data[1] ) )
680
- $data[1] = false;
681
-
682
- $sortable[$id] = $data;
683
- }
684
-
685
- return array( $columns, $hidden, $sortable );
686
- }
687
-
688
- // define the columns to display, the syntax is 'internal name' => 'display name'
689
- function get_columns() {
690
- $columns = array();
691
-
692
- $columns['cb'] = '<input name="checkall" type="checkbox" onclick="checkAll(document.getElementById(\'updategallery\'));" />';
693
- $columns['id'] = __('ID');
694
- $columns['thumbnail'] = __('Thumbnail', 'nggallery');
695
- $columns['filename'] = __('Filename', 'nggallery');
696
- $columns['alt_title_desc'] = __('Alt &amp; Title Text', 'nggallery') . ' / ' . __('Description', 'nggallery');
697
- $columns['tags'] = __('Tags (comma separated list)', 'nggallery');
698
- $columns['exclude'] = __('exclude', 'nggallery');
699
-
700
- $columns = apply_filters('ngg_manage_images_columns', $columns);
701
-
702
- return $columns;
703
- }
704
-
705
- function get_sortable_columns() {
706
- return array();
707
- }
708
- }
709
-
 
710
  ?>
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.');}
4
+
5
+ function nggallery_picturelist() {
6
+ // *** show picture list
7
+ global $wpdb, $nggdb, $user_ID, $ngg;
8
+
9
+ // Look if its a search result
10
+ $is_search = isset ($_GET['s']) ? true : false;
11
+ $counter = 0;
12
+
13
+ $wp_list_table = new _NGG_Images_List_Table('nggallery-manage-images');
14
+
15
+ if ($is_search) {
16
+
17
+ // fetch the imagelist
18
+ $picturelist = $ngg->manage_page->search_result;
19
+
20
+ // we didn't set a gallery or a pagination
21
+ $act_gid = 0;
22
+ $_GET['paged'] = 1;
23
+ $page_links = false;
24
+
25
+ } else {
26
+
27
+ // GET variables
28
+ $act_gid = $ngg->manage_page->gid;
29
+
30
+ // Load the gallery metadata
31
+ $gallery = $nggdb->find_gallery($act_gid);
32
+
33
+ if (!$gallery) {
34
+ nggGallery::show_error(__('Gallery not found.', 'nggallery'));
35
+ return;
36
+ }
37
+
38
+ // Check if you have the correct capability
39
+ if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
40
+ nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
41
+ return;
42
+ }
43
+
44
+ // look for pagination
45
+ $_GET['paged'] = isset($_GET['paged']) && ($_GET['paged'] > 0) ? absint($_GET['paged']) : 1;
46
+
47
+ $start = ( $_GET['paged'] - 1 ) * 50;
48
+
49
+ // get picture values
50
+ $picturelist = $nggdb->get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false, 50, $start );
51
+
52
+ // get the current author
53
+ $act_author_user = get_userdata( (int) $gallery->author );
54
+
55
+ }
56
+
57
+ // list all galleries
58
+ $gallerylist = $nggdb->find_all_galleries();
59
+
60
+ //get the columns
61
+ $image_columns = $wp_list_table->get_columns();
62
+ $hidden_columns = get_hidden_columns('nggallery-manage-images');
63
+ $num_columns = count($image_columns) - count($hidden_columns);
64
+
65
+ $attr = (nggGallery::current_user_can( 'NextGEN Edit gallery options' )) ? '' : 'disabled="disabled"';
66
+
67
+ ?>
68
+ <script type="text/javascript">
69
+ <!--
70
+ function showDialog( windowId, title ) {
71
+ var form = document.getElementById('updategallery');
72
+ var elementlist = "";
73
+ for (i = 0, n = form.elements.length; i < n; i++) {
74
+ if(form.elements[i].type == "checkbox") {
75
+ if(form.elements[i].name == "doaction[]")
76
+ if(form.elements[i].checked == true)
77
+ if (elementlist == "")
78
+ elementlist = form.elements[i].value
79
+ else
80
+ elementlist += "," + form.elements[i].value ;
81
+ }
82
+ }
83
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
84
+ jQuery("#" + windowId + "_imagelist").val(elementlist);
85
+ // now show the dialog
86
+ jQuery( "#" + windowId ).dialog({
87
+ width: 640,
88
+ resizable : false,
89
+ modal: true,
90
+ title: title
91
+ });
92
+ jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
93
+ }
94
+
95
+ jQuery(function (){
96
+ // load a content via ajax
97
+ jQuery('a.ngg-dialog').click(function() {
98
+ if ( jQuery( "#spinner" ).length == 0)
99
+ jQuery("body").append('<div id="spinner"></div>');
100
+ var $this = jQuery(this);
101
+ var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
102
+ var width = ( results ) ? results[1] : 600;
103
+ var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
104
+ var height = ( results ) ? results[1] : 440;
105
+ jQuery('#spinner').fadeIn();
106
+ var dialog = jQuery('<div style="display:hidden"></div>').appendTo('body');
107
+ // load the remote content
108
+ dialog.load(
109
+ this.href,
110
+ {},
111
+ function () {
112
+ jQuery('#spinner').hide();
113
+ dialog.dialog({
114
+ title: ($this.attr('title')) ? $this.attr('title') : '',
115
+ width: width,
116
+ height: height,
117
+ modal: true,
118
+ resizable: false,
119
+ close: function() { dialog.remove(); }
120
+ }).width(width - 30).height(height - 30);
121
+ }
122
+ );
123
+ //prevent the browser to follow the link
124
+ return false;
125
+ });
126
+ });
127
+
128
+ function checkAll(form)
129
+ {
130
+ for (i = 0, n = form.elements.length; i < n; i++) {
131
+ if(form.elements[i].type == "checkbox") {
132
+ if(form.elements[i].name == "doaction[]") {
133
+ if(form.elements[i].checked == true)
134
+ form.elements[i].checked = false;
135
+ else
136
+ form.elements[i].checked = true;
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ function getNumChecked(form)
143
+ {
144
+ var num = 0;
145
+ for (i = 0, n = form.elements.length; i < n; i++) {
146
+ if(form.elements[i].type == "checkbox") {
147
+ if(form.elements[i].name == "doaction[]")
148
+ if(form.elements[i].checked == true)
149
+ num++;
150
+ }
151
+ }
152
+ return num;
153
+ }
154
+
155
+ // this function check for a the number of selected images, sumbmit false when no one selected
156
+ function checkSelected() {
157
+
158
+ var numchecked = getNumChecked(document.getElementById('updategallery'));
159
+
160
+ if (typeof document.activeElement == "undefined" && document.addEventListener) {
161
+ document.addEventListener("focus", function (e) {
162
+ document.activeElement = e.target;
163
+ }, true);
164
+ }
165
+
166
+ if ( document.activeElement.name == 'post_paged' )
167
+ return true;
168
+
169
+ if(numchecked < 1) {
170
+ alert('<?php echo esc_js(__('No images selected', 'nggallery')); ?>');
171
+ return false;
172
+ }
173
+
174
+ actionId = jQuery('#bulkaction').val();
175
+
176
+ switch (actionId) {
177
+ case "copy_to":
178
+ showDialog('selectgallery', '<?php echo esc_js(__('Copy image to...','nggallery')); ?>');
179
+ return false;
180
+ break;
181
+ case "move_to":
182
+ showDialog('selectgallery', '<?php echo esc_js(__('Move image to...','nggallery')); ?>');
183
+ return false;
184
+ break;
185
+ case "add_tags":
186
+ showDialog('entertags', '<?php echo esc_js(__('Add new tags','nggallery')); ?>');
187
+ return false;
188
+ break;
189
+ case "delete_tags":
190
+ showDialog('entertags', '<?php echo esc_js(__('Delete tags','nggallery')); ?>');
191
+ return false;
192
+ break;
193
+ case "overwrite_tags":
194
+ showDialog('entertags', '<?php echo esc_js(__('Overwrite','nggallery')); ?>');
195
+ return false;
196
+ break;
197
+ case "resize_images":
198
+ showDialog('resize_images', '<?php echo esc_js(__('Resize images','nggallery')); ?>');
199
+ return false;
200
+ break;
201
+ case "new_thumbnail":
202
+ showDialog('new_thumbnail', '<?php echo esc_js(__('Create new thumbnails','nggallery')); ?>');
203
+ return false;
204
+ break;
205
+ }
206
+
207
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.",'nggallery')), "' + numchecked + '") ; ?>');
208
+ }
209
+
210
+ jQuery(document).ready( function() {
211
+ // close postboxes that should be closed
212
+ jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
213
+ postboxes.add_postbox_toggles('ngg-manage-gallery');
214
+ });
215
+
216
+ //-->
217
+ </script>
218
+ <div class="wrap">
219
+ <?php include('templates/social_media_buttons.php'); ?>
220
+ <?php screen_icon( 'nextgen-gallery' ); ?>
221
+ <?php if ($is_search) :?>
222
+ <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html( get_search_query() ) ); ?></h2>
223
+ <form class="search-form" action="" method="get">
224
+ <p class="search-box">
225
+ <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'nggallery' ); ?>:</label>
226
+ <input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
227
+ <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
228
+ <input type="submit" value="<?php _e( 'Search Images', 'nggallery' ); ?>" class="button" />
229
+ </p>
230
+ </form>
231
+
232
+ <br style="clear: both;" />
233
+
234
+ <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query(); ?>" accept-charset="utf-8">
235
+ <?php wp_nonce_field('ngg_updategallery') ?>
236
+ <input type="hidden" name="page" value="manage-images" />
237
+
238
+ <?php else :?>
239
+ <h2><?php echo _n( 'Gallery', 'Galleries', 1, 'nggallery' ); ?> : <?php echo esc_html ( nggGallery::i18n($gallery->title) ); ?></h2>
240
+
241
+ <br style="clear: both;" />
242
+
243
+ <form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . $_GET['paged']; ?>" accept-charset="utf-8">
244
+ <?php wp_nonce_field('ngg_updategallery') ?>
245
+ <input type="hidden" name="page" value="manage-images" />
246
+
247
+ <?php if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' )) : ?>
248
+ <div id="poststuff">
249
+ <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
250
+ <div id="gallerydiv" class="postbox <?php echo postbox_classes('gallerydiv', 'ngg-manage-gallery'); ?>" >
251
+ <h3><?php _e('Gallery settings', 'nggallery') ?><small> (<?php _e('Click here for more settings', 'nggallery') ?>)</small></h3>
252
+ <div class="inside">
253
+ <table class="form-table" >
254
+ <tr>
255
+ <th align="left"><?php _e('Title') ?>:</th>
256
+ <th align="left"><input <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery title' ); ?> type="text" size="50" name="title" value="<?php echo $gallery->title; ?>" /></th>
257
+ <th align="right"><?php _e('Page Link to', 'nggallery') ?>:</th>
258
+ <th align="left">
259
+ <select <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery page id' ); ?> name="pageid" style="width:95%">
260
+ <option value="0" ><?php _e('Not linked', 'nggallery') ?></option>
261
+ <?php parent_dropdown($gallery->pageid); ?>
262
+ </select>
263
+ </th>
264
+ </tr>
265
+ <tr>
266
+ <th align="left"><?php _e('Description') ?>:</th>
267
+ <th align="left"><textarea <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery description' ); ?> name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo $gallery->galdesc; ?></textarea></th>
268
+ <th align="right"><?php _e('Preview image', 'nggallery') ?>:</th>
269
+ <th align="left">
270
+ <select <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery preview pic' ); ?> name="previewpic" style="width:95%" >
271
+ <option value="0" ><?php _e('No Picture', 'nggallery') ?></option>
272
+ <?php
273
+ // ensure that a preview pic from a other page is still shown here
274
+ if ( intval($gallery->previewpic) != 0) {
275
+ if ( !array_key_exists ($gallery->previewpic, $picturelist )){
276
+ $previewpic = $nggdb->find_image($gallery->previewpic);
277
+ if ($previewpic)
278
+ echo '<option value="'.$previewpic->pid.'" selected="selected" >'.$previewpic->pid.' - ' . esc_attr( $previewpic->filename ) . '</option>'."\n";
279
+ }
280
+ }
281
+ if(is_array($picturelist)) {
282
+ foreach($picturelist as $picture) {
283
+ if ($picture->exclude) continue;
284
+ $selected = ($picture->pid == $gallery->previewpic) ? 'selected="selected" ' : '';
285
+ echo '<option value="'.$picture->pid.'" '.$selected.'>'.$picture->pid.' - ' . esc_attr( $picture->filename ) . '</option>'."\n";
286
+ }
287
+ }
288
+ ?>
289
+ </select>
290
+ </th>
291
+ </tr>
292
+ <tr>
293
+ <th align="left"><?php _e('Path', 'nggallery') ?>:</th>
294
+ <th align="left"><input <?php if ( is_multisite() ) echo 'readonly = "readonly"'; ?> <?php nggGallery::current_user_can_form( 'NextGEN Edit gallery path' ); ?> type="text" size="50" name="path" value="<?php echo $gallery->path; ?>" /></th>
295
+ <th align="right"><?php _e('Author', 'nggallery'); ?>:</th>
296
+ <th align="left">
297
+ <?php
298
+ $editable_ids = $ngg->manage_page->get_editable_user_ids( $user_ID );
299
+ if ( $editable_ids && count( $editable_ids ) > 1 && nggGallery::current_user_can( 'NextGEN Edit gallery author') )
300
+ wp_dropdown_users( array('include' => $editable_ids, 'name' => 'author', 'selected' => empty( $gallery->author ) ? 0 : $gallery->author ) );
301
+ else
302
+ echo $act_author_user->display_name;
303
+ ?>
304
+ </th>
305
+ </tr>
306
+ <?php if(current_user_can( 'publish_pages' )) : ?>
307
+ <tr>
308
+ <th align="left">&nbsp;</th>
309
+ <th align="left">&nbsp;</th>
310
+ <th align="right"><?php _e('Create new page', 'nggallery') ?>:</th>
311
+ <th align="left">
312
+ <select name="parent_id" style="width:95%">
313
+ <option value="0"><?php _e ('Main page (No parent)', 'nggallery'); ?></option>
314
+ <?php parent_dropdown (); ?>
315
+ </select>
316
+ <input class="button-secondary action" type="submit" name="addnewpage" value="<?php _e ('Add page', 'nggallery'); ?>" id="group"/>
317
+ </th>
318
+ </tr>
319
+ <?php endif; ?>
320
+ <?php do_action('ngg_manage_gallery_settings', $act_gid); ?>
321
+
322
+ </table>
323
+
324
+ <div class="submit">
325
+ <input type="submit" class="button-secondary" name="scanfolder" value="<?php _e("Scan Folder for new images",'nggallery'); ?> " />
326
+ <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes",'nggallery'); ?>" />
327
+ </div>
328
+
329
+ </div>
330
+ </div>
331
+ </div> <!-- poststuff -->
332
+ <?php endif; ?>
333
+
334
+ <?php endif; ?>
335
+
336
+ <div class="tablenav top ngg-tablenav">
337
+ <?php $ngg->manage_page->pagination( 'top', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
338
+ <div class="alignleft actions">
339
+ <select id="bulkaction" name="bulkaction">
340
+ <option value="no_action" ><?php _e("Bulk actions",'nggallery'); ?></option>
341
+ <option value="set_watermark" ><?php _e("Set watermark",'nggallery'); ?></option>
342
+ <option value="new_thumbnail" ><?php _e("Create new thumbnails",'nggallery'); ?></option>
343
+ <option value="resize_images" ><?php _e("Resize images",'nggallery'); ?></option>
344
+ <option value="recover_images" ><?php _e("Recover from backup",'nggallery'); ?></option>
345
+ <option value="delete_images" ><?php _e("Delete images",'nggallery'); ?></option>
346
+ <option value="import_meta" ><?php _e("Import metadata",'nggallery'); ?></option>
347
+ <option value="rotate_cw" ><?php _e("Rotate images clockwise",'nggallery'); ?></option>
348
+ <option value="rotate_ccw" ><?php _e("Rotate images counter-clockwise",'nggallery'); ?></option>
349
+ <option value="copy_to" ><?php _e("Copy to...",'nggallery'); ?></option>
350
+ <option value="move_to"><?php _e("Move to...",'nggallery'); ?></option>
351
+ <option value="add_tags" ><?php _e("Add tags",'nggallery'); ?></option>
352
+ <option value="delete_tags" ><?php _e("Delete tags",'nggallery'); ?></option>
353
+ <option value="overwrite_tags" ><?php _e("Overwrite tags",'nggallery'); ?></option>
354
+ </select>
355
+ <input class="button-secondary" type="submit" name="showThickbox" value="<?php _e('Apply', 'nggallery'); ?>" onclick="if ( !checkSelected() ) return false;" />
356
+
357
+ <?php if (($ngg->options['galSort'] == "sortorder") && (!$is_search) ) { ?>
358
+ <input class="button-secondary" type="submit" name="sortGallery" value="<?php _e('Sort gallery', 'nggallery');?>" />
359
+ <?php } ?>
360
+
361
+ <input type="submit" name="updatepictures" class="button-primary action" value="<?php _e('Save Changes', 'nggallery');?>" />
362
+ </div>
363
+ </div>
364
+
365
+ <table id="ngg-listimages" class="widefat fixed" cellspacing="0" >
366
+
367
+ <thead>
368
+ <tr>
369
+ <?php $wp_list_table->print_column_headers(true); ?>
370
+ </tr>
371
+ </thead>
372
+ <tfoot>
373
+ <tr>
374
+ <?php $wp_list_table->print_column_headers(false); ?>
375
+ </tr>
376
+ </tfoot>
377
+ <tbody id="the-list">
378
+ <?php
379
+ if($picturelist) {
380
+
381
+ $thumbsize = '';
382
+
383
+ if ($ngg->options['thumbfix'])
384
+ $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
385
+
386
+ foreach($picturelist as $picture) {
387
+
388
+ //for search result we need to check the capatibiliy
389
+ if ( !nggAdmin::can_manage_this_gallery($picture->author) && $is_search )
390
+ continue;
391
+
392
+ $counter++;
393
+ $pid = (int) $picture->pid;
394
+ $alternate = ( !isset($alternate) || $alternate == 'alternate' ) ? '' : 'alternate';
395
+ $exclude = ( $picture->exclude ) ? 'checked="checked"' : '';
396
+ $date = mysql2date(get_option('date_format'), $picture->imagedate);
397
+ $time = mysql2date(get_option('time_format'), $picture->imagedate);
398
+
399
+ ?>
400
+ <tr id="picture-<?php echo $pid ?>" class="<?php echo $alternate ?> iedit" valign="top">
401
+ <?php
402
+ foreach($image_columns as $image_column_key => $column_display_name) {
403
+ $class = "class='$image_column_key column-$image_column_key'";
404
+
405
+ $style = '';
406
+ if ( in_array($image_column_key, $hidden_columns) )
407
+ $style = ' style="display:none;"';
408
+
409
+ $attributes = $class . $style;
410
+
411
+ switch ($image_column_key) {
412
+ case 'cb' :
413
+ $attributes = 'class="column-cb check-column"' . $style;
414
+ ?>
415
+ <th <?php echo $attributes ?> scope="row"><input name="doaction[]" type="checkbox" value="<?php echo $pid ?>" /></th>
416
+ <?php
417
+ break;
418
+ case 'id' :
419
+ ?>
420
+ <td <?php echo $attributes ?> style=""><?php echo $pid; ?>
421
+ <input type="hidden" name="pid[]" value="<?php echo $pid ?>" />
422
+ </td>
423
+ <?php
424
+ break;
425
+ case 'filename' :
426
+ $attributes = 'class="title column-filename column-title"' . $style;
427
+ ?>
428
+ <td <?php echo $attributes ?>>
429
+ <strong><a href="<?php echo esc_url( $picture->imageURL ); ?>" class="thickbox" title="<?php echo esc_attr ($picture->filename); ?>">
430
+ <?php echo ( empty($picture->alttext) ) ? esc_html( $picture->filename ) : esc_html( stripslashes(nggGallery::i18n($picture->alttext)) ); ?>
431
+ </a></strong>
432
+ <br /><?php echo $date; ?>
433
+ <?php if ( !empty($picture->meta_data) ): ?>
434
+ <br /><?php echo $picture->meta_data['width']; ?> x <?php echo $picture->meta_data['height']; ?> <?php _e('pixel', 'nggallery'); ?>
435
+
436
+ <?php endif; ?>
437
+ <p>
438
+ <?php
439
+ $actions = array();
440
+ $actions['view'] = '<a class="shutter" href="' . esc_url( $picture->imageURL ) . '" title="' . esc_attr( sprintf(__('View "%s"'), sanitize_title ($picture->filename) )) . '">' . __('View', 'nggallery') . '</a>';
441
+ $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
442
+ $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
443
+ $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate','nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
444
+ if ( current_user_can( 'publish_posts' ) )
445
+ $actions['publish'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/publish.php?id=' . $pid . '&h=230" title="' . __('Publish this image','nggallery') . '">' . __('Publish', 'nggallery') . '</a>';
446
+ if ( file_exists( $picture->imagePath . '_backup' ) )
447
+ $actions['recover'] = '<a class="confirmrecover" href="' .wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=recoverpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_recoverpicture'). '" title="' . __('Recover','nggallery') . '" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Recover "%s" ?' , 'nggallery'), $picture->filename)). '\');if(check==false) return false;">' . __('Recover', 'nggallery') . '</a>';
448
+ $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture'). '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s" ?' , 'nggallery'), $picture->filename)). '\');if(check==false) return false;">' . __('Delete') . '</a>';
449
+ $action_count = count($actions);
450
+ $i = 0;
451
+ echo '<div class="row-actions">';
452
+ foreach ( $actions as $action => $link ) {
453
+ ++$i;
454
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
455
+ echo "<span class='$action'>$link$sep</span>";
456
+ }
457
+ echo '</div>';
458
+ ?></p>
459
+ </td>
460
+ <?php
461
+ break;
462
+ case 'thumbnail' :
463
+ $attributes = 'class="id column-thumbnail media-icon"' . $style;
464
+ ?>
465
+ <td <?php echo $attributes ?>><a href="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->imageURL) ); ?>" class="shutter" title="<?php echo $picture->filename ?>">
466
+ <img class="thumb" src="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->thumbURL) ); ?>" id="thumb<?php echo $pid ?>" />
467
+ </a>
468
+ </td>
469
+ <?php
470
+ break;
471
+ case 'alt_title_desc' :
472
+ ?>
473
+ <td <?php echo $attributes ?>>
474
+ <input name="alttext[<?php echo $pid ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext) ?>" /><br/>
475
+ <textarea name="description[<?php echo $pid ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description) ?></textarea>
476
+ </td>
477
+ <?php
478
+ break;
479
+ case 'exclude' :
480
+ ?>
481
+ <td <?php echo $attributes ?>><input name="exclude[<?php echo $pid ?>]" type="checkbox" value="1" <?php echo $exclude ?> /></td>
482
+ <?php
483
+ break;
484
+ case 'tags' :
485
+ $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names');
486
+ if (is_array ($picture->tags) ) $picture->tags = implode(', ', $picture->tags);
487
+ ?>
488
+ <td <?php echo $attributes ?>><textarea name="tags[<?php echo $pid ?>]" style="width:95%;" rows="2"><?php echo $picture->tags ?></textarea></td>
489
+ <?php
490
+ break;
491
+ default :
492
+ ?>
493
+ <td <?php echo $attributes ?>><?php do_action('ngg_manage_image_custom_column', $image_column_key, $pid); ?></td>
494
+ <?php
495
+ break;
496
+ }
497
+ ?>
498
+ <?php } ?>
499
+ </tr>
500
+ <?php
501
+ }
502
+ }
503
+
504
+ // In the case you have no capaptibility to see the search result
505
+ if ( $counter == 0 )
506
+ echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>'.__('No entries found','nggallery').'</strong></td></tr>';
507
+
508
+ ?>
509
+
510
+ </tbody>
511
+ </table>
512
+ <div class="tablenav bottom">
513
+ <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e('Save Changes', 'nggallery'); ?>" />
514
+ <?php $ngg->manage_page->pagination( 'bottom', $_GET['paged'], $nggdb->paged['total_objects'], $nggdb->paged['objects_per_page'] ); ?>
515
+ </div>
516
+ </form>
517
+ <br class="clear"/>
518
+ </div><!-- /#wrap -->
519
+
520
+ <!-- #entertags -->
521
+ <div id="entertags" style="display: none;" >
522
+ <form id="form-tags" method="POST" accept-charset="utf-8">
523
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
524
+ <input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
525
+ <input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
526
+ <input type="hidden" name="page" value="manage-images" />
527
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
528
+ <tr>
529
+ <th><?php _e("Enter the tags",'nggallery'); ?> : <input name="taglist" type="text" style="width:90%" value="" /></th>
530
+ </tr>
531
+ <tr align="right">
532
+ <td class="submit">
533
+ <input class="button-primary" type="submit" name="TB_EditTags" value="<?php _e("OK",'nggallery'); ?>" />
534
+ &nbsp;
535
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e("Cancel",'nggallery'); ?>&nbsp;" />
536
+ </td>
537
+ </tr>
538
+ </table>
539
+ </form>
540
+ </div>
541
+ <!-- /#entertags -->
542
+
543
+ <!-- #selectgallery -->
544
+ <div id="selectgallery" style="display: none;" >
545
+ <form id="form-select-gallery" method="POST" accept-charset="utf-8">
546
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
547
+ <input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
548
+ <input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
549
+ <input type="hidden" name="page" value="manage-images" />
550
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
551
+ <tr>
552
+ <th>
553
+ <?php _e('Select the destination gallery:', 'nggallery'); ?>&nbsp;
554
+ <select name="dest_gid" style="width:90%" >
555
+ <?php
556
+ foreach ($gallerylist as $gallery) {
557
+ if ($gallery->gid != $act_gid) {
558
+ ?>
559
+ <option value="<?php echo $gallery->gid; ?>" ><?php echo $gallery->gid; ?> - <?php echo esc_attr( stripslashes($gallery->title) ); ?></option>
560
+ <?php
561
+ }
562
+ }
563
+ ?>
564
+ </select>
565
+ </th>
566
+ </tr>
567
+ <tr align="right">
568
+ <td class="submit">
569
+ <input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php _e("OK",'nggallery'); ?>" />
570
+ &nbsp;
571
+ <input class="button-secondary dialog-cancel" type="reset" value="<?php _e("Cancel",'nggallery'); ?>" />
572
+ </td>
573
+ </tr>
574
+ </table>
575
+ </form>
576
+ </div>
577
+ <!-- /#selectgallery -->
578
+
579
+ <!-- #resize_images -->
580
+ <div id="resize_images" style="display: none;" >
581
+ <form id="form-resize-images" method="POST" accept-charset="utf-8">
582
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
583
+ <input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
584
+ <input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
585
+ <input type="hidden" name="page" value="manage-images" />
586
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
587
+ <tr valign="top">
588
+ <td>
589
+ <strong><?php _e('Resize Images to', 'nggallery'); ?>:</strong>
590
+ </td>
591
+ <td>
592
+ <input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
593
+ <br /><small><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></small>
594
+ </td>
595
+ </tr>
596
+ <tr align="right">
597
+ <td colspan="2" class="submit">
598
+ <input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php _e('OK', 'nggallery'); ?>" />
599
+ &nbsp;
600
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
601
+ </td>
602
+ </tr>
603
+ </table>
604
+ </form>
605
+ </div>
606
+ <!-- /#resize_images -->
607
+
608
+ <!-- #new_thumbnail -->
609
+ <div id="new_thumbnail" style="display: none;" >
610
+ <form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
611
+ <?php wp_nonce_field('ngg_thickbox_form') ?>
612
+ <input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
613
+ <input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
614
+ <input type="hidden" name="page" value="manage-images" />
615
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
616
+ <tr valign="top">
617
+ <th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
618
+ <td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
619
+ <br /><small><?php _e('These values are maximum values ','nggallery') ?></small></td>
620
+ </tr>
621
+ <tr valign="top">
622
+ <th align="left"><?php _e('Set fix dimension','nggallery') ?></th>
623
+ <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
624
+ <br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></small></td>
625
+ </tr>
626
+ <tr align="right">
627
+ <td colspan="2" class="submit">
628
+ <input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'nggallery');?>" />
629
+ &nbsp;
630
+ <input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php _e('Cancel', 'nggallery'); ?>&nbsp;" />
631
+ </td>
632
+ </tr>
633
+ </table>
634
+ </form>
635
+ </div>
636
+ <!-- /#new_thumbnail -->
637
+
638
+ <script type="text/javascript">
639
+ /* <![CDATA[ */
640
+ jQuery(document).ready(function(){columns.init('nggallery-manage-images');});
641
+ /* ]]> */
642
+ </script>
643
+ <?php
644
+ }
645
+
646
+ /**
647
+ * Construtor class to create the table layout
648
+ *
649
+ * @package WordPress
650
+ * @subpackage List_Table
651
+ * @since 1.8.0
652
+ * @access private
653
+ */
654
+ class _NGG_Images_List_Table extends WP_List_Table {
655
+ var $_screen;
656
+ var $_columns;
657
+
658
+ function _NGG_Images_List_Table( $screen ) {
659
+ if ( is_string( $screen ) )
660
+ $screen = convert_to_screen( $screen );
661
+
662
+ $this->_screen = $screen;
663
+ $this->_columns = array() ;
664
+
665
+ add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
666
+ }
667
+
668
+ function get_column_info() {
669
+
670
+ $columns = get_column_headers( $this->_screen );
671
+ $hidden = get_hidden_columns( $this->_screen );
672
+ $_sortable = $this->get_sortable_columns();
673
+ $sortable = array();
674
+
675
+ foreach ( $_sortable as $id => $data ) {
676
+ if ( empty( $data ) )
677
+ continue;
678
+
679
+ $data = (array) $data;
680
+ if ( !isset( $data[1] ) )
681
+ $data[1] = false;
682
+
683
+ $sortable[$id] = $data;
684
+ }
685
+
686
+ return array( $columns, $hidden, $sortable );
687
+ }
688
+
689
+ // define the columns to display, the syntax is 'internal name' => 'display name'
690
+ function get_columns() {
691
+ $columns = array();
692
+
693
+ $columns['cb'] = '<input name="checkall" type="checkbox" onclick="checkAll(document.getElementById(\'updategallery\'));" />';
694
+ $columns['id'] = __('ID');
695
+ $columns['thumbnail'] = __('Thumbnail', 'nggallery');
696
+ $columns['filename'] = __('Filename', 'nggallery');
697
+ $columns['alt_title_desc'] = __('Alt &amp; Title Text', 'nggallery') . ' / ' . __('Description', 'nggallery');
698
+ $columns['tags'] = __('Tags (comma separated list)', 'nggallery');
699
+ $columns['exclude'] = __('exclude', 'nggallery');
700
+
701
+ $columns = apply_filters('ngg_manage_images_columns', $columns);
702
+
703
+ return $columns;
704
+ }
705
+
706
+ function get_sortable_columns() {
707
+ return array();
708
+ }
709
+ }
710
+
711
  ?>
admin/manage-sort.php CHANGED
@@ -1,107 +1,107 @@
1
- <?php
2
-
3
- /**
4
- * @author Alex Rabe
5
- * @copyright 2008-2011
6
- */
7
-
8
- function nggallery_sortorder($galleryID = 0){
9
- global $wpdb, $ngg, $nggdb;
10
-
11
- if ($galleryID == 0) return;
12
-
13
- $galleryID = (int) $galleryID;
14
-
15
- if (isset ($_POST['updateSortorder'])) {
16
- check_admin_referer('ngg_updatesortorder');
17
- // get variable new sortorder
18
- parse_str($_POST['sortorder']);
19
- if (is_array($sortArray)){
20
- $neworder = array();
21
- foreach($sortArray as $pid) {
22
- $pid = substr($pid, 4); // get id from "pid-x"
23
- $neworder[] = (int) $pid;
24
- }
25
- $sortindex = 1;
26
- foreach($neworder as $pic_id) {
27
- $wpdb->query("UPDATE $wpdb->nggpictures SET sortorder = '$sortindex' WHERE pid = $pic_id");
28
- $sortindex++;
29
- }
30
-
31
- do_action('ngg_gallery_sort', $galleryID);
32
-
33
- nggGallery::show_message(__('Sort order changed','nggallery'));
34
- }
35
- }
36
-
37
- // look for presort args
38
- $presort = isset($_GET['presort']) ? $_GET['presort'] : false;
39
- $dir = ( isset($_GET['dir']) && $_GET['dir'] == 'DESC' ) ? 'DESC' : 'ASC';
40
- $sortitems = array('pid', 'filename', 'alttext', 'imagedate');
41
- // ensure that nobody added some evil sorting :-)
42
- if (in_array( $presort, $sortitems) )
43
- $picturelist = $nggdb->get_gallery($galleryID, $presort, $dir, false);
44
- else
45
- $picturelist = $nggdb->get_gallery($galleryID, 'sortorder', $dir, false);
46
-
47
- //this is the url without any presort variable
48
- $clean_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
49
- //if we go back , then the mode should be edit
50
- $back_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID;
51
-
52
- // In the case somebody presort, then we take this url
53
- if ( isset($_GET['dir']) || isset($_GET['presort']) )
54
- $base_url = $_SERVER['REQUEST_URI'];
55
- else
56
- $base_url = $clean_url;
57
-
58
- ?>
59
- <script type='text/javascript' src='<?php echo NGGALLERY_URLPATH ?>admin/js/sorter.js'></script>
60
- <div class="wrap">
61
- <form id="sortGallery" method="POST" action="<?php echo $clean_url ?>" onsubmit="saveImageOrder()" accept-charset="utf-8">
62
- <h2><?php _e('Sort Gallery', 'nggallery') ?></h2>
63
- <div class="tablenav">
64
- <div class="alignleft actions">
65
- <?php wp_nonce_field('ngg_updatesortorder') ?>
66
- <input class="button-primary action" type="submit" name="updateSortorder" onclick="saveImageOrder()" value="<?php _e('Update Sort Order', 'nggallery') ?>" />
67
- </div>
68
- <div class="alignright actions">
69
- <a href="<?php echo esc_url( $back_url ); ?>" class="button"><?php _e('Back to gallery', 'nggallery'); ?></a>
70
- </div>
71
- </div>
72
- <input name="sortorder" type="hidden" />
73
- <ul class="subsubsub">
74
- <li><?php _e('Presort', 'nggallery') ?> :</li>
75
- <li><a href="<?php echo esc_attr(remove_query_arg('presort', $base_url)); ?>" <?php if ($presort == '') echo 'class="current"'; ?>><?php _e('Unsorted', 'nggallery') ?></a> |</li>
76
- <li><a href="<?php echo esc_attr(add_query_arg('presort', 'pid', $base_url)); ?>" <?php if ($presort == 'pid') echo 'class="current"'; ?>><?php _e('Image ID', 'nggallery') ?></a> |</li>
77
- <li><a href="<?php echo esc_attr(add_query_arg('presort', 'filename', $base_url)); ?>" <?php if ($presort == 'filename') echo 'class="current"'; ?>><?php _e('Filename', 'nggallery') ?></a> |</li>
78
- <li><a href="<?php echo esc_attr(add_query_arg('presort', 'alttext', $base_url)); ?>" <?php if ($presort == 'alttext') echo 'class="current"'; ?>><?php _e('Alt/Title text', 'nggallery') ?></a> |</li>
79
- <li><a href="<?php echo esc_attr(add_query_arg('presort', 'imagedate', $base_url)); ?>" <?php if ($presort == 'imagedate') echo 'class="current"'; ?>><?php _e('Date/Time', 'nggallery') ?></a> |</li>
80
- <li><a href="<?php echo esc_attr(add_query_arg('dir', 'ASC', $base_url)); ?>" <?php if ($dir == 'ASC') echo 'class="current"'; ?>><?php _e('Ascending', 'nggallery') ?></a> |</li>
81
- <li><a href="<?php echo esc_attr(add_query_arg('dir', 'DESC', $base_url)); ?>" <?php if ($dir == 'DESC') echo 'class="current"'; ?>><?php _e('Descending', 'nggallery') ?></a></li>
82
- </ul>
83
- </form>
84
- <div id="debug" style="clear:both"></div>
85
- <?php
86
- if($picturelist) {
87
- foreach($picturelist as $picture) {
88
- ?>
89
- <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
90
- <div class="imageBox_theImage" style="background-image:url('<?php echo esc_url( $picture->thumbURL ); ?>')"></div>
91
- <div class="imageBox_label"><span><?php echo esc_html( stripslashes($picture->alttext) ); ?></span></div>
92
- </div>
93
- <?php
94
- }
95
- }
96
- ?>
97
- <div id="insertionMarker">
98
- <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_top.gif"/>
99
- <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_middle.gif" id="insertionMarkerLine"/>
100
- <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_bottom.gif"/>
101
- </div>
102
- <div id="dragDropContent"></div>
103
- </div>
104
-
105
- <?php
106
- }
107
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * @author Alex Rabe
5
+ *
6
+ */
7
+
8
+ function nggallery_sortorder($galleryID = 0){
9
+ global $wpdb, $ngg, $nggdb;
10
+
11
+ if ($galleryID == 0) return;
12
+
13
+ $galleryID = (int) $galleryID;
14
+
15
+ if (isset ($_POST['updateSortorder'])) {
16
+ check_admin_referer('ngg_updatesortorder');
17
+ // get variable new sortorder
18
+ parse_str($_POST['sortorder']);
19
+ if (is_array($sortArray)){
20
+ $neworder = array();
21
+ foreach($sortArray as $pid) {
22
+ $pid = substr($pid, 4); // get id from "pid-x"
23
+ $neworder[] = (int) $pid;
24
+ }
25
+ $sortindex = 1;
26
+ foreach($neworder as $pic_id) {
27
+ $wpdb->query("UPDATE $wpdb->nggpictures SET sortorder = '$sortindex' WHERE pid = $pic_id");
28
+ $sortindex++;
29
+ }
30
+
31
+ do_action('ngg_gallery_sort', $galleryID);
32
+
33
+ nggGallery::show_message(__('Sort order changed','nggallery'));
34
+ }
35
+ }
36
+
37
+ // look for presort args
38
+ $presort = isset($_GET['presort']) ? $_GET['presort'] : false;
39
+ $dir = ( isset($_GET['dir']) && $_GET['dir'] == 'DESC' ) ? 'DESC' : 'ASC';
40
+ $sortitems = array('pid', 'filename', 'alttext', 'imagedate');
41
+ // ensure that nobody added some evil sorting :-)
42
+ if (in_array( $presort, $sortitems) )
43
+ $picturelist = $nggdb->get_gallery($galleryID, $presort, $dir, false);
44
+ else
45
+ $picturelist = $nggdb->get_gallery($galleryID, 'sortorder', $dir, false);
46
+
47
+ //this is the url without any presort variable
48
+ $clean_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
49
+ //if we go back , then the mode should be edit
50
+ $back_url = 'admin.php?page=nggallery-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID;
51
+
52
+ // In the case somebody presort, then we take this url
53
+ if ( isset($_GET['dir']) || isset($_GET['presort']) )
54
+ $base_url = $_SERVER['REQUEST_URI'];
55
+ else
56
+ $base_url = $clean_url;
57
+
58
+ ?>
59
+ <script type='text/javascript' src='<?php echo NGGALLERY_URLPATH ?>admin/js/sorter.js'></script>
60
+ <div class="wrap">
61
+ <form id="sortGallery" method="POST" action="<?php echo $clean_url ?>" onsubmit="saveImageOrder()" accept-charset="utf-8">
62
+ <h2><?php _e('Sort Gallery', 'nggallery') ?></h2>
63
+ <div class="tablenav">
64
+ <div class="alignleft actions">
65
+ <?php wp_nonce_field('ngg_updatesortorder') ?>
66
+ <input class="button-primary action" type="submit" name="updateSortorder" onclick="saveImageOrder()" value="<?php _e('Update Sort Order', 'nggallery') ?>" />
67
+ </div>
68
+ <div class="alignright actions">
69
+ <a href="<?php echo esc_url( $back_url ); ?>" class="button"><?php _e('Back to gallery', 'nggallery'); ?></a>
70
+ </div>
71
+ </div>
72
+ <input name="sortorder" type="hidden" />
73
+ <ul class="subsubsub">
74
+ <li><?php _e('Presort', 'nggallery') ?> :</li>
75
+ <li><a href="<?php echo esc_attr(remove_query_arg('presort', $base_url)); ?>" <?php if ($presort == '') echo 'class="current"'; ?>><?php _e('Unsorted', 'nggallery') ?></a> |</li>
76
+ <li><a href="<?php echo esc_attr(add_query_arg('presort', 'pid', $base_url)); ?>" <?php if ($presort == 'pid') echo 'class="current"'; ?>><?php _e('Image ID', 'nggallery') ?></a> |</li>
77
+ <li><a href="<?php echo esc_attr(add_query_arg('presort', 'filename', $base_url)); ?>" <?php if ($presort == 'filename') echo 'class="current"'; ?>><?php _e('Filename', 'nggallery') ?></a> |</li>
78
+ <li><a href="<?php echo esc_attr(add_query_arg('presort', 'alttext', $base_url)); ?>" <?php if ($presort == 'alttext') echo 'class="current"'; ?>><?php _e('Alt/Title text', 'nggallery') ?></a> |</li>
79
+ <li><a href="<?php echo esc_attr(add_query_arg('presort', 'imagedate', $base_url)); ?>" <?php if ($presort == 'imagedate') echo 'class="current"'; ?>><?php _e('Date/Time', 'nggallery') ?></a> |</li>
80
+ <li><a href="<?php echo esc_attr(add_query_arg('dir', 'ASC', $base_url)); ?>" <?php if ($dir == 'ASC') echo 'class="current"'; ?>><?php _e('Ascending', 'nggallery') ?></a> |</li>
81
+ <li><a href="<?php echo esc_attr(add_query_arg('dir', 'DESC', $base_url)); ?>" <?php if ($dir == 'DESC') echo 'class="current"'; ?>><?php _e('Descending', 'nggallery') ?></a></li>
82
+ </ul>
83
+ </form>
84
+ <div id="debug" style="clear:both"></div>
85
+ <?php
86
+ if($picturelist) {
87
+ foreach($picturelist as $picture) {
88
+ ?>
89
+ <div class="imageBox" id="pid-<?php echo $picture->pid ?>">
90
+ <div class="imageBox_theImage" style="background-image:url('<?php echo esc_url( $picture->thumbURL ); ?>')"></div>
91
+ <div class="imageBox_label"><span><?php echo esc_html( stripslashes($picture->alttext) ); ?></span></div>
92
+ </div>
93
+ <?php
94
+ }
95
+ }
96
+ ?>
97
+ <div id="insertionMarker">
98
+ <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_top.gif"/>
99
+ <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_middle.gif" id="insertionMarkerLine"/>
100
+ <img src="<?php echo NGGALLERY_URLPATH ?>admin/images/marker_bottom.gif"/>
101
+ </div>
102
+ <div id="dragDropContent"></div>
103
+ </div>
104
+
105
+ <?php
106
+ }
107
+ ?>
admin/manage.php CHANGED
@@ -1,657 +1,657 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
-
5
- class nggManageGallery {
6
-
7
- var $mode = 'main';
8
- var $gid = false;
9
- var $pid = false;
10
- var $base_page = 'admin.php?page=nggallery-manage-gallery';
11
- var $search_result = false;
12
-
13
- // initiate the manage page
14
- function nggManageGallery() {
15
-
16
- // GET variables
17
- if( isset($_GET['gid']) )
18
- $this->gid = (int) $_GET['gid'];
19
- if( isset($_GET['pid']) )
20
- $this->pid = (int) $_GET['pid'];
21
- if( isset($_GET['mode']) )
22
- $this->mode = trim ($_GET['mode']);
23
- // Check for pagination request, avoid post process of other submit button, exclude search results
24
- if ( isset($_POST['post_paged']) && !isset($_GET['s'] ) ) {
25
- if ( $_GET['paged'] != $_POST['post_paged'] ) {
26
- $_GET['paged'] = absint( $_POST['post_paged'] );
27
- return;
28
- }
29
- }
30
- // Should be only called via manage galleries overview
31
- if ( isset($_POST['page']) && $_POST['page'] == 'manage-galleries' )
32
- $this->post_processor_galleries();
33
- // Should be only called via a edit single gallery page
34
- if ( isset($_POST['page']) && $_POST['page'] == 'manage-images' )
35
- $this->post_processor_images();
36
- // Should be called via a publish dialog
37
- if ( isset($_POST['page']) && $_POST['page'] == 'publish-post' )
38
- $this->publish_post();
39
- //Look for other POST process
40
- if ( !empty($_POST) || !empty($_GET) )
41
- $this->processor();
42
-
43
- }
44
-
45
- function controller() {
46
-
47
- switch($this->mode) {
48
- case 'sort':
49
- include_once (dirname (__FILE__) . '/manage-sort.php');
50
- nggallery_sortorder($this->gid);
51
- break;
52
- case 'edit':
53
- include_once (dirname (__FILE__) . '/manage-images.php');
54
- nggallery_picturelist();
55
- break;
56
- case 'main':
57
- default:
58
- include_once (dirname (__FILE__) . '/manage-galleries.php');
59
- nggallery_manage_gallery_main();
60
- break;
61
- }
62
- }
63
-
64
- function processor() {
65
-
66
- global $wpdb, $ngg, $nggdb;
67
-
68
- // Delete a picture
69
- if ($this->mode == 'delpic') {
70
-
71
- //TODO:Remove also Tag reference
72
- check_admin_referer('ngg_delpicture');
73
- $image = $nggdb->find_image( $this->pid );
74
- if ($image) {
75
- if ($ngg->options['deleteImg']) {
76
- @unlink($image->imagePath);
77
- @unlink($image->thumbPath);
78
- @unlink($image->imagePath . '_backup' );
79
- }
80
- do_action('ngg_delete_picture', $this->pid);
81
- $result = nggdb::delete_image ( $this->pid );
82
- }
83
-
84
- if ($result)
85
- nggGallery::show_message( __('Picture','nggallery').' \''.$this->pid.'\' '.__('deleted successfully','nggallery') );
86
-
87
- $this->mode = 'edit'; // show pictures
88
-
89
- }
90
-
91
- // Recover picture from backup
92
- if ($this->mode == 'recoverpic') {
93
-
94
- check_admin_referer('ngg_recoverpicture');
95
- $image = $nggdb->find_image( $this->pid );
96
- // bring back the old image
97
- nggAdmin::recover_image($image);
98
- nggAdmin::create_thumbnail($image);
99
-
100
- nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery"));
101
-
102
- $this->mode = 'edit'; // show pictures
103
-
104
- }
105
-
106
- // will be called after a ajax operation
107
- if (isset ($_POST['ajax_callback'])) {
108
- if ($_POST['ajax_callback'] == 1)
109
- nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery"));
110
- }
111
-
112
- // show sort order
113
- if ( isset ($_POST['sortGallery']) )
114
- $this->mode = 'sort';
115
-
116
- if ( isset ($_GET['s']) )
117
- $this->search_images();
118
-
119
- }
120
-
121
- function post_processor_galleries() {
122
- global $wpdb, $ngg, $nggdb;
123
-
124
- // bulk update in a single gallery
125
- if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
126
-
127
- check_admin_referer('ngg_bulkgallery');
128
-
129
- switch ($_POST['bulkaction']) {
130
- case 'no_action';
131
- // No action
132
- break;
133
- case 'recover_images':
134
- // Recover images from backup
135
- // A prefix 'gallery_' will first fetch all ids from the selected galleries
136
- nggAdmin::do_ajax_operation( 'gallery_recover_image' , $_POST['doaction'], __('Recover from backup','nggallery') );
137
- break;
138
- case 'set_watermark':
139
- // Set watermark
140
- // A prefix 'gallery_' will first fetch all ids from the selected galleries
141
- nggAdmin::do_ajax_operation( 'gallery_set_watermark' , $_POST['doaction'], __('Set watermark','nggallery') );
142
- break;
143
- case 'import_meta':
144
- // Import Metadata
145
- // A prefix 'gallery_' will first fetch all ids from the selected galleries
146
- nggAdmin::do_ajax_operation( 'gallery_import_metadata' , $_POST['doaction'], __('Import metadata','nggallery') );
147
- break;
148
- case 'delete_gallery':
149
- // Delete gallery
150
- if ( is_array($_POST['doaction']) ) {
151
- $deleted = false;
152
- foreach ( $_POST['doaction'] as $id ) {
153
- // get the path to the gallery
154
- $gallery = nggdb::find_gallery($id);
155
- if ($gallery){
156
- //TODO:Remove also Tag reference, look here for ids instead filename
157
- $imagelist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$gallery->gid' ");
158
- if ($ngg->options['deleteImg']) {
159
- if (is_array($imagelist)) {
160
- foreach ($imagelist as $filename) {
161
- @unlink(WINABSPATH . $gallery->path . '/thumbs/thumbs_' . $filename);
162
- @unlink(WINABSPATH . $gallery->path .'/'. $filename);
163
- @unlink(WINABSPATH . $gallery->path .'/'. $filename . '_backup');
164
- }
165
- }
166
- // delete folder
167
- @rmdir( WINABSPATH . $gallery->path . '/thumbs' );
168
- @rmdir( WINABSPATH . $gallery->path );
169
- }
170
- }
171
- do_action('ngg_delete_gallery', $id);
172
- $deleted = nggdb::delete_gallery( $id );
173
- }
174
-
175
- if($deleted)
176
- nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery'));
177
-
178
- }
179
- break;
180
- }
181
- }
182
-
183
- if (isset ($_POST['addgallery']) && isset ($_POST['galleryname'])){
184
-
185
- check_admin_referer('ngg_addgallery');
186
-
187
- if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
188
- wp_die(__('Cheatin&#8217; uh?'));
189
-
190
- // get the default path for a new gallery
191
- $defaultpath = $ngg->options['gallerypath'];
192
- $newgallery = esc_attr( $_POST['galleryname']);
193
- if ( !empty($newgallery) )
194
- nggAdmin::create_gallery($newgallery, $defaultpath);
195
-
196
- do_action( 'ngg_update_addgallery_page' );
197
- }
198
-
199
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_ResizeImages'])) {
200
-
201
- check_admin_referer('ngg_thickbox_form');
202
-
203
- //save the new values for the next operation
204
- $ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
205
- $ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
206
- // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
207
- update_option('ngg_options', $ngg->options);
208
-
209
- $gallery_ids = explode(',', $_POST['TB_imagelist']);
210
- // A prefix 'gallery_' will first fetch all ids from the selected galleries
211
- nggAdmin::do_ajax_operation( 'gallery_resize_image' , $gallery_ids, __('Resize images','nggallery') );
212
- }
213
-
214
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_NewThumbnail'])) {
215
-
216
- check_admin_referer('ngg_thickbox_form');
217
-
218
- //save the new values for the next operation
219
- $ngg->options['thumbwidth'] = (int) $_POST['thumbwidth'];
220
- $ngg->options['thumbheight'] = (int) $_POST['thumbheight'];
221
- $ngg->options['thumbfix'] = isset ($_POST['thumbfix']) ? true : false;
222
- // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
223
- update_option('ngg_options', $ngg->options);
224
-
225
- $gallery_ids = explode(',', $_POST['TB_imagelist']);
226
- // A prefix 'gallery_' will first fetch all ids from the selected galleries
227
- nggAdmin::do_ajax_operation( 'gallery_create_thumbnail' , $gallery_ids, __('Create new thumbnails','nggallery') );
228
- }
229
-
230
- }
231
-
232
- function post_processor_images() {
233
- global $wpdb, $ngg, $nggdb;
234
-
235
- // bulk update in a single gallery
236
- if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
237
-
238
- check_admin_referer('ngg_updategallery');
239
-
240
- switch ($_POST['bulkaction']) {
241
- case 'no_action';
242
- break;
243
- case 'rotate_cw':
244
- nggAdmin::do_ajax_operation( 'rotate_cw' , $_POST['doaction'], __('Rotate images', 'nggallery') );
245
- break;
246
- case 'rotate_ccw':
247
- nggAdmin::do_ajax_operation( 'rotate_ccw' , $_POST['doaction'], __('Rotate images', 'nggallery') );
248
- break;
249
- case 'recover_images':
250
- nggAdmin::do_ajax_operation( 'recover_image' , $_POST['doaction'], __('Recover from backup', 'nggallery') );
251
- break;
252
- case 'set_watermark':
253
- nggAdmin::do_ajax_operation( 'set_watermark' , $_POST['doaction'], __('Set watermark', 'nggallery') );
254
- break;
255
- case 'delete_images':
256
- if ( is_array($_POST['doaction']) ) {
257
- foreach ( $_POST['doaction'] as $imageID ) {
258
- $image = $nggdb->find_image( $imageID );
259
- if ($image) {
260
- if ($ngg->options['deleteImg']) {
261
- @unlink($image->imagePath);
262
- @unlink($image->thumbPath);
263
- @unlink($image->imagePath."_backup");
264
- }
265
- do_action('ngg_delete_picture', $image->pid);
266
- $delete_pic = nggdb::delete_image( $image->pid );
267
- }
268
- }
269
- if($delete_pic)
270
- nggGallery::show_message(__('Pictures deleted successfully ', 'nggallery'));
271
- }
272
- break;
273
- case 'import_meta':
274
- nggAdmin::do_ajax_operation( 'import_metadata' , $_POST['doaction'], __('Import metadata', 'nggallery') );
275
- break;
276
- }
277
- }
278
-
279
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_ResizeImages'])) {
280
-
281
- check_admin_referer('ngg_thickbox_form');
282
-
283
- //save the new values for the next operation
284
- $ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
285
- $ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
286
-
287
- update_option('ngg_options', $ngg->options);
288
-
289
- $pic_ids = explode(',', $_POST['TB_imagelist']);
290
- nggAdmin::do_ajax_operation( 'resize_image' , $pic_ids, __('Resize images','nggallery') );
291
- }
292
-
293
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_NewThumbnail'])) {
294
-
295
- check_admin_referer('ngg_thickbox_form');
296
-
297
- //save the new values for the next operation
298
- $ngg->options['thumbwidth'] = (int) $_POST['thumbwidth'];
299
- $ngg->options['thumbheight'] = (int) $_POST['thumbheight'];
300
- $ngg->options['thumbfix'] = isset ( $_POST['thumbfix'] ) ? true : false;
301
- update_option('ngg_options', $ngg->options);
302
-
303
- $pic_ids = explode(',', $_POST['TB_imagelist']);
304
- nggAdmin::do_ajax_operation( 'create_thumbnail' , $pic_ids, __('Create new thumbnails','nggallery') );
305
- }
306
-
307
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_SelectGallery'])) {
308
-
309
- check_admin_referer('ngg_thickbox_form');
310
-
311
- $pic_ids = explode(',', $_POST['TB_imagelist']);
312
- $dest_gid = (int) $_POST['dest_gid'];
313
-
314
- switch ($_POST['TB_bulkaction']) {
315
- case 'copy_to':
316
- // Copy images
317
- nggAdmin::copy_images( $pic_ids, $dest_gid );
318
- break;
319
- case 'move_to':
320
- // Move images
321
- nggAdmin::move_images( $pic_ids, $dest_gid );
322
- break;
323
- }
324
- }
325
-
326
- if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_EditTags'])) {
327
- // do tags update
328
-
329
- check_admin_referer('ngg_thickbox_form');
330
-
331
- // get the images list
332
- $pic_ids = explode(',', $_POST['TB_imagelist']);
333
- $taglist = explode(',', $_POST['taglist']);
334
- $taglist = array_map('trim', $taglist);
335
-
336
- if (is_array($pic_ids)) {
337
-
338
- foreach($pic_ids as $pic_id) {
339
-
340
- // which action should be performed ?
341
- switch ($_POST['TB_bulkaction']) {
342
- case 'no_action';
343
- // No action
344
- break;
345
- case 'overwrite_tags':
346
- // Overwrite tags
347
- wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
348
- break;
349
- case 'add_tags':
350
- // Add / append tags
351
- wp_set_object_terms($pic_id, $taglist, 'ngg_tag', TRUE);
352
- break;
353
- case 'delete_tags':
354
- // Delete tags
355
- $oldtags = wp_get_object_terms($pic_id, 'ngg_tag', 'fields=names');
356
- // get the slugs, to vaoid case sensitive problems
357
- $slugarray = array_map('sanitize_title', $taglist);
358
- $oldtags = array_map('sanitize_title', $oldtags);
359
- // compare them and return the diff
360
- $newtags = array_diff($oldtags, $slugarray);
361
- wp_set_object_terms($pic_id, $newtags, 'ngg_tag');
362
- break;
363
- }
364
- }
365
-
366
- nggGallery::show_message( __('Tags changed', 'nggallery') );
367
- }
368
- }
369
-
370
- if (isset ($_POST['updatepictures']) ) {
371
- // Update pictures
372
-
373
- check_admin_referer('ngg_updategallery');
374
-
375
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' ) && !isset ($_GET['s']) ) {
376
-
377
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery title' )) {
378
- // don't forget to update the slug
379
- $slug = nggdb::get_unique_slug( sanitize_title( $_POST['title'] ), 'gallery', $this->gid );
380
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET title= '%s', slug= '%s' WHERE gid = %d", esc_attr($_POST['title']), $slug, $this->gid) );
381
- }
382
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery path' ))
383
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET path= '%s' WHERE gid = %d", untrailingslashit ( str_replace('\\', '/', trim( stripslashes($_POST['path']) )) ), $this->gid ) );
384
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery description' ))
385
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET galdesc= '%s' WHERE gid = %d", esc_attr( $_POST['gallerydesc'] ), $this->gid) );
386
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery page id' ))
387
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET pageid= '%d' WHERE gid = %d", (int) $_POST['pageid'], $this->gid) );
388
- if ( nggGallery::current_user_can( 'NextGEN Edit gallery preview pic' ))
389
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET previewpic= '%d' WHERE gid = %d", (int) $_POST['previewpic'], $this->gid) );
390
- if ( isset ($_POST['author']) && nggGallery::current_user_can( 'NextGEN Edit gallery author' ) )
391
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET author= '%d' WHERE gid = %d", (int) $_POST['author'], $this->gid) );
392
-
393
- wp_cache_delete($this->gid, 'ngg_gallery');
394
-
395
- }
396
-
397
- $this->update_pictures();
398
-
399
- //hook for other plugin to update the fields
400
- do_action('ngg_update_gallery', $this->gid, $_POST);
401
-
402
- nggGallery::show_message(__('Update successful',"nggallery"));
403
- }
404
-
405
- if (isset ($_POST['scanfolder'])) {
406
- // Rescan folder
407
- check_admin_referer('ngg_updategallery');
408
-
409
- $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$this->gid' ");
410
- nggAdmin::import_gallery($gallerypath);
411
- }
412
-
413
- if (isset ($_POST['addnewpage'])) {
414
- // Add a new page
415
-
416
- check_admin_referer('ngg_updategallery');
417
-
418
- $parent_id = esc_attr($_POST['parent_id']);
419
- $gallery_title = esc_attr($_POST['title']);
420
- $gallery_name = $wpdb->get_var("SELECT name FROM $wpdb->nggallery WHERE gid = '$this->gid' ");
421
-
422
- // Create a WP page
423
- global $user_ID;
424
-
425
- $page['post_type'] = 'page';
426
- $page['post_content'] = '[nggallery id=' . $this->gid . ']';
427
- $page['post_parent'] = $parent_id;
428
- $page['post_author'] = $user_ID;
429
- $page['post_status'] = 'publish';
430
- $page['post_title'] = $gallery_title == '' ? $gallery_name : $gallery_title;
431
- $page = apply_filters('ngg_add_new_page', $page, $this->gid);
432
-
433
- $gallery_pageid = wp_insert_post ($page);
434
- if ($gallery_pageid != 0) {
435
- $result = $wpdb->query("UPDATE $wpdb->nggallery SET title= '$gallery_title', pageid = '$gallery_pageid' WHERE gid = '$this->gid'");
436
- wp_cache_delete($this->gid, 'ngg_gallery');
437
- nggGallery::show_message( __('New gallery page ID','nggallery'). ' ' . $gallery_pageid . ' -> <strong>' . $gallery_title . '</strong> ' .__('created','nggallery') );
438
- }
439
-
440
- do_action('ngg_gallery_addnewpage', $this->gid);
441
- }
442
- }
443
-
444
- /**
445
- * Publish a new post with the shortcode from the selected image
446
- *
447
- * @since 1.7.0
448
- * @return void
449
- */
450
- function publish_post() {
451
-
452
- check_admin_referer('publish-post');
453
-
454
- // Create a WP page
455
- global $user_ID, $ngg;
456
-
457
- $ngg->options['publish_width'] = (int) $_POST['width'];
458
- $ngg->options['publish_height'] = (int) $_POST['height'];
459
- $ngg->options['publish_align'] = $_POST['align'];
460
- $align = ( $ngg->options['publish_align'] == 'none') ? '' : 'float='.$ngg->options['publish_align'];
461
-
462
- //save the new values for the next operation
463
- update_option('ngg_options', $ngg->options);
464
-
465
- $post['post_type'] = 'post';
466
- $post['post_content'] = '[singlepic id=' . intval($_POST['pid']) . ' w=' . $ngg->options['publish_width'] . ' h=' . $ngg->options['publish_height'] . ' ' . $align . ']';
467
- $post['post_author'] = $user_ID;
468
- $post['post_status'] = isset ( $_POST['publish'] ) ? 'publish' : 'draft';
469
- $post['post_title'] = $_POST['post_title'];
470
- $post = apply_filters('ngg_add_new_post', $post, $_POST['pid']);
471
-
472
- $post_id = wp_insert_post ($post);
473
-
474
- if ($post_id != 0)
475
- nggGallery::show_message( __('Published a new post','nggallery') );
476
-
477
- }
478
-
479
- function update_pictures() {
480
- global $wpdb, $nggdb;
481
-
482
- //TODO:Error message when update failed
483
-
484
- $description = isset ( $_POST['description'] ) ? $_POST['description'] : array();
485
- $alttext = isset ( $_POST['alttext'] ) ? $_POST['alttext'] : array();
486
- $exclude = isset ( $_POST['exclude'] ) ? $_POST['exclude'] : false;
487
- $taglist = isset ( $_POST['tags'] ) ? $_POST['tags'] : false;
488
- $pictures = isset ( $_POST['pid'] ) ? $_POST['pid'] : false;
489
-
490
- if ( is_array($pictures) ){
491
- foreach( $pictures as $pid ){
492
- $image = $nggdb->find_image( $pid );
493
- if ($image) {
494
- // description field
495
- $image->description = $description[$image->pid];
496
-
497
- // only uptade this field if someone change the alttext
498
- if ( $image->alttext != $alttext[$image->pid] ) {
499
- $image->alttext = $alttext[$image->pid];
500
- $image->image_slug = nggdb::get_unique_slug( sanitize_title( $image->alttext ), 'image', $image->pid );
501
- }
502
-
503
- // set exclude flag
504
- if ( is_array($exclude) )
505
- $image->exclude = ( array_key_exists($image->pid, $exclude) )? 1 : 0;
506
- else
507
- $image->exclude = 0;
508
-
509
- // update the database
510
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug = '%s', alttext = '%s', description = '%s', exclude = %d WHERE pid = %d",
511
- $image->image_slug, $image->alttext, $image->description, $image->exclude, $image->pid) );
512
- // remove from cache
513
- wp_cache_delete($image->pid, 'ngg_image');
514
-
515
- // hook for other plugins after image is updated
516
- do_action('ngg_image_updated', $image);
517
- }
518
-
519
- }
520
- }
521
-
522
- //TODO: This produce 300-400 queries !
523
- if ( is_array($taglist) ){
524
- foreach($taglist as $key=>$value) {
525
- $tags = explode(',', $value);
526
- wp_set_object_terms($key, $tags, 'ngg_tag');
527
- }
528
- }
529
-
530
- return;
531
- }
532
-
533
- // Check if user can select a author
534
- function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
535
- global $wpdb;
536
-
537
- $user = new WP_User( $user_id );
538
-
539
- if ( ! $user->has_cap('NextGEN Manage others gallery') ) {
540
- if ( $user->has_cap('NextGEN Manage gallery') || $exclude_zeros == false )
541
- return array($user->id);
542
- else
543
- return false;
544
- }
545
-
546
- $level_key = $wpdb->prefix . 'user_level';
547
- $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
548
- if ( $exclude_zeros )
549
- $query .= " AND meta_value != '0'";
550
-
551
- return $wpdb->get_col( $query );
552
- }
553
-
554
- function search_images() {
555
- global $nggdb;
556
-
557
- if ( empty($_GET['s']) )
558
- return;
559
- //on what ever reason I need to set again the query var
560
- set_query_var('s', $_GET['s']);
561
- $request = get_search_query();
562
-
563
- // look now for the images
564
- $search_for_images = (array) $nggdb->search_for_images( $request );
565
- $search_for_tags = (array) nggTags::find_images_for_tags( $request , 'ASC' );
566
-
567
- // finally merge the two results together
568
- $this->search_result = array_merge( $search_for_images , $search_for_tags );
569
-
570
- // TODO: Currently we didn't support a proper pagination
571
- $nggdb->paged['total_objects'] = $nggdb->paged['objects_per_page'] = count ($this->search_result) ;
572
- $nggdb->paged['max_objects_per_page'] = 1;
573
-
574
- // show pictures page
575
- $this->mode = 'edit';
576
- }
577
-
578
- /**
579
- * Display the pagination.
580
- *
581
- * @since 1.8.0
582
- * @author taken from WP core (see includes/class-wp-list-table.php)
583
- * @return string echo the html pagination bar
584
- */
585
- function pagination( $which, $current, $total_items, $per_page ) {
586
-
587
- $total_pages = ($per_page > 0) ? ceil( $total_items / $per_page ) : 1;
588
-
589
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
590
-
591
- $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
592
-
593
- $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
594
-
595
- $page_links = array();
596
-
597
- $disable_first = $disable_last = '';
598
- if ( $current == 1 )
599
- $disable_first = ' disabled';
600
- if ( $current == $total_pages )
601
- $disable_last = ' disabled';
602
-
603
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
604
- 'first-page' . $disable_first,
605
- esc_attr__( 'Go to the first page' ),
606
- esc_url( remove_query_arg( 'paged', $current_url ) ),
607
- '&laquo;'
608
- );
609
-
610
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
611
- 'prev-page' . $disable_first,
612
- esc_attr__( 'Go to the previous page' ),
613
- esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
614
- '&lsaquo;'
615
- );
616
-
617
- if ( 'bottom' == $which )
618
- $html_current_page = $current;
619
- else
620
- $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />",
621
- esc_attr__( 'Current page' ),
622
- esc_attr( 'post_paged' ),
623
- $current,
624
- strlen( $total_pages )
625
- );
626
-
627
- $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
628
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
629
-
630
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
631
- 'next-page' . $disable_last,
632
- esc_attr__( 'Go to the next page' ),
633
- esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
634
- '&rsaquo;'
635
- );
636
-
637
- $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
638
- 'last-page' . $disable_last,
639
- esc_attr__( 'Go to the last page' ),
640
- esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
641
- '&raquo;'
642
- );
643
-
644
- $output .= "\n<span class='pagination-links'>" . join( "\n", $page_links ) . '</span>';
645
-
646
- if ( $total_pages )
647
- $page_class = $total_pages < 2 ? ' one-page' : '';
648
- else
649
- $page_class = ' no-pages';
650
-
651
- $pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
652
-
653
- echo $pagination;
654
- }
655
-
656
- }
657
  ?>
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ class nggManageGallery {
6
+
7
+ var $mode = 'main';
8
+ var $gid = false;
9
+ var $pid = false;
10
+ var $base_page = 'admin.php?page=nggallery-manage-gallery';
11
+ var $search_result = false;
12
+
13
+ // initiate the manage page
14
+ function nggManageGallery() {
15
+
16
+ // GET variables
17
+ if( isset($_GET['gid']) )
18
+ $this->gid = (int) $_GET['gid'];
19
+ if( isset($_GET['pid']) )
20
+ $this->pid = (int) $_GET['pid'];
21
+ if( isset($_GET['mode']) )
22
+ $this->mode = trim ($_GET['mode']);
23
+ // Check for pagination request, avoid post process of other submit button, exclude search results
24
+ if ( isset($_POST['post_paged']) && !isset($_GET['s'] ) ) {
25
+ if ( $_GET['paged'] != $_POST['post_paged'] ) {
26
+ $_GET['paged'] = absint( $_POST['post_paged'] );
27
+ return;
28
+ }
29
+ }
30
+ // Should be only called via manage galleries overview
31
+ if ( isset($_POST['page']) && $_POST['page'] == 'manage-galleries' )
32
+ $this->post_processor_galleries();
33
+ // Should be only called via a edit single gallery page
34
+ if ( isset($_POST['page']) && $_POST['page'] == 'manage-images' )
35
+ $this->post_processor_images();
36
+ // Should be called via a publish dialog
37
+ if ( isset($_POST['page']) && $_POST['page'] == 'publish-post' )
38
+ $this->publish_post();
39
+ //Look for other POST process
40
+ if ( !empty($_POST) || !empty($_GET) )
41
+ $this->processor();
42
+
43
+ }
44
+
45
+ function controller() {
46
+
47
+ switch($this->mode) {
48
+ case 'sort':
49
+ include_once (dirname (__FILE__) . '/manage-sort.php');
50
+ nggallery_sortorder($this->gid);
51
+ break;
52
+ case 'edit':
53
+ include_once (dirname (__FILE__) . '/manage-images.php');
54
+ nggallery_picturelist();
55
+ break;
56
+ case 'main':
57
+ default:
58
+ include_once (dirname (__FILE__) . '/manage-galleries.php');
59
+ nggallery_manage_gallery_main();
60
+ break;
61
+ }
62
+ }
63
+
64
+ function processor() {
65
+
66
+ global $wpdb, $ngg, $nggdb;
67
+
68
+ // Delete a picture
69
+ if ($this->mode == 'delpic') {
70
+
71
+ //TODO:Remove also Tag reference
72
+ check_admin_referer('ngg_delpicture');
73
+ $image = $nggdb->find_image( $this->pid );
74
+ if ($image) {
75
+ if ($ngg->options['deleteImg']) {
76
+ @unlink($image->imagePath);
77
+ @unlink($image->thumbPath);
78
+ @unlink($image->imagePath . '_backup' );
79
+ }
80
+ do_action('ngg_delete_picture', $this->pid);
81
+ $result = nggdb::delete_image ( $this->pid );
82
+ }
83
+
84
+ if ($result)
85
+ nggGallery::show_message( __('Picture','nggallery').' \''.$this->pid.'\' '.__('deleted successfully','nggallery') );
86
+
87
+ $this->mode = 'edit'; // show pictures
88
+
89
+ }
90
+
91
+ // Recover picture from backup
92
+ if ($this->mode == 'recoverpic') {
93
+
94
+ check_admin_referer('ngg_recoverpicture');
95
+ $image = $nggdb->find_image( $this->pid );
96
+ // bring back the old image
97
+ nggAdmin::recover_image($image);
98
+ nggAdmin::create_thumbnail($image);
99
+
100
+ nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery"));
101
+
102
+ $this->mode = 'edit'; // show pictures
103
+
104
+ }
105
+
106
+ // will be called after a ajax operation
107
+ if (isset ($_POST['ajax_callback'])) {
108
+ if ($_POST['ajax_callback'] == 1)
109
+ nggGallery::show_message(__('Operation successful. Please clear your browser cache.',"nggallery"));
110
+ }
111
+
112
+ // show sort order
113
+ if ( isset ($_POST['sortGallery']) )
114
+ $this->mode = 'sort';
115
+
116
+ if ( isset ($_GET['s']) )
117
+ $this->search_images();
118
+
119
+ }
120
+
121
+ function post_processor_galleries() {
122
+ global $wpdb, $ngg, $nggdb;
123
+
124
+ // bulk update in a single gallery
125
+ if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
126
+
127
+ check_admin_referer('ngg_bulkgallery');
128
+
129
+ switch ($_POST['bulkaction']) {
130
+ case 'no_action';
131
+ // No action
132
+ break;
133
+ case 'recover_images':
134
+ // Recover images from backup
135
+ // A prefix 'gallery_' will first fetch all ids from the selected galleries
136
+ nggAdmin::do_ajax_operation( 'gallery_recover_image' , $_POST['doaction'], __('Recover from backup','nggallery') );
137
+ break;
138
+ case 'set_watermark':
139
+ // Set watermark
140
+ // A prefix 'gallery_' will first fetch all ids from the selected galleries
141
+ nggAdmin::do_ajax_operation( 'gallery_set_watermark' , $_POST['doaction'], __('Set watermark','nggallery') );
142
+ break;
143
+ case 'import_meta':
144
+ // Import Metadata
145
+ // A prefix 'gallery_' will first fetch all ids from the selected galleries
146
+ nggAdmin::do_ajax_operation( 'gallery_import_metadata' , $_POST['doaction'], __('Import metadata','nggallery') );
147
+ break;
148
+ case 'delete_gallery':
149
+ // Delete gallery
150
+ if ( is_array($_POST['doaction']) ) {
151
+ $deleted = false;
152
+ foreach ( $_POST['doaction'] as $id ) {
153
+ // get the path to the gallery
154
+ $gallery = nggdb::find_gallery($id);
155
+ if ($gallery){
156
+ //TODO:Remove also Tag reference, look here for ids instead filename
157
+ $imagelist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$gallery->gid' ");
158
+ if ($ngg->options['deleteImg']) {
159
+ if (is_array($imagelist)) {
160
+ foreach ($imagelist as $filename) {
161
+ @unlink(WINABSPATH . $gallery->path . '/thumbs/thumbs_' . $filename);
162
+ @unlink(WINABSPATH . $gallery->path .'/'. $filename);
163
+ @unlink(WINABSPATH . $gallery->path .'/'. $filename . '_backup');
164
+ }
165
+ }
166
+ // delete folder
167
+ @rmdir( WINABSPATH . $gallery->path . '/thumbs' );
168
+ @rmdir( WINABSPATH . $gallery->path );
169
+ }
170
+ }
171
+ do_action('ngg_delete_gallery', $id);
172
+ $deleted = nggdb::delete_gallery( $id );
173
+ }
174
+
175
+ if($deleted)
176
+ nggGallery::show_message(__('Gallery deleted successfully ', 'nggallery'));
177
+
178
+ }
179
+ break;
180
+ }
181
+ }
182
+
183
+ if (isset ($_POST['addgallery']) && isset ($_POST['galleryname'])){
184
+
185
+ check_admin_referer('ngg_addgallery');
186
+
187
+ if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
188
+ wp_die(__('Cheatin&#8217; uh?'));
189
+
190
+ // get the default path for a new gallery
191
+ $defaultpath = $ngg->options['gallerypath'];
192
+ $newgallery = esc_attr( $_POST['galleryname']);
193
+ if ( !empty($newgallery) )
194
+ nggAdmin::create_gallery($newgallery, $defaultpath);
195
+
196
+ do_action( 'ngg_update_addgallery_page' );
197
+ }
198
+
199
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_ResizeImages'])) {
200
+
201
+ check_admin_referer('ngg_thickbox_form');
202
+
203
+ //save the new values for the next operation
204
+ $ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
205
+ $ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
206
+ // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
207
+ update_option('ngg_options', $ngg->options);
208
+
209
+ $gallery_ids = explode(',', $_POST['TB_imagelist']);
210
+ // A prefix 'gallery_' will first fetch all ids from the selected galleries
211
+ nggAdmin::do_ajax_operation( 'gallery_resize_image' , $gallery_ids, __('Resize images','nggallery') );
212
+ }
213
+
214
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_NewThumbnail'])) {
215
+
216
+ check_admin_referer('ngg_thickbox_form');
217
+
218
+ //save the new values for the next operation
219
+ $ngg->options['thumbwidth'] = (int) $_POST['thumbwidth'];
220
+ $ngg->options['thumbheight'] = (int) $_POST['thumbheight'];
221
+ $ngg->options['thumbfix'] = isset ($_POST['thumbfix']) ? true : false;
222
+ // What is in the case the user has no if cap 'NextGEN Change options' ? Check feedback
223
+ update_option('ngg_options', $ngg->options);
224
+
225
+ $gallery_ids = explode(',', $_POST['TB_imagelist']);
226
+ // A prefix 'gallery_' will first fetch all ids from the selected galleries
227
+ nggAdmin::do_ajax_operation( 'gallery_create_thumbnail' , $gallery_ids, __('Create new thumbnails','nggallery') );
228
+ }
229
+
230
+ }
231
+
232
+ function post_processor_images() {
233
+ global $wpdb, $ngg, $nggdb;
234
+
235
+ // bulk update in a single gallery
236
+ if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
237
+
238
+ check_admin_referer('ngg_updategallery');
239
+
240
+ switch ($_POST['bulkaction']) {
241
+ case 'no_action';
242
+ break;
243
+ case 'rotate_cw':
244
+ nggAdmin::do_ajax_operation( 'rotate_cw' , $_POST['doaction'], __('Rotate images', 'nggallery') );
245
+ break;
246
+ case 'rotate_ccw':
247
+ nggAdmin::do_ajax_operation( 'rotate_ccw' , $_POST['doaction'], __('Rotate images', 'nggallery') );
248
+ break;
249
+ case 'recover_images':
250
+ nggAdmin::do_ajax_operation( 'recover_image' , $_POST['doaction'], __('Recover from backup', 'nggallery') );
251
+ break;
252
+ case 'set_watermark':
253
+ nggAdmin::do_ajax_operation( 'set_watermark' , $_POST['doaction'], __('Set watermark', 'nggallery') );
254
+ break;
255
+ case 'delete_images':
256
+ if ( is_array($_POST['doaction']) ) {
257
+ foreach ( $_POST['doaction'] as $imageID ) {
258
+ $image = $nggdb->find_image( $imageID );
259
+ if ($image) {
260
+ if ($ngg->options['deleteImg']) {
261
+ @unlink($image->imagePath);
262
+ @unlink($image->thumbPath);
263
+ @unlink($image->imagePath."_backup");
264
+ }
265
+ do_action('ngg_delete_picture', $image->pid);
266
+ $delete_pic = nggdb::delete_image( $image->pid );
267
+ }
268
+ }
269
+ if($delete_pic)
270
+ nggGallery::show_message(__('Pictures deleted successfully ', 'nggallery'));
271
+ }
272
+ break;
273
+ case 'import_meta':
274
+ nggAdmin::do_ajax_operation( 'import_metadata' , $_POST['doaction'], __('Import metadata', 'nggallery') );
275
+ break;
276
+ }
277
+ }
278
+
279
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_ResizeImages'])) {
280
+
281
+ check_admin_referer('ngg_thickbox_form');
282
+
283
+ //save the new values for the next operation
284
+ $ngg->options['imgWidth'] = (int) $_POST['imgWidth'];
285
+ $ngg->options['imgHeight'] = (int) $_POST['imgHeight'];
286
+
287
+ update_option('ngg_options', $ngg->options);
288
+
289
+ $pic_ids = explode(',', $_POST['TB_imagelist']);
290
+ nggAdmin::do_ajax_operation( 'resize_image' , $pic_ids, __('Resize images','nggallery') );
291
+ }
292
+
293
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_NewThumbnail'])) {
294
+
295
+ check_admin_referer('ngg_thickbox_form');
296
+
297
+ //save the new values for the next operation
298
+ $ngg->options['thumbwidth'] = (int) $_POST['thumbwidth'];
299
+ $ngg->options['thumbheight'] = (int) $_POST['thumbheight'];
300
+ $ngg->options['thumbfix'] = isset ( $_POST['thumbfix'] ) ? true : false;
301
+ update_option('ngg_options', $ngg->options);
302
+
303
+ $pic_ids = explode(',', $_POST['TB_imagelist']);
304
+ nggAdmin::do_ajax_operation( 'create_thumbnail' , $pic_ids, __('Create new thumbnails','nggallery') );
305
+ }
306
+
307
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_SelectGallery'])) {
308
+
309
+ check_admin_referer('ngg_thickbox_form');
310
+
311
+ $pic_ids = explode(',', $_POST['TB_imagelist']);
312
+ $dest_gid = (int) $_POST['dest_gid'];
313
+
314
+ switch ($_POST['TB_bulkaction']) {
315
+ case 'copy_to':
316
+ // Copy images
317
+ nggAdmin::copy_images( $pic_ids, $dest_gid );
318
+ break;
319
+ case 'move_to':
320
+ // Move images
321
+ nggAdmin::move_images( $pic_ids, $dest_gid );
322
+ break;
323
+ }
324
+ }
325
+
326
+ if (isset ($_POST['TB_bulkaction']) && isset ($_POST['TB_EditTags'])) {
327
+ // do tags update
328
+
329
+ check_admin_referer('ngg_thickbox_form');
330
+
331
+ // get the images list
332
+ $pic_ids = explode(',', $_POST['TB_imagelist']);
333
+ $taglist = explode(',', $_POST['taglist']);
334
+ $taglist = array_map('trim', $taglist);
335
+
336
+ if (is_array($pic_ids)) {
337
+
338
+ foreach($pic_ids as $pic_id) {
339
+
340
+ // which action should be performed ?
341
+ switch ($_POST['TB_bulkaction']) {
342
+ case 'no_action';
343
+ // No action
344
+ break;
345
+ case 'overwrite_tags':
346
+ // Overwrite tags
347
+ wp_set_object_terms($pic_id, $taglist, 'ngg_tag');
348
+ break;
349
+ case 'add_tags':
350
+ // Add / append tags
351
+ wp_set_object_terms($pic_id, $taglist, 'ngg_tag', TRUE);
352
+ break;
353
+ case 'delete_tags':
354
+ // Delete tags
355
+ $oldtags = wp_get_object_terms($pic_id, 'ngg_tag', 'fields=names');
356
+ // get the slugs, to vaoid case sensitive problems
357
+ $slugarray = array_map('sanitize_title', $taglist);
358
+ $oldtags = array_map('sanitize_title', $oldtags);
359
+ // compare them and return the diff
360
+ $newtags = array_diff($oldtags, $slugarray);
361
+ wp_set_object_terms($pic_id, $newtags, 'ngg_tag');
362
+ break;
363
+ }
364
+ }
365
+
366
+ nggGallery::show_message( __('Tags changed', 'nggallery') );
367
+ }
368
+ }
369
+
370
+ if (isset ($_POST['updatepictures']) ) {
371
+ // Update pictures
372
+
373
+ check_admin_referer('ngg_updategallery');
374
+
375
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' ) && !isset ($_GET['s']) ) {
376
+
377
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery title' )) {
378
+ // don't forget to update the slug
379
+ $slug = nggdb::get_unique_slug( sanitize_title( $_POST['title'] ), 'gallery', $this->gid );
380
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET title= '%s', slug= '%s' WHERE gid = %d", esc_attr($_POST['title']), $slug, $this->gid) );
381
+ }
382
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery path' ))
383
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET path= '%s' WHERE gid = %d", untrailingslashit ( str_replace('\\', '/', trim( stripslashes($_POST['path']) )) ), $this->gid ) );
384
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery description' ))
385
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET galdesc= '%s' WHERE gid = %d", esc_attr( $_POST['gallerydesc'] ), $this->gid) );
386
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery page id' ))
387
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET pageid= '%d' WHERE gid = %d", (int) $_POST['pageid'], $this->gid) );
388
+ if ( nggGallery::current_user_can( 'NextGEN Edit gallery preview pic' ))
389
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET previewpic= '%d' WHERE gid = %d", (int) $_POST['previewpic'], $this->gid) );
390
+ if ( isset ($_POST['author']) && nggGallery::current_user_can( 'NextGEN Edit gallery author' ) )
391
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggallery SET author= '%d' WHERE gid = %d", (int) $_POST['author'], $this->gid) );
392
+
393
+ wp_cache_delete($this->gid, 'ngg_gallery');
394
+
395
+ }
396
+
397
+ $this->update_pictures();
398
+
399
+ //hook for other plugin to update the fields
400
+ do_action('ngg_update_gallery', $this->gid, $_POST);
401
+
402
+ nggGallery::show_message(__('Update successful',"nggallery"));
403
+ }
404
+
405
+ if (isset ($_POST['scanfolder'])) {
406
+ // Rescan folder
407
+ check_admin_referer('ngg_updategallery');
408
+
409
+ $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$this->gid' ");
410
+ nggAdmin::import_gallery($gallerypath);
411
+ }
412
+
413
+ if (isset ($_POST['addnewpage'])) {
414
+ // Add a new page
415
+
416
+ check_admin_referer('ngg_updategallery');
417
+
418
+ $parent_id = esc_attr($_POST['parent_id']);
419
+ $gallery_title = esc_attr($_POST['title']);
420
+ $gallery_name = $wpdb->get_var("SELECT name FROM $wpdb->nggallery WHERE gid = '$this->gid' ");
421
+
422
+ // Create a WP page
423
+ global $user_ID;
424
+
425
+ $page['post_type'] = 'page';
426
+ $page['post_content'] = '[nggallery id=' . $this->gid . ']';
427
+ $page['post_parent'] = $parent_id;
428
+ $page['post_author'] = $user_ID;
429
+ $page['post_status'] = 'publish';
430
+ $page['post_title'] = $gallery_title == '' ? $gallery_name : $gallery_title;
431
+ $page = apply_filters('ngg_add_new_page', $page, $this->gid);
432
+
433
+ $gallery_pageid = wp_insert_post ($page);
434
+ if ($gallery_pageid != 0) {
435
+ $result = $wpdb->query("UPDATE $wpdb->nggallery SET title= '$gallery_title', pageid = '$gallery_pageid' WHERE gid = '$this->gid'");
436
+ wp_cache_delete($this->gid, 'ngg_gallery');
437
+ nggGallery::show_message( __('New gallery page ID','nggallery'). ' ' . $gallery_pageid . ' -> <strong>' . $gallery_title . '</strong> ' .__('created','nggallery') );
438
+ }
439
+
440
+ do_action('ngg_gallery_addnewpage', $this->gid);
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Publish a new post with the shortcode from the selected image
446
+ *
447
+ * @since 1.7.0
448
+ * @return void
449
+ */
450
+ function publish_post() {
451
+
452
+ check_admin_referer('publish-post');
453
+
454
+ // Create a WP page
455
+ global $user_ID, $ngg;
456
+
457
+ $ngg->options['publish_width'] = (int) $_POST['width'];
458
+ $ngg->options['publish_height'] = (int) $_POST['height'];
459
+ $ngg->options['publish_align'] = $_POST['align'];
460
+ $align = ( $ngg->options['publish_align'] == 'none') ? '' : 'float='.$ngg->options['publish_align'];
461
+
462
+ //save the new values for the next operation
463
+ update_option('ngg_options', $ngg->options);
464
+
465
+ $post['post_type'] = 'post';
466
+ $post['post_content'] = '[singlepic id=' . intval($_POST['pid']) . ' w=' . $ngg->options['publish_width'] . ' h=' . $ngg->options['publish_height'] . ' ' . $align . ']';
467
+ $post['post_author'] = $user_ID;
468
+ $post['post_status'] = isset ( $_POST['publish'] ) ? 'publish' : 'draft';
469
+ $post['post_title'] = $_POST['post_title'];
470
+ $post = apply_filters('ngg_add_new_post', $post, $_POST['pid']);
471
+
472
+ $post_id = wp_insert_post ($post);
473
+
474
+ if ($post_id != 0)
475
+ nggGallery::show_message( __('Published a new post','nggallery') );
476
+
477
+ }
478
+
479
+ function update_pictures() {
480
+ global $wpdb, $nggdb;
481
+
482
+ //TODO:Error message when update failed
483
+
484
+ $description = isset ( $_POST['description'] ) ? $_POST['description'] : array();
485
+ $alttext = isset ( $_POST['alttext'] ) ? $_POST['alttext'] : array();
486
+ $exclude = isset ( $_POST['exclude'] ) ? $_POST['exclude'] : false;
487
+ $taglist = isset ( $_POST['tags'] ) ? $_POST['tags'] : false;
488
+ $pictures = isset ( $_POST['pid'] ) ? $_POST['pid'] : false;
489
+
490
+ if ( is_array($pictures) ){
491
+ foreach( $pictures as $pid ){
492
+ $image = $nggdb->find_image( $pid );
493
+ if ($image) {
494
+ // description field
495
+ $image->description = $description[$image->pid];
496
+
497
+ // only uptade this field if someone change the alttext
498
+ if ( $image->alttext != $alttext[$image->pid] ) {
499
+ $image->alttext = $alttext[$image->pid];
500
+ $image->image_slug = nggdb::get_unique_slug( sanitize_title( $image->alttext ), 'image', $image->pid );
501
+ }
502
+
503
+ // set exclude flag
504
+ if ( is_array($exclude) )
505
+ $image->exclude = ( array_key_exists($image->pid, $exclude) )? 1 : 0;
506
+ else
507
+ $image->exclude = 0;
508
+
509
+ // update the database
510
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug = '%s', alttext = '%s', description = '%s', exclude = %d WHERE pid = %d",
511
+ $image->image_slug, $image->alttext, $image->description, $image->exclude, $image->pid) );
512
+ // remove from cache
513
+ wp_cache_delete($image->pid, 'ngg_image');
514
+
515
+ // hook for other plugins after image is updated
516
+ do_action('ngg_image_updated', $image);
517
+ }
518
+
519
+ }
520
+ }
521
+
522
+ //TODO: This produce 300-400 queries !
523
+ if ( is_array($taglist) ){
524
+ foreach($taglist as $key=>$value) {
525
+ $tags = explode(',', $value);
526
+ wp_set_object_terms($key, $tags, 'ngg_tag');
527
+ }
528
+ }
529
+
530
+ return;
531
+ }
532
+
533
+ // Check if user can select a author
534
+ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
535
+ global $wpdb;
536
+
537
+ $user = new WP_User( $user_id );
538
+
539
+ if ( ! $user->has_cap('NextGEN Manage others gallery') ) {
540
+ if ( $user->has_cap('NextGEN Manage gallery') || $exclude_zeros == false )
541
+ return array($user->id);
542
+ else
543
+ return false;
544
+ }
545
+
546
+ $level_key = $wpdb->prefix . 'user_level';
547
+ $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
548
+ if ( $exclude_zeros )
549
+ $query .= " AND meta_value != '0'";
550
+
551
+ return $wpdb->get_col( $query );
552
+ }
553
+
554
+ function search_images() {
555
+ global $nggdb;
556
+
557
+ if ( empty($_GET['s']) )
558
+ return;
559
+ //on what ever reason I need to set again the query var
560
+ set_query_var('s', $_GET['s']);
561
+ $request = get_search_query();
562
+
563
+ // look now for the images
564
+ $search_for_images = (array) $nggdb->search_for_images( $request );
565
+ $search_for_tags = (array) nggTags::find_images_for_tags( $request , 'ASC' );
566
+
567
+ // finally merge the two results together
568
+ $this->search_result = array_merge( $search_for_images , $search_for_tags );
569
+
570
+ // TODO: Currently we didn't support a proper pagination
571
+ $nggdb->paged['total_objects'] = $nggdb->paged['objects_per_page'] = count ($this->search_result) ;
572
+ $nggdb->paged['max_objects_per_page'] = 1;
573
+
574
+ // show pictures page
575
+ $this->mode = 'edit';
576
+ }
577
+
578
+ /**
579
+ * Display the pagination.
580
+ *
581
+ * @since 1.8.0
582
+ * @author taken from WP core (see includes/class-wp-list-table.php)
583
+ * @return string echo the html pagination bar
584
+ */
585
+ function pagination( $which, $current, $total_items, $per_page ) {
586
+
587
+ $total_pages = ($per_page > 0) ? ceil( $total_items / $per_page ) : 1;
588
+
589
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
590
+
591
+ $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
592
+
593
+ $current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
594
+
595
+ $page_links = array();
596
+
597
+ $disable_first = $disable_last = '';
598
+ if ( $current == 1 )
599
+ $disable_first = ' disabled';
600
+ if ( $current == $total_pages )
601
+ $disable_last = ' disabled';
602
+
603
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
604
+ 'first-page' . $disable_first,
605
+ esc_attr__( 'Go to the first page' ),
606
+ esc_url( remove_query_arg( 'paged', $current_url ) ),
607
+ '&laquo;'
608
+ );
609
+
610
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
611
+ 'prev-page' . $disable_first,
612
+ esc_attr__( 'Go to the previous page' ),
613
+ esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
614
+ '&lsaquo;'
615
+ );
616
+
617
+ if ( 'bottom' == $which )
618
+ $html_current_page = $current;
619
+ else
620
+ $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='%s' value='%s' size='%d' />",
621
+ esc_attr__( 'Current page' ),
622
+ esc_attr( 'post_paged' ),
623
+ $current,
624
+ strlen( $total_pages )
625
+ );
626
+
627
+ $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
628
+ $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
629
+
630
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
631
+ 'next-page' . $disable_last,
632
+ esc_attr__( 'Go to the next page' ),
633
+ esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
634
+ '&rsaquo;'
635
+ );
636
+
637
+ $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
638
+ 'last-page' . $disable_last,
639
+ esc_attr__( 'Go to the last page' ),
640
+ esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
641
+ '&raquo;'
642
+ );
643
+
644
+ $output .= "\n<span class='pagination-links'>" . join( "\n", $page_links ) . '</span>';
645
+
646
+ if ( $total_pages )
647
+ $page_class = $total_pages < 2 ? ' one-page' : '';
648
+ else
649
+ $page_class = ' no-pages';
650
+
651
+ $pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
652
+
653
+ echo $pagination;
654
+ }
655
+
656
+ }
657
  ?>
admin/media-upload.php CHANGED
@@ -1,282 +1,282 @@
1
- <?php
2
-
3
- /**
4
- * @title Add action/filter for the upload tab
5
- * @author Alex Rabe
6
- * @copyright 2008-2011
7
- */
8
-
9
- function ngg_wp_upload_tabs ($tabs) {
10
-
11
- $newtab = array('nextgen' => __('NextGEN Gallery','nggallery'));
12
-
13
- return array_merge($tabs,$newtab);
14
- }
15
-
16
- add_filter('media_upload_tabs', 'ngg_wp_upload_tabs');
17
-
18
- function media_upload_nextgen() {
19
-
20
- // Not in use
21
- $errors = false;
22
-
23
- // Generate TinyMCE HTML output
24
- if ( isset($_POST['send']) ) {
25
- $keys = array_keys($_POST['send']);
26
- $send_id = (int) array_shift($keys);
27
- $image = $_POST['image'][$send_id];
28
- $alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES));
29
- $description = stripslashes (htmlspecialchars($image['description'], ENT_QUOTES));
30
-
31
- // here is no new line allowed
32
- $clean_description = preg_replace("/\n|\r\n|\r$/", " ", $description);
33
- $img = nggdb::find_image($send_id);
34
- $thumbcode = $img->get_thumbcode();
35
- $class="ngg-singlepic ngg-{$image['align']}";
36
-
37
- // Build output
38
- if ($image['size'] == "thumbnail")
39
- $html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />";
40
- // Wrap the link to the fullsize image around
41
- $html = "<a $thumbcode href='{$image['url']}' title='$clean_description'>$html</a>";
42
-
43
- if ($image['size'] == "full")
44
- $html = "<img src='{$image['url']}' alt='$alttext' class='$class' />";
45
-
46
- if ($image['size'] == "singlepic")
47
- $html = "[singlepic id=$send_id w=320 h=240 float={$image['align']}]";
48
-
49
- media_upload_nextgen_save_image();
50
-
51
- // Return it to TinyMCE
52
- return media_send_to_editor($html);
53
- }
54
-
55
- // Save button
56
- if ( isset($_POST['save']) ) {
57
- media_upload_nextgen_save_image();
58
- }
59
-
60
- return wp_iframe( 'media_upload_nextgen_form', $errors );
61
- }
62
-
63
- add_action('media_upload_nextgen', 'media_upload_nextgen');
64
-
65
- function media_upload_nextgen_save_image() {
66
-
67
- global $wpdb;
68
-
69
- check_admin_referer('ngg-media-form');
70
-
71
- if ( !empty($_POST['image']) ) foreach ( $_POST['image'] as $image_id => $image ) {
72
-
73
- // create a unique slug
74
- $image_slug = nggdb::get_unique_slug( sanitize_title( $image['alttext'] ), 'image' );
75
- $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug= '%s', alttext= '%s', description = '%s' WHERE pid = %d", $image_slug, $image['alttext'], $image['description'], $image_id));
76
- wp_cache_delete($image_id, 'ngg_image');
77
- }
78
- }
79
-
80
- function media_upload_nextgen_form($errors) {
81
-
82
- global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $ngg, $nggdb;
83
-
84
- media_upload_header();
85
-
86
- $post_id = intval($_REQUEST['post_id']);
87
- $galleryID = 0;
88
- $total = 1;
89
- $picarray = array();
90
-
91
- $form_action_url = site_url( "wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=nextgen&post_id=$post_id", 'admin');
92
-
93
- // Get number of images in gallery
94
- if ( isset($_REQUEST['select_gal']) ){
95
- $galleryID = (int) $_REQUEST['select_gal'];
96
- $total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$galleryID'");
97
- }
98
-
99
- // Build navigation
100
- $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0;
101
- if ( $_GET['paged'] < 1 )
102
- $_GET['paged'] = 1;
103
- $start = ( $_GET['paged'] - 1 ) * 10;
104
- if ( $start < 1 )
105
- $start = 0;
106
-
107
- // Get the images
108
- if ( $galleryID != 0 )
109
- $picarray = $wpdb->get_col("SELECT pid FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude != 1 ORDER BY {$ngg->options['galSort']} {$ngg->options['galSortDir']} LIMIT $start, 10 ");
110
-
111
- // WP-Core code for Post-thumbnail
112
- $calling_post_id = 0;
113
- if ( isset( $_GET['post_id'] ) )
114
- $calling_post_id = $_GET['post_id'];
115
-
116
- ?>
117
-
118
- <script type="text/javascript">
119
- <!--
120
- function NGGSetAsThumbnail(id){
121
- var $link = jQuery('a#ngg-post-thumbnail-' + id);
122
-
123
- $link.text( setPostThumbnailL10n.saving );
124
- jQuery.post(ajaxurl, {
125
- action:"ngg_set_post_thumbnail", post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
126
- }, function(str){
127
- var win = window.dialogArguments || opener || parent || top;
128
- $link.text( setPostThumbnailL10n.setThumbnail );
129
- if ( str == '0' ) {
130
- alert( setPostThumbnailL10n.error );
131
- } else {
132
- jQuery('a.ngg-post-thumbnail').show();
133
- $link.text( setPostThumbnailL10n.done );
134
- $link.fadeOut( 2000 );
135
- // set some id as meta input filed
136
- win.WPSetThumbnailID('ngg-' + id);
137
- // replace the meta box with the image
138
- win.WPSetThumbnailHTML(str);
139
- }
140
- }
141
- );
142
- }
143
- //-->
144
- </script>
145
-
146
- <form id="filter" action="" method="get">
147
- <input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
148
- <input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
149
- <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
150
-
151
- <div class="tablenav">
152
- <?php
153
- $page_links = paginate_links( array(
154
- 'base' => add_query_arg( 'paged', '%#%' ),
155
- 'format' => '',
156
- 'total' => ceil($total / 10),
157
- 'current' => $_GET['paged']
158
- ));
159
-
160
- if ( $page_links )
161
- echo "<div class='tablenav-pages'>$page_links</div>";
162
- ?>
163
-
164
- <div class="alignleft actions">
165
- <select id="select_gal" name="select_gal" style="width:120px;">;
166
- <option value="0" <?php selected('0', $galleryID); ?> ><?php esc_attr( _e('No gallery',"nggallery") ); ?></option>
167
- <?php
168
- // Show gallery selection
169
- $gallerylist = $nggdb->find_all_galleries();
170
- if(is_array($gallerylist)) {
171
- foreach($gallerylist as $gallery) {
172
- $selected = ($gallery->gid == $galleryID )? ' selected="selected"' : "";
173
- echo '<option value="'.$gallery->gid.'"'.$selected.' >'.$gallery->title.'</option>'."\n";
174
- }
175
- }
176
- ?>
177
- </select>
178
- <input type="submit" id="show-gallery" value="<?php esc_attr( _e('Select &#187;','nggallery') ); ?>" class="button-secondary" />
179
- </div>
180
- <br style="clear:both;" />
181
- </div>
182
- </form>
183
-
184
- <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form" id="library-form">
185
-
186
- <?php wp_nonce_field('ngg-media-form'); ?>
187
-
188
- <script type="text/javascript">
189
- <!--
190
- jQuery(function($){
191
- var preloaded = $(".media-item.preloaded");
192
- if ( preloaded.length > 0 ) {
193
- preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
194
- updateMediaForm();
195
- }
196
- });
197
- -->
198
- </script>
199
-
200
- <div id="media-items">
201
- <?php
202
- if( is_array($picarray) ) {
203
- foreach ($picarray as $picid) {
204
- //TODO:Reduce SQL Queries
205
- $picture = nggdb::find_image($picid);
206
- ?>
207
- <div id='media-item-<?php echo $picid ?>' class='media-item preloaded'>
208
- <div class='filename'></div>
209
- <a class='toggle describe-toggle-on' href='#'><?php esc_attr( _e('Show', "nggallery") ); ?></a>
210
- <a class='toggle describe-toggle-off' href='#'><?php esc_attr( _e('Hide', "nggallery") );?></a>
211
- <div class='filename new'><?php echo ( empty($picture->alttext) ) ? wp_html_excerpt( esc_html( $picture->filename ),60) : stripslashes( wp_html_excerpt( esc_html( $picture->alttext ),60) ); ?></div>
212
- <table class='slidetoggle describe startclosed'><tbody>
213
- <tr>
214
- <td rowspan='4'><img class='thumbnail' alt='<?php echo esc_attr( $picture->alttext ); ?>' src='<?php echo esc_attr( $picture->thumbURL ); ?>'/></td>
215
- <td><?php esc_html( _e('Image ID:', "nggallery") ); ?><?php echo $picid ?></td>
216
- </tr>
217
- <tr><td><?php echo esc_html( $picture->filename ); ?></td></tr>
218
- <tr><td><?php echo esc_html( stripslashes($picture->alttext) ); ?></td></tr>
219
- <tr><td>&nbsp;</td></tr>
220
- <tr>
221
- <td class="label"><label for="image[<?php echo $picid ?>][alttext]"><?php esc_attr_e('Alt/Title text', "nggallery") ;?></label></td>
222
- <td class="field"><input id="image[<?php echo $picid ?>][alttext]" name="image[<?php echo $picid ?>][alttext]" value="<?php esc_attr_e( stripslashes($picture->alttext) ); ?>" type="text"/></td>
223
- </tr>
224
- <tr>
225
- <td class="label"><label for="image[<?php echo $picid ?>][description]"><?php esc_attr_e("Description","nggallery") ; ?></label></td>
226
- <td class="field"><textarea name="image[<?php echo $picid ?>][description]" id="image[<?php echo $picid ?>][description]"><?php esc_attr_e( stripslashes($picture->description) ); ?></textarea></td>
227
- </tr>
228
- <tr class="align">
229
- <td class="label"><label for="image[<?php echo $picid ?>][align]"><?php esc_attr_e("Alignment"); ?></label></td>
230
- <td class="field">
231
- <input name="image[<?php echo $picid ?>][align]" id="image-align-none-<?php echo $picid ?>" checked="checked" value="none" type="radio" />
232
- <label for="image-align-none-<?php echo $picid ?>" class="align image-align-none-label"><?php esc_attr_e("None") ;?></label>
233
- <input name="image[<?php echo $picid ?>][align]" id="image-align-left-<?php echo $picid ?>" value="left" type="radio" />
234
- <label for="image-align-left-<?php echo $picid ?>" class="align image-align-left-label"><?php esc_attr_e("Left") ;?></label>
235
- <input name="image[<?php echo $picid ?>][align]" id="image-align-center-<?php echo $picid ?>" value="center" type="radio" />
236
- <label for="image-align-center-<?php echo $picid ?>" class="align image-align-center-label"><?php esc_attr_e("Center") ;?></label>
237
- <input name="image[<?php echo $picid ?>][align]" id="image-align-right-<?php echo $picid ?>" value="right" type="radio" />
238
- <label for="image-align-right-<?php echo $picid ?>" class="align image-align-right-label"><?php esc_attr_e("Right") ;?></label>
239
- </td>
240
- </tr>
241
- <tr class="image-size">
242
- <th class="label"><label for="image[<?php echo $picid ?>][size]"><span class="alignleft"><?php esc_attr_e("Size") ; ?></span></label>
243
- </th>
244
- <td class="field">
245
- <input name="image[<?php echo $picid ?>][size]" id="image-size-thumb-<?php echo $picid ?>" type="radio" checked="checked" value="thumbnail" />
246
- <label for="image-size-thumb-<?php echo $picid ?>"><?php esc_attr_e("Thumbnail") ; ?></label>
247
- <input name="image[<?php echo $picid ?>][size]" id="image-size-full-<?php echo $picid ?>" type="radio" value="full" />
248
- <label for="image-size-full-<?php echo $picid ?>"><?php esc_attr_e("Full size") ; ?></label>
249
- <input name="image[<?php echo $picid ?>][size]" id="image-size-singlepic-<?php echo $picid ?>" type="radio" value="singlepic" />
250
- <label for="image-size-singlepic-<?php echo $picid ?>"><?php esc_attr_e("Singlepic", "nggallery") ; ?></label>
251
- </td>
252
- </tr>
253
- <tr class="submit">
254
- <td>
255
- <input type="hidden" name="image[<?php echo $picid ?>][thumb]" value="<?php echo esc_attr( $picture->thumbURL ); ?>" />
256
- <input type="hidden" name="image[<?php echo $picid ?>][url]" value="<?php echo esc_attr( $picture->imageURL ); ?>" />
257
- </td>
258
- <td class="savesend">
259
- <?php
260
- if ( $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) )
261
- echo "<a class='ngg-post-thumbnail' id='ngg-post-thumbnail-" . $picid . "' href='#' onclick='NGGSetAsThumbnail(\"$picid\");return false;'>" . esc_html__( 'Use as featured image' ) . "</a>";
262
- ?>
263
- <button type="submit" class="button" value="1" name="send[<?php echo $picid ?>]"><?php esc_html_e( 'Insert into Post' ); ?></button>
264
- </td>
265
- </tr>
266
- </tbody></table>
267
- </div>
268
- <?php
269
- }
270
- }
271
- ?>
272
- </div>
273
- <p class="ml-submit">
274
- <input type="submit" class="button savebutton" name="save" value="<?php esc_attr( _e('Save all changes','nggallery') ); ?>" />
275
- </p>
276
- <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
277
- <input type="hidden" name="select_gal" id="select_gal" value="<?php echo (int) $galleryID; ?>" />
278
- </form>
279
-
280
- <?php
281
- }
282
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * @title Add action/filter for the upload tab
5
+ * @author Alex Rabe
6
+ *
7
+ */
8
+
9
+ function ngg_wp_upload_tabs ($tabs) {
10
+
11
+ $newtab = array('nextgen' => __('NextGEN Gallery','nggallery'));
12
+
13
+ return array_merge($tabs,$newtab);
14
+ }
15
+
16
+ add_filter('media_upload_tabs', 'ngg_wp_upload_tabs');
17
+
18
+ function media_upload_nextgen() {
19
+
20
+ // Not in use
21
+ $errors = false;
22
+
23
+ // Generate TinyMCE HTML output
24
+ if ( isset($_POST['send']) ) {
25
+ $keys = array_keys($_POST['send']);
26
+ $send_id = (int) array_shift($keys);
27
+ $image = $_POST['image'][$send_id];
28
+ $alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES));
29
+ $description = stripslashes (htmlspecialchars($image['description'], ENT_QUOTES));
30
+
31
+ // here is no new line allowed
32
+ $clean_description = preg_replace("/\n|\r\n|\r$/", " ", $description);
33
+ $img = nggdb::find_image($send_id);
34
+ $thumbcode = $img->get_thumbcode();
35
+ $class="ngg-singlepic ngg-{$image['align']}";
36
+
37
+ // Build output
38
+ if ($image['size'] == "thumbnail")
39
+ $html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />";
40
+ // Wrap the link to the fullsize image around
41
+ $html = "<a $thumbcode href='{$image['url']}' title='$clean_description'>$html</a>";
42
+
43
+ if ($image['size'] == "full")
44
+ $html = "<img src='{$image['url']}' alt='$alttext' class='$class' />";
45
+
46
+ if ($image['size'] == "singlepic")
47
+ $html = "[singlepic id=$send_id w=320 h=240 float={$image['align']}]";
48
+
49
+ media_upload_nextgen_save_image();
50
+
51
+ // Return it to TinyMCE
52
+ return media_send_to_editor($html);
53
+ }
54
+
55
+ // Save button
56
+ if ( isset($_POST['save']) ) {
57
+ media_upload_nextgen_save_image();
58
+ }
59
+
60
+ return wp_iframe( 'media_upload_nextgen_form', $errors );
61
+ }
62
+
63
+ add_action('media_upload_nextgen', 'media_upload_nextgen');
64
+
65
+ function media_upload_nextgen_save_image() {
66
+
67
+ global $wpdb;
68
+
69
+ check_admin_referer('ngg-media-form');
70
+
71
+ if ( !empty($_POST['image']) ) foreach ( $_POST['image'] as $image_id => $image ) {
72
+
73
+ // create a unique slug
74
+ $image_slug = nggdb::get_unique_slug( sanitize_title( $image['alttext'] ), 'image' );
75
+ $wpdb->query( $wpdb->prepare ("UPDATE $wpdb->nggpictures SET image_slug= '%s', alttext= '%s', description = '%s' WHERE pid = %d", $image_slug, $image['alttext'], $image['description'], $image_id));
76
+ wp_cache_delete($image_id, 'ngg_image');
77
+ }
78
+ }
79
+
80
+ function media_upload_nextgen_form($errors) {
81
+
82
+ global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types, $ngg, $nggdb;
83
+
84
+ media_upload_header();
85
+
86
+ $post_id = intval($_REQUEST['post_id']);
87
+ $galleryID = 0;
88
+ $total = 1;
89
+ $picarray = array();
90
+
91
+ $form_action_url = site_url( "wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=nextgen&post_id=$post_id", 'admin');
92
+
93
+ // Get number of images in gallery
94
+ if ( isset($_REQUEST['select_gal']) ){
95
+ $galleryID = (int) $_REQUEST['select_gal'];
96
+ $total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$galleryID'");
97
+ }
98
+
99
+ // Build navigation
100
+ $_GET['paged'] = isset($_GET['paged']) ? intval($_GET['paged']) : 0;
101
+ if ( $_GET['paged'] < 1 )
102
+ $_GET['paged'] = 1;
103
+ $start = ( $_GET['paged'] - 1 ) * 10;
104
+ if ( $start < 1 )
105
+ $start = 0;
106
+
107
+ // Get the images
108
+ if ( $galleryID != 0 )
109
+ $picarray = $wpdb->get_col("SELECT pid FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude != 1 ORDER BY {$ngg->options['galSort']} {$ngg->options['galSortDir']} LIMIT $start, 10 ");
110
+
111
+ // WP-Core code for Post-thumbnail
112
+ $calling_post_id = 0;
113
+ if ( isset( $_GET['post_id'] ) )
114
+ $calling_post_id = $_GET['post_id'];
115
+
116
+ ?>
117
+
118
+ <script type="text/javascript">
119
+ <!--
120
+ function NGGSetAsThumbnail(id){
121
+ var $link = jQuery('a#ngg-post-thumbnail-' + id);
122
+
123
+ $link.text( setPostThumbnailL10n.saving );
124
+ jQuery.post(ajaxurl, {
125
+ action:"ngg_set_post_thumbnail", post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
126
+ }, function(str){
127
+ var win = window.dialogArguments || opener || parent || top;
128
+ $link.text( setPostThumbnailL10n.setThumbnail );
129
+ if ( str == '0' ) {
130
+ alert( setPostThumbnailL10n.error );
131
+ } else {
132
+ jQuery('a.ngg-post-thumbnail').show();
133
+ $link.text( setPostThumbnailL10n.done );
134
+ $link.fadeOut( 2000 );
135
+ // set some id as meta input filed
136
+ win.WPSetThumbnailID('ngg-' + id);
137
+ // replace the meta box with the image
138
+ win.WPSetThumbnailHTML(str);
139
+ }
140
+ }
141
+ );
142
+ }
143
+ //-->
144
+ </script>
145
+
146
+ <form id="filter" action="" method="get">
147
+ <input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
148
+ <input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
149
+ <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
150
+
151
+ <div class="tablenav">
152
+ <?php
153
+ $page_links = paginate_links( array(
154
+ 'base' => add_query_arg( 'paged', '%#%' ),
155
+ 'format' => '',
156
+ 'total' => ceil($total / 10),
157
+ 'current' => $_GET['paged']
158
+ ));
159
+
160
+ if ( $page_links )
161
+ echo "<div class='tablenav-pages'>$page_links</div>";
162
+ ?>
163
+
164
+ <div class="alignleft actions">
165
+ <select id="select_gal" name="select_gal" style="width:120px;">;
166
+ <option value="0" <?php selected('0', $galleryID); ?> ><?php esc_attr( _e('No gallery',"nggallery") ); ?></option>
167
+ <?php
168
+ // Show gallery selection
169
+ $gallerylist = $nggdb->find_all_galleries();
170
+ if(is_array($gallerylist)) {
171
+ foreach($gallerylist as $gallery) {
172
+ $selected = ($gallery->gid == $galleryID )? ' selected="selected"' : "";
173
+ echo '<option value="'.$gallery->gid.'"'.$selected.' >'.$gallery->title.'</option>'."\n";
174
+ }
175
+ }
176
+ ?>
177
+ </select>
178
+ <input type="submit" id="show-gallery" value="<?php esc_attr( _e('Select &#187;','nggallery') ); ?>" class="button-secondary" />
179
+ </div>
180
+ <br style="clear:both;" />
181
+ </div>
182
+ </form>
183
+
184
+ <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form" id="library-form">
185
+
186
+ <?php wp_nonce_field('ngg-media-form'); ?>
187
+
188
+ <script type="text/javascript">
189
+ <!--
190
+ jQuery(function($){
191
+ var preloaded = $(".media-item.preloaded");
192
+ if ( preloaded.length > 0 ) {
193
+ preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
194
+ updateMediaForm();
195
+ }
196
+ });
197
+ -->
198
+ </script>
199
+
200
+ <div id="media-items">
201
+ <?php
202
+ if( is_array($picarray) ) {
203
+ foreach ($picarray as $picid) {
204
+ //TODO:Reduce SQL Queries
205
+ $picture = nggdb::find_image($picid);
206
+ ?>
207
+ <div id='media-item-<?php echo $picid ?>' class='media-item preloaded'>
208
+ <div class='filename'></div>
209
+ <a class='toggle describe-toggle-on' href='#'><?php esc_attr( _e('Show', "nggallery") ); ?></a>
210
+ <a class='toggle describe-toggle-off' href='#'><?php esc_attr( _e('Hide', "nggallery") );?></a>
211
+ <div class='filename new'><?php echo ( empty($picture->alttext) ) ? wp_html_excerpt( esc_html( $picture->filename ),60) : stripslashes( wp_html_excerpt( esc_html( $picture->alttext ),60) ); ?></div>
212
+ <table class='slidetoggle describe startclosed'><tbody>
213
+ <tr>
214
+ <td rowspan='4'><img class='thumbnail' alt='<?php echo esc_attr( $picture->alttext ); ?>' src='<?php echo esc_attr( $picture->thumbURL ); ?>'/></td>
215
+ <td><?php esc_html( _e('Image ID:', "nggallery") ); ?><?php echo $picid ?></td>
216
+ </tr>
217
+ <tr><td><?php echo esc_html( $picture->filename ); ?></td></tr>
218
+ <tr><td><?php echo esc_html( stripslashes($picture->alttext) ); ?></td></tr>
219
+ <tr><td>&nbsp;</td></tr>
220
+ <tr>
221
+ <td class="label"><label for="image[<?php echo $picid ?>][alttext]"><?php esc_attr_e('Alt/Title text', "nggallery") ;?></label></td>
222
+ <td class="field"><input id="image[<?php echo $picid ?>][alttext]" name="image[<?php echo $picid ?>][alttext]" value="<?php esc_attr_e( stripslashes($picture->alttext) ); ?>" type="text"/></td>
223
+ </tr>
224
+ <tr>
225
+ <td class="label"><label for="image[<?php echo $picid ?>][description]"><?php esc_attr_e("Description","nggallery") ; ?></label></td>
226
+ <td class="field"><textarea name="image[<?php echo $picid ?>][description]" id="image[<?php echo $picid ?>][description]"><?php esc_attr_e( stripslashes($picture->description) ); ?></textarea></td>
227
+ </tr>
228
+ <tr class="align">
229
+ <td class="label"><label for="image[<?php echo $picid ?>][align]"><?php esc_attr_e("Alignment"); ?></label></td>
230
+ <td class="field">
231
+ <input name="image[<?php echo $picid ?>][align]" id="image-align-none-<?php echo $picid ?>" checked="checked" value="none" type="radio" />
232
+ <label for="image-align-none-<?php echo $picid ?>" class="align image-align-none-label"><?php esc_attr_e("None") ;?></label>
233
+ <input name="image[<?php echo $picid ?>][align]" id="image-align-left-<?php echo $picid ?>" value="left" type="radio" />
234
+ <label for="image-align-left-<?php echo $picid ?>" class="align image-align-left-label"><?php esc_attr_e("Left") ;?></label>
235
+ <input name="image[<?php echo $picid ?>][align]" id="image-align-center-<?php echo $picid ?>" value="center" type="radio" />
236
+ <label for="image-align-center-<?php echo $picid ?>" class="align image-align-center-label"><?php esc_attr_e("Center") ;?></label>
237
+ <input name="image[<?php echo $picid ?>][align]" id="image-align-right-<?php echo $picid ?>" value="right" type="radio" />
238
+ <label for="image-align-right-<?php echo $picid ?>" class="align image-align-right-label"><?php esc_attr_e("Right") ;?></label>
239
+ </td>
240
+ </tr>
241
+ <tr class="image-size">
242
+ <th class="label"><label for="image[<?php echo $picid ?>][size]"><span class="alignleft"><?php esc_attr_e("Size") ; ?></span></label>
243
+ </th>
244
+ <td class="field">
245
+ <input name="image[<?php echo $picid ?>][size]" id="image-size-thumb-<?php echo $picid ?>" type="radio" checked="checked" value="thumbnail" />
246
+ <label for="image-size-thumb-<?php echo $picid ?>"><?php esc_attr_e("Thumbnail") ; ?></label>
247
+ <input name="image[<?php echo $picid ?>][size]" id="image-size-full-<?php echo $picid ?>" type="radio" value="full" />
248
+ <label for="image-size-full-<?php echo $picid ?>"><?php esc_attr_e("Full size") ; ?></label>
249
+ <input name="image[<?php echo $picid ?>][size]" id="image-size-singlepic-<?php echo $picid ?>" type="radio" value="singlepic" />
250
+ <label for="image-size-singlepic-<?php echo $picid ?>"><?php esc_attr_e("Singlepic", "nggallery") ; ?></label>
251
+ </td>
252
+ </tr>
253
+ <tr class="submit">
254
+ <td>
255
+ <input type="hidden" name="image[<?php echo $picid ?>][thumb]" value="<?php echo esc_attr( $picture->thumbURL ); ?>" />
256
+ <input type="hidden" name="image[<?php echo $picid ?>][url]" value="<?php echo esc_attr( $picture->imageURL ); ?>" />
257
+ </td>
258
+ <td class="savesend">
259
+ <?php
260
+ if ( $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) ) )
261
+ echo "<a class='ngg-post-thumbnail' id='ngg-post-thumbnail-" . $picid . "' href='#' onclick='NGGSetAsThumbnail(\"$picid\");return false;'>" . esc_html__( 'Use as featured image' ) . "</a>";
262
+ ?>
263
+ <button type="submit" class="button" value="1" name="send[<?php echo $picid ?>]"><?php esc_html_e( 'Insert into Post' ); ?></button>
264
+ </td>
265
+ </tr>
266
+ </tbody></table>
267
+ </div>
268
+ <?php
269
+ }
270
+ }
271
+ ?>
272
+ </div>
273
+ <p class="ml-submit">
274
+ <input type="submit" class="button savebutton" name="save" value="<?php esc_attr( _e('Save all changes','nggallery') ); ?>" />
275
+ </p>
276
+ <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
277
+ <input type="hidden" name="select_gal" id="select_gal" value="<?php echo (int) $galleryID; ?>" />
278
+ </form>
279
+
280
+ <?php
281
+ }
282
+ ?>
admin/overview.php CHANGED
@@ -1,848 +1,854 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- /**
5
- * nggallery_admin_overview()
6
- *
7
- * Add the admin overview the dashboard style
8
- * @return mixed content
9
- */
10
- function nggallery_admin_overview() {
11
- ?>
12
- <div class="wrap ngg-wrap">
13
- <?php screen_icon( 'nextgen-gallery' ); ?>
14
- <h2><?php _e('NextGEN Gallery Overview', 'nggallery') ?></h2>
15
- <?php if (version_compare(PHP_VERSION, '5.0.0', '<')) ngg_check_for_PHP5(); ?>
16
- <div id="dashboard-widgets-container" class="ngg-overview">
17
- <div id="dashboard-widgets" class="metabox-holder">
18
- <div id="post-body">
19
- <div id="dashboard-widgets-main-content">
20
- <div class="postbox-container" id="main-container" style="width:75%;">
21
- <?php do_meta_boxes('ngg_overview', 'left', ''); ?>
22
- </div>
23
- <div class="postbox-container" id="side-container" style="width:24%;">
24
- <?php do_meta_boxes('ngg_overview', 'right', ''); ?>
25
- </div>
26
- </div>
27
- </div>
28
- </div>
29
- </div>
30
- </div>
31
- <script type="text/javascript">
32
- //<![CDATA[
33
- var ajaxWidgets, ajaxPopulateWidgets;
34
-
35
- jQuery(document).ready( function($) {
36
- // These widgets are sometimes populated via ajax
37
- ajaxWidgets = [
38
- 'ngg_lastdonators',
39
- 'dashboard_primary',
40
- 'ngg_locale',
41
- 'dashboard_plugins'
42
- ];
43
-
44
- ajaxPopulateWidgets = function(el) {
45
- show = function(id, i) {
46
- var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading');
47
- if ( e.length ) {
48
- p = e.parent();
49
- setTimeout( function(){
50
- p.load('admin-ajax.php?action=ngg_dashboard&jax=' + id, '', function() {
51
- p.hide().slideDown('normal', function(){
52
- $(this).css('display', '');
53
- if ( 'dashboard_plugins' == id && $.isFunction(tb_init) )
54
- tb_init('#dashboard_plugins a.thickbox');
55
- });
56
- });
57
- }, i * 500 );
58
- }
59
- }
60
- if ( el ) {
61
- el = el.toString();
62
- if ( $.inArray(el, ajaxWidgets) != -1 )
63
- show(el, 0);
64
- } else {
65
- $.each( ajaxWidgets, function(i) {
66
- show(this, i);
67
- });
68
- }
69
- };
70
- ajaxPopulateWidgets();
71
- } );
72
-
73
- jQuery(document).ready( function($) {
74
- // postboxes setup
75
- postboxes.add_postbox_toggles('ngg-overview');
76
- });
77
- //]]>
78
- </script>
79
- <?php
80
- }
81
-
82
- /**
83
- * Load the meta boxes
84
- *
85
- */
86
- add_meta_box('dashboard_right_now', __('Welcome to NextGEN Gallery !', 'nggallery'), 'ngg_overview_right_now', 'ngg_overview', 'left', 'core');
87
- add_meta_box('ngg_meta_box', __('Do you like this Plugin?', 'nggallery'), 'ngg_likeThisMetaBox', 'ngg_overview', 'right', 'core');
88
- if ( !(get_locale() == 'en_US') )
89
- add_meta_box('ngg_locale', __('Translation', 'nggallery'), 'ngg_widget_locale', 'ngg_overview', 'right', 'core');
90
- add_meta_box('dashboard_primary', __('Latest News', 'nggallery'), 'ngg_widget_overview_news', 'ngg_overview', 'left', 'core');
91
- add_meta_box('ngg_lastdonators', __('Recent donators', 'nggallery'), 'ngg_widget_overview_donators', 'ngg_overview', 'right', 'core');
92
- if ( !is_multisite() || is_super_admin() ) {
93
- add_meta_box('ngg_plugin_check', __('Plugin Check', 'nggallery'), 'ngg_plugin_check', 'ngg_overview', 'right', 'core');
94
- add_meta_box('ngg_server', __('Server Settings', 'nggallery'), 'ngg_overview_server', 'ngg_overview', 'right', 'core');
95
- add_meta_box('dashboard_plugins', __('Related plugins', 'nggallery'), 'ngg_widget_related_plugins', 'ngg_overview', 'left', 'core');
96
- }
97
-
98
- function ngg_likeThisMetaBox() {
99
-
100
- echo '<p>';
101
- echo sprintf(__('This plugin is primarily developed, maintained, supported and documented by <a href="%s">Alex Rabe</a> with a lot of love & effort. Any kind of contribution would be highly appreciated. Thanks!', 'nggallery'), 'http://alexrabe.de/');
102
- echo '</p><ul>';
103
-
104
- $url = 'http://wordpress.org/extend/plugins/nextgen-gallery/' ;
105
- echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-rating.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
106
- _e('Give it a good rating on WordPress.org.', 'nggallery');
107
- echo "</a></li>";
108
-
109
- $url = 'http://alexrabe.de/donation/';
110
- echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-paypal.gif ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
111
- _e("Donate the work via paypal.", 'nggallery');
112
- echo "</a></li>";
113
-
114
- $url = 'http://alexrabe.de/wordpress-plugins/wordtube/translation-of-plugins/';
115
- echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-translate.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}'>";
116
- _e("Help translating it.", 'nggallery');
117
- echo "</a></li>";
118
-
119
- echo '</ul>';
120
- }
121
-
122
- /**
123
- * Ajax Check for conflict with other plugins/themes
124
- *
125
- * @return void
126
- */
127
- function ngg_plugin_check() {
128
-
129
- global $ngg;
130
- ?>
131
- <script type="text/javascript">
132
- (function($) {
133
- nggPluginCheck = {
134
-
135
- settings: {
136
- img_run: '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="icon" alt="started"/>',
137
- img_ok: '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" class="icon" alt="ok"/>',
138
- img_fail: '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" class="icon" alt="failed" />',
139
- domain: '<?php echo esc_url( home_url('index.php', is_ssl() ? 'https' : 'http') ); ?>'
140
- },
141
-
142
- run: function( index, state ) {
143
- ul = $('#plugin_check');
144
- s = this.settings;
145
- var step = 1;
146
- switch ( index ) {
147
- case 1:
148
- this.check1();
149
- break;
150
- case 2:
151
- this.check2( step );
152
- break;
153
- case 3:
154
- this.check3();
155
- break;
156
- }
157
- },
158
-
159
- // this function check if the json API will work with your theme & plugins
160
- check1 : function() {
161
- this.start(1);
162
- var req = $.ajax({
163
- dataType: 'json',
164
- url: s.domain,
165
- data:'callback=json&format=json&method=version',
166
- cache: false,
167
- timeout: 10000,
168
- success: function(msg){
169
- if (msg.version == '<?php echo $ngg->version; ?>')
170
- nggPluginCheck.success(1);
171
- else
172
- nggPluginCheck.failed(1);
173
- },
174
- error: function (msg) {
175
- nggPluginCheck.failed(1);
176
- },
177
- complete: function () {
178
- nggPluginCheck.run(2);
179
- }
180
- });
181
-
182
- },
183
-
184
- // this function check if GD lib can create images & thumbnails
185
- check2 : function( step ) {
186
- if (step == 1) this.start(2);
187
- var stop = false;
188
- var req = $.ajax({
189
- type: "POST",
190
- url: ajaxurl,
191
- data:"action=ngg_image_check&step=" + step,
192
- cache: false,
193
- timeout: 10000,
194
- success: function(msg){
195
- if (msg.stat == 'ok') {
196
- nggPluginCheck.success(2, msg.message);
197
- } else {
198
- if (step == 1)
199
- nggPluginCheck.failed(2);
200
- stop = true;
201
- }
202
-
203
- },
204
- error: function (msg) {
205
- if (step == 1)
206
- nggPluginCheck.failed(2);
207
- stop = true;
208
- },
209
- complete: function () {
210
- step++;
211
- if (step <= 11 && stop == false)
212
- nggPluginCheck.check2(step);
213
- else
214
- nggPluginCheck.run(3);
215
- }
216
- });
217
- },
218
-
219
- // this function check if wp_head / wp_footer is avaiable
220
- check3 : function() {
221
- this.start(3);
222
- var req = $.ajax({
223
- type: "POST",
224
- url: ajaxurl,
225
- data:"action=ngg_test_head_footer",
226
- cache: false,
227
- timeout: 10000,
228
- success: function(msg){
229
- if (msg == 'success')
230
- nggPluginCheck.success(3);
231
- else
232
- nggPluginCheck.failed(3, msg);
233
- },
234
- error: function (msg) {
235
- nggPluginCheck.failed(3);
236
- }
237
- });
238
- },
239
-
240
- start: function( id ) {
241
-
242
- s = this.settings;
243
- var field = "#check" + id;
244
-
245
- if ( ul.find(field + " img").length == 0)
246
- $(field).prepend( s.img_run );
247
- else
248
- $(field + " img").replaceWith( s.img_run );
249
-
250
- $(field + " .success").hide();
251
- $(field + " .failed").hide();
252
- $(field + " .default").replaceWith('<p class="default message"><?php echo esc_js( __('Running...', 'nggallery') ); ?></p> ');
253
- },
254
-
255
- success: function( id, msg ) {
256
-
257
- s = this.settings;
258
- var field = "#check" + id;
259
-
260
- if ( ul.find(field + " img").length == 0)
261
- $(field).prepend( s.img_ok );
262
- else
263
- $(field + " img").replaceWith( s.img_ok );
264
-
265
- $(field + " .default").hide();
266
- if (msg)
267
- $(field + " .success").replaceWith('<p class="success message">' + msg +' </p> ');
268
- else
269
- $(field + " .success").show();
270
-
271
- },
272
-
273
- failed: function( id, msg ) {
274
-
275
- s = this.settings;
276
- var field = "#check" + id;
277
-
278
- if ( ul.find(field + " img").length == 0)
279
- $(field).prepend( s.img_fail );
280
- else
281
- $(field + " img").replaceWith( s.img_fail );
282
-
283
- $(field + " .default").hide();
284
- if (msg)
285
- $(field + " .failed").replaceWith('<p class="failed message">' + msg +' </p> ');
286
- else
287
- $(field + " .failed").show();
288
-
289
- }
290
-
291
- };
292
- })(jQuery);
293
- </script>
294
- <div class="dashboard-widget-holder wp_dashboard_empty">
295
- <div class="ngg-dashboard-widget">
296
- <div class="dashboard-widget-content">
297
- <ul id="plugin_check" class="settings">
298
- <li id="check1">
299
- <strong><?php _e('Check plugin/theme conflict', 'nggallery'); ?></strong>
300
- <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
301
- <p class="success message" style="display: none;"><?php _e('No conflict could be detected', 'nggallery'); ?></p>
302
- <p class="failed message" style="display: none;"><?php _e('Test failed, disable other plugins & switch to default theme', 'nggallery'); ?></p>
303
- </li>
304
- <li id="check2">
305
- <strong><?php _e('Test image function', 'nggallery'); ?></strong>
306
- <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
307
- <p class="success message" style="display: none;"><?php _e('The plugin could create images', 'nggallery'); ?></p>
308
- <p class="failed message" style="display: none;"><?php _e('Couldn\'t create image, check your memory limit', 'nggallery'); ?></p>
309
- </li>
310
- <li id="check3">
311
- <strong><?php _e('Check theme compatibility', 'nggallery'); ?></strong>
312
- <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
313
- <p class="success message" style="display: none;"><?php _e('Your theme should work fine with NextGEN Gallery', 'nggallery'); ?></p>
314
- <p class="failed message" style="display: none;"><?php _e('wp_head()/wp_footer() is missing, contact the theme author', 'nggallery'); ?></p>
315
- </li>
316
- </ul>
317
- <p class="textright">
318
- <input type="button" name="update" value="<?php _e('Check plugin', 'nggallery'); ?>" onclick="nggPluginCheck.run(1);" class="button-secondary" />
319
- </p>
320
- </div>
321
- </div>
322
- </div>
323
- <?php
324
- }
325
-
326
- /**
327
- * Show the server settings in a dashboard widget
328
- *
329
- * @return void
330
- */
331
- function ngg_overview_server() {
332
- ?>
333
- <div id="dashboard_server_settings" class="dashboard-widget-holder wp_dashboard_empty">
334
- <div class="ngg-dashboard-widget">
335
- <div class="dashboard-widget-content">
336
- <ul class="settings">
337
- <?php ngg_get_serverinfo(); ?>
338
- </ul>
339
- <p><strong><?php _e('Graphic Library', 'nggallery'); ?></strong></p>
340
- <ul class="settings">
341
- <?php ngg_gd_info(); ?>
342
- </ul>
343
- </div>
344
- </div>
345
- </div>
346
- <?php
347
- }
348
-
349
- /**
350
- * Show the most recent donators
351
- *
352
- * @return void
353
- */
354
- function ngg_widget_overview_donators() {
355
- echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
356
- }
357
-
358
- function ngg_overview_donators() {
359
- global $ngg;
360
-
361
- $i = 0;
362
- $list = '';
363
-
364
- $supporter = nggAdminPanel::get_remote_array($ngg->donators);
365
-
366
- // Ensure that this is a array
367
- if ( !is_array($supporter) )
368
- return _e('Thanks to all donators...', 'nggallery');
369
-
370
- $supporter = array_reverse($supporter);
371
-
372
- foreach ($supporter as $name => $url) {
373
- $i++;
374
- if ($url)
375
- $list .= "<li><a href=\"$url\">$name</a></li>\n";
376
- else
377
- $list .= "<li>$name</li>";
378
- if ($i > 4)
379
- break;
380
- }
381
-
382
- ?>
383
- <div id="dashboard_server_settings" class="dashboard-widget-holder">
384
- <div class="ngg-dashboard-widget">
385
- <div class="dashboard-widget-content">
386
- <ul class="settings">
387
- <?php echo $list; ?>
388
- </ul>
389
- <p class="textright">
390
- <a class="button" href="admin.php?page=nggallery-about#donators"><?php _e('View all', 'nggallery'); ?></a>
391
- </p>
392
- </div>
393
- </div>
394
- </div>
395
- <?php
396
- }
397
-
398
- /**
399
- * Show the latest NextGEN Gallery news
400
- *
401
- * @return void
402
- */
403
- function ngg_widget_overview_news() {
404
- echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
405
- }
406
- function ngg_overview_news(){
407
-
408
- ?>
409
- <div class="rss-widget">
410
- <?php
411
- $rss = @fetch_feed( 'http://feeds.feedburner.com/alexrabe' );
412
-
413
- if ( is_object($rss) ) {
414
-
415
- if ( is_wp_error($rss) ) {
416
- echo '<p>' . sprintf(__('Newsfeed could not be loaded. Check the <a href="%s">front page</a> to check for updates.', 'nggallery'), 'http://alexrabe.de/') . '</p>';
417
- return;
418
- }
419
-
420
- echo '<ul>';
421
- foreach ( $rss->get_items(0, 3) as $item ) {
422
- $link = $item->get_link();
423
- while ( stristr($link, 'http') != $link )
424
- $link = substr($link, 1);
425
- $link = esc_url(strip_tags($link));
426
- $title = esc_attr(strip_tags($item->get_title()));
427
- if ( empty($title) )
428
- $title = __('Untitled');
429
-
430
- $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
431
- $desc = wp_html_excerpt( $desc, 360 );
432
-
433
- // Append ellipsis. Change existing [...] to [&hellip;].
434
- if ( '[...]' == substr( $desc, -5 ) )
435
- $desc = substr( $desc, 0, -5 ) . '[&hellip;]';
436
- elseif ( '[&hellip;]' != substr( $desc, -10 ) )
437
- $desc .= ' [&hellip;]';
438
-
439
- $desc = esc_html( $desc );
440
-
441
- $date = $item->get_date();
442
- $diff = '';
443
-
444
- if ( $date ) {
445
-
446
- $diff = human_time_diff( strtotime($date, time()) );
447
-
448
- if ( $date_stamp = strtotime( $date ) )
449
- $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
450
- else
451
- $date = '';
452
- }
453
- ?>
454
- <li><a class="rsswidget" title="" href='<?php echo $link; ?>'><?php echo $title; ?></a>
455
- <span class="rss-date"><?php echo $date; ?></span>
456
- <div class="rssSummary"><strong><?php echo $diff; ?></strong> - <?php echo $desc; ?></div></li>
457
- <?php
458
- }
459
- echo '</ul>';
460
- }
461
- ?>
462
- </div>
463
- <?php
464
- }
465
-
466
- /**
467
- * Show a summary of the used images
468
- *
469
- * @return void
470
- */
471
- function ngg_overview_right_now() {
472
- global $wpdb;
473
- $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") );
474
- $galleries = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") );
475
- $albums = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
476
- ?>
477
- <div class="table table_content">
478
- <p class="sub"><?php _e('At a Glance', 'nggallery'); ?></p>
479
- <table>
480
- <tbody>
481
- <tr class="first">
482
- <td class="first b"><a href="admin.php?page=nggallery-add-gallery"><?php echo $images; ?></a></td>
483
- <td class="t"><a href="admin.php?page=nggallery-add-gallery"><?php echo _n( 'Image', 'Images', $images, 'nggallery' ); ?></a></td>
484
- <td class="b"></td>
485
- <td class="last"></td>
486
- </tr>
487
- <tr>
488
- <td class="first b"><a href="admin.php?page=nggallery-manage-gallery"><?php echo $galleries; ?></a></td>
489
- <td class="t"><a href="admin.php?page=nggallery-manage-gallery"><?php echo _n( 'Gallery', 'Galleries', $galleries, 'nggallery' ); ?></a></td>
490
- <td class="b"></td>
491
- <td class="last"></td>
492
- </tr>
493
- <tr>
494
- <td class="first b"><a href="admin.php?page=nggallery-manage-album"><?php echo $albums; ?></a></td>
495
- <td class="t"><a href="admin.php?page=nggallery-manage-album"><?php echo _n( 'Album', 'Albums', $albums, 'nggallery' ); ?></a></td>
496
- <td class="b"></td>
497
- <td class="last"></td>
498
- </tr>
499
- </tbody>
500
- </table>
501
- </div>
502
- <div class="versions" style="padding-top:14px">
503
- <p>
504
- <?php if(current_user_can('NextGEN Upload images')): ?><a class="button rbutton" href="admin.php?page=nggallery-add-gallery"><?php _e('Upload pictures', 'nggallery') ?></a><?php endif; ?>
505
- <?php _e('Here you can control your images, galleries and albums.', 'nggallery') ?>
506
- </p>
507
- <br class="clear" />
508
- </div>
509
- <?php
510
- if ( is_multisite() )
511
- ngg_dashboard_quota();
512
- }
513
-
514
- // Display File upload quota on dashboard
515
- function ngg_dashboard_quota() {
516
-
517
- if ( get_site_option( 'upload_space_check_disabled' ) )
518
- return;
519
-
520
- if ( !wpmu_enable_function('wpmuQuotaCheck') )
521
- return;
522
-
523
- $quota = get_space_allowed();
524
- $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
525
-
526
- if ( $used > $quota )
527
- $percentused = '100';
528
- else
529
- $percentused = ( $used / $quota ) * 100;
530
- $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
531
- $used = round( $used, 2 );
532
- $percentused = number_format( $percentused );
533
-
534
- ?>
535
- <p class="sub musub" style="position:static" ><?php _e( 'Storage Space' ); ?></p>
536
- <div class="table table_content musubtable">
537
- <table>
538
- <tr class="first">
539
- <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $quota ); ?></td>
540
- <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
541
- </tr>
542
- </table>
543
- </div>
544
- <div class="table table_discussion musubtable">
545
- <table>
546
- <tr class="first">
547
- <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $used, $percentused ); ?></td>
548
- <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
549
- </tr>
550
- </table>
551
- </div>
552
- <br class="clear" />
553
- <?php
554
- }
555
-
556
- /**
557
- * Looks up for translation file
558
- *
559
- * @return void
560
- */
561
- function ngg_widget_locale() {
562
-
563
- require_once(NGGALLERY_ABSPATH . '/lib/locale.php');
564
-
565
- $locale = new ngg_locale();
566
-
567
- $overview_url = admin_url() . 'admin.php?page=' . NGGFOLDER;
568
-
569
- // Check if someone would like to update the translation file
570
- if ( isset($_GET['locale']) && $_GET['locale'] == 'update' ) {
571
- check_admin_referer('ngg_update_locale');
572
-
573
- $result = $locale->download_locale();
574
-
575
- if ($result == true) {
576
- ?>
577
- <p class="hint"><?php _e('Translation file successful updated. Please reload page.', 'nggallery'); ?></p>
578
- <p class="textright">
579
- <a class="button" href="<?php echo esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
580
- </p>
581
- <?php
582
- } else {
583
- ?>
584
- <p class="hint"><?php _e('Translation file couldn\'t be updated', 'nggallery'); ?></p>
585
- <?php
586
- }
587
-
588
- return;
589
- }
590
-
591
- echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
592
- }
593
-
594
- function ngg_locale() {
595
- global $ngg;
596
-
597
- require_once(NGGALLERY_ABSPATH . '/lib/locale.php');
598
-
599
- $locale = new ngg_locale();
600
- $overview_url = admin_url() . 'admin.php?page=' . NGGFOLDER;
601
- $result = $locale->check();
602
- $update_url = wp_nonce_url ( $overview_url . '&amp;locale=update', 'ngg_update_locale');
603
-
604
- //Translators can change this text via gettext
605
- if ($result == 'installed') {
606
- echo $ngg->translator;
607
- if ( !is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
608
- ?>
609
- <p class="textright">
610
- <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
611
- </p>
612
- <?php
613
- }
614
- }
615
-
616
- //Translators can change this text via gettext
617
- if ($result == 'available') {
618
- ?>
619
- <p><strong>Download now your language file !</strong></p>
620
- <p class="textright">
621
- <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
622
- </p>
623
- <?php
624
- }
625
-
626
-
627
- if ($result == 'not_exist')
628
- echo '<p class="hint">'. sprintf( '<strong>Would you like to help to translate this plugin ?</strong> <a target="_blank" href="%s">Download</a> the current pot file and read <a href="http://alexrabe.de/wordpress-plugins/wordtube/translation-of-plugins/">here</a> how you can translate the plugin.', NGGALLERY_URLPATH . 'lang/nggallery.pot').'</p>';
629
-
630
- }
631
-
632
- /**
633
- * Show GD Library version information
634
- *
635
- * @return void
636
- */
637
- function ngg_gd_info() {
638
-
639
- if(function_exists("gd_info")){
640
- $info = gd_info();
641
- $keys = array_keys($info);
642
- for($i=0; $i<count($keys); $i++) {
643
- if(is_bool($info[$keys[$i]]))
644
- echo "<li> " . $keys[$i] ." : <span>" . ngg_gd_yesNo($info[$keys[$i]]) . "</span></li>\n";
645
- else
646
- echo "<li> " . $keys[$i] ." : <span>" . $info[$keys[$i]] . "</span></li>\n";
647
- }
648
- }
649
- else {
650
- echo '<h4>'.__('No GD support', 'nggallery').'!</h4>';
651
- }
652
- }
653
-
654
- /**
655
- * Return localized Yes or no
656
- *
657
- * @param bool $bool
658
- * @return return 'Yes' | 'No'
659
- */
660
- function ngg_gd_yesNo( $bool ){
661
- if($bool)
662
- return __('Yes', 'nggallery');
663
- else
664
- return __('No', 'nggallery');
665
- }
666
-
667
-
668
- /**
669
- * Show up some server infor's
670
- * @author GamerZ (http://www.lesterchan.net)
671
- *
672
- * @return void
673
- */
674
- function ngg_get_serverinfo() {
675
-
676
- global $wpdb, $ngg;
677
- // Get MYSQL Version
678
- $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
679
- // GET SQL Mode
680
- $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
681
- if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value;
682
- if (empty($sql_mode)) $sql_mode = __('Not set', 'nggallery');
683
- // Get PHP Safe Mode
684
- if(ini_get('safe_mode')) $safe_mode = __('On', 'nggallery');
685
- else $safe_mode = __('Off', 'nggallery');
686
- // Get PHP allow_url_fopen
687
- if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery');
688
- else $allow_url_fopen = __('Off', 'nggallery');
689
- // Get PHP Max Upload Size
690
- if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
691
- else $upload_max = __('N/A', 'nggallery');
692
- // Get PHP Output buffer Size
693
- if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit');
694
- else $backtrack_limit = __('N/A', 'nggallery');
695
- // Get PHP Max Post Size
696
- if(ini_get('post_max_size')) $post_max = ini_get('post_max_size');
697
- else $post_max = __('N/A', 'nggallery');
698
- // Get PHP Max execution time
699
- if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time');
700
- else $max_execute = __('N/A', 'nggallery');
701
- // Get PHP Memory Limit
702
- if(ini_get('memory_limit')) $memory_limit = $ngg->memory_limit;
703
- else $memory_limit = __('N/A', 'nggallery');
704
- // Get actual memory_get_usage
705
- if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'nggallery');
706
- else $memory_usage = __('N/A', 'nggallery');
707
- // required for EXIF read
708
- if (is_callable('exif_read_data')) $exif = __('Yes', 'nggallery'). " ( V" . substr(phpversion('exif'),0,4) . ")" ;
709
- else $exif = __('No', 'nggallery');
710
- // required for meta data
711
- if (is_callable('iptcparse')) $iptc = __('Yes', 'nggallery');
712
- else $iptc = __('No', 'nggallery');
713
- // required for meta data
714
- if (is_callable('xml_parser_create')) $xml = __('Yes', 'nggallery');
715
- else $xml = __('No', 'nggallery');
716
-
717
- ?>
718
- <li><?php _e('Operating System', 'nggallery'); ?> : <span><?php echo PHP_OS; ?>&nbsp;(<?php echo (PHP_INT_SIZE * 8) ?>&nbsp;Bit)</span></li>
719
- <li><?php _e('Server', 'nggallery'); ?> : <span><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></span></li>
720
- <li><?php _e('Memory usage', 'nggallery'); ?> : <span><?php echo $memory_usage; ?></span></li>
721
- <li><?php _e('MYSQL Version', 'nggallery'); ?> : <span><?php echo $sqlversion; ?></span></li>
722
- <li><?php _e('SQL Mode', 'nggallery'); ?> : <span><?php echo $sql_mode; ?></span></li>
723
- <li><?php _e('PHP Version', 'nggallery'); ?> : <span><?php echo PHP_VERSION; ?></span></li>
724
- <li><?php _e('PHP Safe Mode', 'nggallery'); ?> : <span><?php echo $safe_mode; ?></span></li>
725
- <li><?php _e('PHP Allow URL fopen', 'nggallery'); ?> : <span><?php echo $allow_url_fopen; ?></span></li>
726
- <li><?php _e('PHP Memory Limit', 'nggallery'); ?> : <span><?php echo $memory_limit; ?></span></li>
727
- <li><?php _e('PHP Max Upload Size', 'nggallery'); ?> : <span><?php echo $upload_max; ?></span></li>
728
- <li><?php _e('PHP Max Post Size', 'nggallery'); ?> : <span><?php echo $post_max; ?></span></li>
729
- <li><?php _e('PCRE Backtracking Limit', 'nggallery'); ?> : <span><?php echo $backtrack_limit; ?></span></li>
730
- <li><?php _e('PHP Max Script Execute Time', 'nggallery'); ?> : <span><?php echo $max_execute; ?>s</span></li>
731
- <li><?php _e('PHP Exif support', 'nggallery'); ?> : <span><?php echo $exif; ?></span></li>
732
- <li><?php _e('PHP IPTC support', 'nggallery'); ?> : <span><?php echo $iptc; ?></span></li>
733
- <li><?php _e('PHP XML support', 'nggallery'); ?> : <span><?php echo $xml; ?></span></li>
734
- <?php
735
- }
736
-
737
- /**
738
- * Inform about the end of PHP4
739
- *
740
- * @return void
741
- */
742
- function ngg_check_for_PHP5() {
743
- ?>
744
- <div class="updated">
745
- <p><?php _e('NextGEN Gallery contains some functions which are only available under PHP 5.2. You are using the old PHP 4 version, upgrade now! It\'s no longer supported by the PHP group. Many shared hosting providers offer both PHP 4 and PHP 5, running simultaneously. Ask your provider if they can do this.', 'nggallery'); ?></p>
746
- </div>
747
- <?php
748
- }
749
-
750
- /**
751
- * ngg_get_phpinfo() - Extract all of the data from phpinfo into a nested array
752
- *
753
- * @author jon@sitewizard.ca
754
- * @return array
755
- */
756
- function ngg_get_phpinfo() {
757
-
758
- ob_start();
759
- phpinfo();
760
- $phpinfo = array('phpinfo' => array());
761
-
762
- if ( preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER) )
763
- foreach($matches as $match) {
764
- if(strlen($match[1]))
765
- $phpinfo[$match[1]] = array();
766
- elseif(isset($match[3]))
767
- $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
768
- else
769
- $phpinfo[end(array_keys($phpinfo))][] = $match[2];
770
- }
771
-
772
- return $phpinfo;
773
- }
774
-
775
- /**
776
- * Show NextGEN Gallery related plugins. Fetch plugins from wp.org which have added 'nextgen-gallery' as tag in readme.txt
777
- *
778
- * @return postbox output
779
- */
780
- function ngg_widget_related_plugins() {
781
- echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
782
- }
783
- function ngg_related_plugins() {
784
- include(ABSPATH . 'wp-admin/includes/plugin-install.php');
785
-
786
- if ( false === ( $api = get_transient( 'ngg_related_plugins' ) ) ) {
787
- // this api sucks , tags will not be used in the correct way : nextgen-gallery cannot be searched
788
- $api = plugins_api('query_plugins', array('search' => 'nextgen') );
789
-
790
- if ( is_wp_error($api) )
791
- return;
792
-
793
- set_transient( 'ngg_related_plugins', $api, 60*60*24 );
794
- }
795
-
796
- // don't show my own plugin :-) and some other plugins, which come up with the search result
797
- $blacklist = array(
798
- 'nextgen-gallery',
799
- 'galleria-wp',
800
- 'photosmash-galleries',
801
- 'flash-album-gallery',
802
- 'events-calendar',
803
- 'widgets',
804
- 'side-content',
805
- 'featurific-for-wordpress',
806
- 'smooth-gallery-replacement',
807
- 'livesig',
808
- 'wordpress-gallery-slideshow',
809
- 'nkmimagefield',
810
- 'nextgen-ajax',
811
- 'projectmanager'
812
- );
813
-
814
- $i = 0;
815
- while ( $i < 4 ) {
816
-
817
- // pick them randomly
818
- if ( 0 == count($api->plugins) )
819
- return;
820
-
821
- $key = array_rand($api->plugins);
822
- $plugin = $api->plugins[$key];
823
-
824
- // don't forget to remove them
825
- unset($api->plugins[$key]);
826
-
827
- if ( !isset($plugin->name) )
828
- continue;
829
-
830
- if ( in_array($plugin->slug , $blacklist ) )
831
- continue;
832
-
833
- $link = esc_url( $plugin->homepage );
834
- $title = esc_html( $plugin->name );
835
-
836
- $description = esc_html( strip_tags(@html_entity_decode($plugin->short_description, ENT_QUOTES, get_option('blog_charset'))) );
837
-
838
- $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin->slug, 'install-plugin_' . $plugin->slug) .
839
- '&amp;TB_iframe=true&amp;width=600&amp;height=800';
840
-
841
- echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
842
- echo "<p>$description<strong> " . __( 'Author' ) . " : </strong>$plugin->author</p>\n";
843
-
844
- $i++;
845
- }
846
-
847
- }
848
- ?>
 
 
 
 
 
 
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ /**
5
+ * nggallery_admin_overview()
6
+ *
7
+ * Add the admin overview the dashboard style
8
+ * @return mixed content
9
+ */
10
+ function nggallery_admin_overview() {
11
+ ?>
12
+ <div class="wrap ngg-wrap">
13
+ <?php include('templates/social_media_buttons.php'); ?>
14
+ <?php screen_icon( 'nextgen-gallery' ); ?>
15
+ <h2><?php _e('NextGEN Gallery Overview', 'nggallery') ?></h2>
16
+ <?php if (version_compare(PHP_VERSION, '5.0.0', '<')) ngg_check_for_PHP5(); ?>
17
+ <div id="dashboard-widgets-container" class="ngg-overview">
18
+ <div id="dashboard-widgets" class="metabox-holder">
19
+ <div id="post-body">
20
+ <div id="dashboard-widgets-main-content">
21
+ <div class="postbox-container" id="main-container" style="width:75%;">
22
+ <?php do_meta_boxes('ngg_overview', 'left', ''); ?>
23
+ </div>
24
+ <div class="postbox-container" id="side-container" style="width:24%;">
25
+ <?php do_meta_boxes('ngg_overview', 'right', ''); ?>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ <script type="text/javascript">
33
+ //<![CDATA[
34
+ var ajaxWidgets, ajaxPopulateWidgets;
35
+
36
+ jQuery(document).ready( function($) {
37
+ // These widgets are sometimes populated via ajax
38
+ ajaxWidgets = [
39
+ 'ngg_lastdonators',
40
+ 'dashboard_primary',
41
+ 'ngg_locale',
42
+ 'dashboard_plugins'
43
+ ];
44
+
45
+ ajaxPopulateWidgets = function(el) {
46
+ show = function(id, i) {
47
+ var p, e = $('#' + id + ' div.inside:visible').find('.widget-loading');
48
+ if ( e.length ) {
49
+ p = e.parent();
50
+ setTimeout( function(){
51
+ p.load('admin-ajax.php?action=ngg_dashboard&jax=' + id, '', function() {
52
+ p.hide().slideDown('normal', function(){
53
+ $(this).css('display', '');
54
+ if ( 'dashboard_plugins' == id && $.isFunction(tb_init) )
55
+ tb_init('#dashboard_plugins a.thickbox');
56
+ });
57
+ });
58
+ }, i * 500 );
59
+ }
60
+ }
61
+ if ( el ) {
62
+ el = el.toString();
63
+ if ( $.inArray(el, ajaxWidgets) != -1 )
64
+ show(el, 0);
65
+ } else {
66
+ $.each( ajaxWidgets, function(i) {
67
+ show(this, i);
68
+ });
69
+ }
70
+ };
71
+ ajaxPopulateWidgets();
72
+ } );
73
+
74
+ jQuery(document).ready( function($) {
75
+ // postboxes setup
76
+ postboxes.add_postbox_toggles('ngg-overview');
77
+ });
78
+ //]]>
79
+ </script>
80
+ <?php
81
+ }
82
+
83
+ /**
84
+ * Load the meta boxes
85
+ *
86
+ */
87
+ add_meta_box('dashboard_right_now', __('Welcome to NextGEN Gallery !', 'nggallery'), 'ngg_overview_right_now', 'ngg_overview', 'left', 'core');
88
+ add_meta_box('ngg_meta_box', __('Do you like this Plugin?', 'nggallery'), 'ngg_likeThisMetaBox', 'ngg_overview', 'right', 'core');
89
+ if ( !(get_locale() == 'en_US') )
90
+ add_meta_box('ngg_locale', __('Translation', 'nggallery'), 'ngg_widget_locale', 'ngg_overview', 'right', 'core');
91
+ add_meta_box('dashboard_primary', __('Latest News', 'nggallery'), 'ngg_widget_overview_news', 'ngg_overview', 'left', 'core');
92
+ //add_meta_box('ngg_lastdonators', __('Recent donators', 'nggallery'), 'ngg_widget_overview_donators', 'ngg_overview', 'right', 'core');
93
+ if ( !is_multisite() || is_super_admin() ) {
94
+ add_meta_box('ngg_plugin_check', __('Plugin Check', 'nggallery'), 'ngg_plugin_check', 'ngg_overview', 'right', 'core');
95
+ add_meta_box('ngg_server', __('Server Settings', 'nggallery'), 'ngg_overview_server', 'ngg_overview', 'right', 'core');
96
+ add_meta_box('dashboard_plugins', __('Related plugins', 'nggallery'), 'ngg_widget_related_plugins', 'ngg_overview', 'left', 'core');
97
+ }
98
+
99
+ function ngg_likeThisMetaBox() {
100
+
101
+ echo '<p>';
102
+ echo sprintf(__('This plugin is primarily developed, maintained, supported and documented by <a href="%s" target="_blank">Photocrati Media</a> with a lot of love & effort. Any kind of contribution would be highly appreciated. Thanks!', 'nggallery'), 'http://www.photocrati.com/');
103
+ echo '</p><ul>';
104
+
105
+ $url = 'http://wordpress.org/extend/plugins/nextgen-gallery/' ;
106
+ echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-rating.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
107
+ _e('Give it a good rating on WordPress.org', 'nggallery');
108
+ echo "</a></li>";
109
+
110
+ $url = 'http://www.nextgen-gallery.com';
111
+ echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/nextgen.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
112
+ _e("Visit the plugin homepage", 'nggallery');
113
+ echo "</a></li>";
114
+
115
+ $url = 'http://www.nextgen-gallery.com/languages/';
116
+ echo "<li style='padding-left: 38px; background:transparent url(" . NGGALLERY_URLPATH . "admin/images/icon-translate.png ) no-repeat scroll center left; background-position: 16px 50%; text-decoration: none;'><a href='{$url}' target='_blank'>";
117
+ _e("Help translating it", 'nggallery');
118
+ echo "</a></li>";
119
+
120
+ echo '</ul>';
121
+
122
+ echo '
123
+ <div class="social" style="text-align:center;margin:15px 0 10px 0;"><span class="social" style="margin-right:5px;"><a target="_blank" href="http://twitter.com/NextGENGallery"><img title="Follow NextGEN on Twitter" alt="Twitter" src="' . NGGALLERY_URLPATH . 'admin/images/twitter.png"></a></span><span class="social" style="margin-right:5px;"><a target="_blank" href="http://www.facebook.com/NextGENGallery"><img title="Like NextGEN on Facebook" alt="Facebook" src="' . NGGALLERY_URLPATH . 'admin/images/facebook.png"></a></span><span class="social"><a target="_blank" href="http://plus.google.com/101643895780935290171"><img title="Add NextGEN to your circles" alt="GooglePlus" src="' . NGGALLERY_URLPATH . 'admin/images/googleplus.png"></a></span></div>';
124
+ }
125
+
126
+ /**
127
+ * Ajax Check for conflict with other plugins/themes
128
+ *
129
+ * @return void
130
+ */
131
+ function ngg_plugin_check() {
132
+
133
+ global $ngg;
134
+ ?>
135
+ <script type="text/javascript">
136
+ (function($) {
137
+ nggPluginCheck = {
138
+
139
+ settings: {
140
+ img_run: '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="icon" alt="started"/>',
141
+ img_ok: '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" class="icon" alt="ok"/>',
142
+ img_fail: '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" class="icon" alt="failed" />',
143
+ domain: '<?php echo esc_url( home_url('index.php', is_ssl() ? 'https' : 'http') ); ?>'
144
+ },
145
+
146
+ run: function( index, state ) {
147
+ ul = $('#plugin_check');
148
+ s = this.settings;
149
+ var step = 1;
150
+ switch ( index ) {
151
+ case 1:
152
+ this.check1();
153
+ break;
154
+ case 2:
155
+ this.check2( step );
156
+ break;
157
+ case 3:
158
+ this.check3();
159
+ break;
160
+ }
161
+ },
162
+
163
+ // this function check if the json API will work with your theme & plugins
164
+ check1 : function() {
165
+ this.start(1);
166
+ var req = $.ajax({
167
+ dataType: 'json',
168
+ url: s.domain,
169
+ data:'callback=json&format=json&method=version',
170
+ cache: false,
171
+ timeout: 10000,
172
+ success: function(msg){
173
+ if (msg.version == '<?php echo $ngg->version; ?>')
174
+ nggPluginCheck.success(1);
175
+ else
176
+ nggPluginCheck.failed(1);
177
+ },
178
+ error: function (msg) {
179
+ nggPluginCheck.failed(1);
180
+ },
181
+ complete: function () {
182
+ nggPluginCheck.run(2);
183
+ }
184
+ });
185
+
186
+ },
187
+
188
+ // this function check if GD lib can create images & thumbnails
189
+ check2 : function( step ) {
190
+ if (step == 1) this.start(2);
191
+ var stop = false;
192
+ var req = $.ajax({
193
+ type: "POST",
194
+ url: ajaxurl,
195
+ data:"action=ngg_image_check&step=" + step,
196
+ cache: false,
197
+ timeout: 10000,
198
+ success: function(msg){
199
+ if (msg.stat == 'ok') {
200
+ nggPluginCheck.success(2, msg.message);
201
+ } else {
202
+ if (step == 1)
203
+ nggPluginCheck.failed(2);
204
+ stop = true;
205
+ }
206
+
207
+ },
208
+ error: function (msg) {
209
+ if (step == 1)
210
+ nggPluginCheck.failed(2);
211
+ stop = true;
212
+ },
213
+ complete: function () {
214
+ step++;
215
+ if (step <= 11 && stop == false)
216
+ nggPluginCheck.check2(step);
217
+ else
218
+ nggPluginCheck.run(3);
219
+ }
220
+ });
221
+ },
222
+
223
+ // this function check if wp_head / wp_footer is avaiable
224
+ check3 : function() {
225
+ this.start(3);
226
+ var req = $.ajax({
227
+ type: "POST",
228
+ url: ajaxurl,
229
+ data:"action=ngg_test_head_footer",
230
+ cache: false,
231
+ timeout: 10000,
232
+ success: function(msg){
233
+ if (msg == 'success')
234
+ nggPluginCheck.success(3);
235
+ else
236
+ nggPluginCheck.failed(3, msg);
237
+ },
238
+ error: function (msg) {
239
+ nggPluginCheck.failed(3);
240
+ }
241
+ });
242
+ },
243
+
244
+ start: function( id ) {
245
+
246
+ s = this.settings;
247
+ var field = "#check" + id;
248
+
249
+ if ( ul.find(field + " img").length == 0)
250
+ $(field).prepend( s.img_run );
251
+ else
252
+ $(field + " img").replaceWith( s.img_run );
253
+
254
+ $(field + " .success").hide();
255
+ $(field + " .failed").hide();
256
+ $(field + " .default").replaceWith('<p class="default message"><?php echo esc_js( __('Running...', 'nggallery') ); ?></p> ');
257
+ },
258
+
259
+ success: function( id, msg ) {
260
+
261
+ s = this.settings;
262
+ var field = "#check" + id;
263
+
264
+ if ( ul.find(field + " img").length == 0)
265
+ $(field).prepend( s.img_ok );
266
+ else
267
+ $(field + " img").replaceWith( s.img_ok );
268
+
269
+ $(field + " .default").hide();
270
+ if (msg)
271
+ $(field + " .success").replaceWith('<p class="success message">' + msg +' </p> ');
272
+ else
273
+ $(field + " .success").show();
274
+
275
+ },
276
+
277
+ failed: function( id, msg ) {
278
+
279
+ s = this.settings;
280
+ var field = "#check" + id;
281
+
282
+ if ( ul.find(field + " img").length == 0)
283
+ $(field).prepend( s.img_fail );
284
+ else
285
+ $(field + " img").replaceWith( s.img_fail );
286
+
287
+ $(field + " .default").hide();
288
+ if (msg)
289
+ $(field + " .failed").replaceWith('<p class="failed message">' + msg +' </p> ');
290
+ else
291
+ $(field + " .failed").show();
292
+
293
+ }
294
+
295
+ };
296
+ })(jQuery);
297
+ </script>
298
+ <div class="dashboard-widget-holder wp_dashboard_empty">
299
+ <div class="ngg-dashboard-widget">
300
+ <div class="dashboard-widget-content">
301
+ <ul id="plugin_check" class="settings">
302
+ <li id="check1">
303
+ <strong><?php _e('Check plugin/theme conflict', 'nggallery'); ?></strong>
304
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
305
+ <p class="success message" style="display: none;"><?php _e('No conflict could be detected', 'nggallery'); ?></p>
306
+ <p class="failed message" style="display: none;"><?php _e('Test failed, disable other plugins & switch to default theme', 'nggallery'); ?></p>
307
+ </li>
308
+ <li id="check2">
309
+ <strong><?php _e('Test image function', 'nggallery'); ?></strong>
310
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
311
+ <p class="success message" style="display: none;"><?php _e('The plugin could create images', 'nggallery'); ?></p>
312
+ <p class="failed message" style="display: none;"><?php _e('Couldn\'t create image, check your memory limit', 'nggallery'); ?></p>
313
+ </li>
314
+ <li id="check3">
315
+ <strong><?php _e('Check theme compatibility', 'nggallery'); ?></strong>
316
+ <p class="default message"><?php _e('Not tested', 'nggallery'); ?></p>
317
+ <p class="success message" style="display: none;"><?php _e('Your theme should work fine with NextGEN Gallery', 'nggallery'); ?></p>
318
+ <p class="failed message" style="display: none;"><?php _e('wp_head()/wp_footer() is missing, contact the theme author', 'nggallery'); ?></p>
319
+ </li>
320
+ </ul>
321
+ <p class="textright">
322
+ <input type="button" name="update" value="<?php _e('Check plugin', 'nggallery'); ?>" onclick="nggPluginCheck.run(1);" class="button-secondary" />
323
+ </p>
324
+ </div>
325
+ </div>
326
+ </div>
327
+ <?php
328
+ }
329
+
330
+ /**
331
+ * Show the server settings in a dashboard widget
332
+ *
333
+ * @return void
334
+ */
335
+ function ngg_overview_server() {
336
+ ?>
337
+ <div id="dashboard_server_settings" class="dashboard-widget-holder wp_dashboard_empty">
338
+ <div class="ngg-dashboard-widget">
339
+ <div class="dashboard-widget-content">
340
+ <ul class="settings">
341
+ <?php ngg_get_serverinfo(); ?>
342
+ </ul>
343
+ <p><strong><?php _e('Graphic Library', 'nggallery'); ?></strong></p>
344
+ <ul class="settings">
345
+ <?php ngg_gd_info(); ?>
346
+ </ul>
347
+ </div>
348
+ </div>
349
+ </div>
350
+ <?php
351
+ }
352
+
353
+ /**
354
+ * Show the most recent donators
355
+ *
356
+ * @return void
357
+ */
358
+ function ngg_widget_overview_donators() {
359
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
360
+ }
361
+
362
+ function ngg_overview_donators() {
363
+ global $ngg;
364
+
365
+ $i = 0;
366
+ $list = '';
367
+
368
+ $supporter = nggAdminPanel::get_remote_array($ngg->donators);
369
+
370
+ // Ensure that this is a array
371
+ if ( !is_array($supporter) )
372
+ return _e('Thanks to all donators...', 'nggallery');
373
+
374
+ $supporter = array_reverse($supporter);
375
+
376
+ foreach ($supporter as $name => $url) {
377
+ $i++;
378
+ if ($url)
379
+ $list .= "<li><a href=\"$url\">$name</a></li>\n";
380
+ else
381
+ $list .= "<li>$name</li>";
382
+ if ($i > 4)
383
+ break;
384
+ }
385
+
386
+ ?>
387
+ <div id="dashboard_server_settings" class="dashboard-widget-holder">
388
+ <div class="ngg-dashboard-widget">
389
+ <div class="dashboard-widget-content">
390
+ <ul class="settings">
391
+ <?php echo $list; ?>
392
+ </ul>
393
+ <p class="textright">
394
+ <a class="button" href="admin.php?page=nggallery-about#donators"><?php _e('View all', 'nggallery'); ?></a>
395
+ </p>
396
+ </div>
397
+ </div>
398
+ </div>
399
+ <?php
400
+ }
401
+
402
+ /**
403
+ * Show the latest NextGEN Gallery news
404
+ *
405
+ * @return void
406
+ */
407
+ function ngg_widget_overview_news() {
408
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
409
+ }
410
+ function ngg_overview_news(){
411
+
412
+ ?>
413
+ <div class="rss-widget">
414
+ <?php
415
+ $rss = @fetch_feed( 'http://feeds.feedburner.com/nextgen-gallery' );
416
+
417
+ if ( is_object($rss) ) {
418
+
419
+ if ( is_wp_error($rss) ) {
420
+ echo '<p>' . sprintf(__('Newsfeed could not be loaded. Check the <a href="%s">front page</a> to check for updates.', 'nggallery'), 'http://www.nextgen-gallery.com/') . '</p>';
421
+ return;
422
+ }
423
+
424
+ echo '<ul>';
425
+ foreach ( $rss->get_items(0, 3) as $item ) {
426
+ $link = $item->get_link();
427
+ while ( stristr($link, 'http') != $link )
428
+ $link = substr($link, 1);
429
+ $link = esc_url(strip_tags($link));
430
+ $title = esc_attr(strip_tags($item->get_title()));
431
+ if ( empty($title) )
432
+ $title = __('Untitled');
433
+
434
+ $desc = str_replace( array("\n", "\r"), ' ', esc_attr( strip_tags( @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option('blog_charset') ) ) ) );
435
+ $desc = wp_html_excerpt( $desc, 360 );
436
+
437
+ // Append ellipsis. Change existing [...] to [&hellip;].
438
+ if ( '[...]' == substr( $desc, -5 ) )
439
+ $desc = substr( $desc, 0, -5 ) . '[&hellip;]';
440
+ elseif ( '[&hellip;]' != substr( $desc, -10 ) )
441
+ $desc .= ' [&hellip;]';
442
+
443
+ $desc = esc_html( $desc );
444
+
445
+ $date = $item->get_date();
446
+ $diff = '';
447
+
448
+ if ( $date ) {
449
+
450
+ $diff = human_time_diff( strtotime($date, time()) );
451
+
452
+ if ( $date_stamp = strtotime( $date ) )
453
+ $date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
454
+ else
455
+ $date = '';
456
+ }
457
+ ?>
458
+ <li><a class="rsswidget" title="" target="_blank" href='<?php echo $link; ?>'><?php echo $title; ?></a>
459
+ <span class="rss-date"><?php echo $date; ?></span>
460
+ <div class="rssSummary"><strong><?php echo $diff; ?></strong> - <?php echo $desc; ?></div></li>
461
+ <?php
462
+ }
463
+ echo '</ul>';
464
+ }
465
+ ?>
466
+ </div>
467
+ <?php
468
+ }
469
+
470
+ /**
471
+ * Show a summary of the used images
472
+ *
473
+ * @return void
474
+ */
475
+ function ngg_overview_right_now() {
476
+ global $wpdb;
477
+ $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") );
478
+ $galleries = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") );
479
+ $albums = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
480
+ ?>
481
+ <div class="table table_content">
482
+ <p class="sub"><?php _e('At a Glance', 'nggallery'); ?></p>
483
+ <table>
484
+ <tbody>
485
+ <tr class="first">
486
+ <td class="first b"><a href="admin.php?page=nggallery-add-gallery"><?php echo $images; ?></a></td>
487
+ <td class="t"><a href="admin.php?page=nggallery-add-gallery"><?php echo _n( 'Image', 'Images', $images, 'nggallery' ); ?></a></td>
488
+ <td class="b"></td>
489
+ <td class="last"></td>
490
+ </tr>
491
+ <tr>
492
+ <td class="first b"><a href="admin.php?page=nggallery-manage-gallery"><?php echo $galleries; ?></a></td>
493
+ <td class="t"><a href="admin.php?page=nggallery-manage-gallery"><?php echo _n( 'Gallery', 'Galleries', $galleries, 'nggallery' ); ?></a></td>
494
+ <td class="b"></td>
495
+ <td class="last"></td>
496
+ </tr>
497
+ <tr>
498
+ <td class="first b"><a href="admin.php?page=nggallery-manage-album"><?php echo $albums; ?></a></td>
499
+ <td class="t"><a href="admin.php?page=nggallery-manage-album"><?php echo _n( 'Album', 'Albums', $albums, 'nggallery' ); ?></a></td>
500
+ <td class="b"></td>
501
+ <td class="last"></td>
502
+ </tr>
503
+ </tbody>
504
+ </table>
505
+ </div>
506
+ <div class="versions" style="padding-top:14px">
507
+ <p>
508
+ <?php if(current_user_can('NextGEN Upload images')): ?><a class="button rbutton" href="admin.php?page=nggallery-add-gallery"><?php _e('Upload pictures', 'nggallery') ?></a><?php endif; ?>
509
+ <?php _e('Here you can control your images, galleries and albums.', 'nggallery') ?>
510
+ </p>
511
+ <br class="clear" />
512
+ </div>
513
+ <?php
514
+ if ( is_multisite() )
515
+ ngg_dashboard_quota();
516
+ }
517
+
518
+ // Display File upload quota on dashboard
519
+ function ngg_dashboard_quota() {
520
+
521
+ if ( get_site_option( 'upload_space_check_disabled' ) )
522
+ return;
523
+
524
+ if ( !wpmu_enable_function('wpmuQuotaCheck') )
525
+ return;
526
+
527
+ $quota = get_space_allowed();
528
+ $used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
529
+
530
+ if ( $used > $quota )
531
+ $percentused = '100';
532
+ else
533
+ $percentused = ( $used / $quota ) * 100;
534
+ $used_color = ( $percentused < 70 ) ? ( ( $percentused >= 40 ) ? 'waiting' : 'approved' ) : 'spam';
535
+ $used = round( $used, 2 );
536
+ $percentused = number_format( $percentused );
537
+
538
+ ?>
539
+ <p class="sub musub" style="position:static" ><?php _e( 'Storage Space' ); ?></p>
540
+ <div class="table table_content musubtable">
541
+ <table>
542
+ <tr class="first">
543
+ <td class="first b b-posts"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $quota ); ?></td>
544
+ <td class="t posts"><?php _e( 'Space Allowed' ); ?></td>
545
+ </tr>
546
+ </table>
547
+ </div>
548
+ <div class="table table_discussion musubtable">
549
+ <table>
550
+ <tr class="first">
551
+ <td class="b b-comments"><?php printf( __( '<a href="%1$s" title="Manage Uploads" class="musublink">%2$sMB (%3$s%%)</a>' ), esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ), $used, $percentused ); ?></td>
552
+ <td class="last t comments <?php echo $used_color;?>"><?php _e( 'Space Used' );?></td>
553
+ </tr>
554
+ </table>
555
+ </div>
556
+ <br class="clear" />
557
+ <?php
558
+ }
559
+
560
+ /**
561
+ * Looks up for translation file
562
+ *
563
+ * @return void
564
+ */
565
+ function ngg_widget_locale() {
566
+
567
+ require_once(NGGALLERY_ABSPATH . '/lib/locale.php');
568
+
569
+ $locale = new ngg_locale();
570
+
571
+ $overview_url = admin_url() . 'admin.php?page=' . NGGFOLDER;
572
+
573
+ // Check if someone would like to update the translation file
574
+ if ( isset($_GET['locale']) && $_GET['locale'] == 'update' ) {
575
+ check_admin_referer('ngg_update_locale');
576
+
577
+ $result = $locale->download_locale();
578
+
579
+ if ($result == true) {
580
+ ?>
581
+ <p class="hint"><?php _e('Translation file successful updated. Please reload page.', 'nggallery'); ?></p>
582
+ <p class="textright">
583
+ <a class="button" href="<?php echo esc_url(strip_tags($overview_url)); ?>"><?php _e('Reload page', 'nggallery'); ?></a>
584
+ </p>
585
+ <?php
586
+ } else {
587
+ ?>
588
+ <p class="hint"><?php _e('Translation file couldn\'t be updated', 'nggallery'); ?></p>
589
+ <?php
590
+ }
591
+
592
+ return;
593
+ }
594
+
595
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
596
+ }
597
+
598
+ function ngg_locale() {
599
+ global $ngg;
600
+
601
+ require_once(NGGALLERY_ABSPATH . '/lib/locale.php');
602
+
603
+ $locale = new ngg_locale();
604
+ $overview_url = admin_url() . 'admin.php?page=' . NGGFOLDER;
605
+ $result = $locale->check();
606
+ $update_url = wp_nonce_url ( $overview_url . '&amp;locale=update', 'ngg_update_locale');
607
+
608
+ //Translators can change this text via gettext
609
+ if ($result == 'installed') {
610
+ echo $ngg->translator;
611
+ if ( !is_wp_error($locale->response) && $locale->response['response']['code'] == '200') {
612
+ ?>
613
+ <p class="textright">
614
+ <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Update', 'nggallery'); ?></a>
615
+ </p>
616
+ <?php
617
+ }
618
+ }
619
+
620
+ //Translators can change this text via gettext
621
+ if ($result == 'available') {
622
+ ?>
623
+ <p><strong>Download now your language file !</strong></p>
624
+ <p class="textright">
625
+ <a class="button" href="<?php echo esc_url( strip_tags($update_url) ); ?>"><?php _e('Download', 'nggallery'); ?></a>
626
+ </p>
627
+ <?php
628
+ }
629
+
630
+
631
+ if ($result == 'not_exist')
632
+ echo '<p class="hint">'. sprintf( '<strong>Would you like to help translating this plugin?</strong> <a target="_blank" href="%s">Download</a> the current pot file and read <a href="http://www.nextgen-gallery.com/translating-nextgen-gallery/">here</a> how you can translate the plugin.', NGGALLERY_URLPATH . 'lang/nggallery.pot').'</p>';
633
+
634
+ }
635
+
636
+ /**
637
+ * Show GD Library version information
638
+ *
639
+ * @return void
640
+ */
641
+ function ngg_gd_info() {
642
+
643
+ if(function_exists("gd_info")){
644
+ $info = gd_info();
645
+ $keys = array_keys($info);
646
+ for($i=0; $i<count($keys); $i++) {
647
+ if(is_bool($info[$keys[$i]]))
648
+ echo "<li> " . $keys[$i] ." : <span>" . ngg_gd_yesNo($info[$keys[$i]]) . "</span></li>\n";
649
+ else
650
+ echo "<li> " . $keys[$i] ." : <span>" . $info[$keys[$i]] . "</span></li>\n";
651
+ }
652
+ }
653
+ else {
654
+ echo '<h4>'.__('No GD support', 'nggallery').'!</h4>';
655
+ }
656
+ }
657
+
658
+ /**
659
+ * Return localized Yes or no
660
+ *
661
+ * @param bool $bool
662
+ * @return return 'Yes' | 'No'
663
+ */
664
+ function ngg_gd_yesNo( $bool ){
665
+ if($bool)
666
+ return __('Yes', 'nggallery');
667
+ else
668
+ return __('No', 'nggallery');
669
+ }
670
+
671
+
672
+ /**
673
+ * Show up some server infor's
674
+ * @author GamerZ (http://www.lesterchan.net)
675
+ *
676
+ * @return void
677
+ */
678
+ function ngg_get_serverinfo() {
679
+
680
+ global $wpdb, $ngg;
681
+ // Get MYSQL Version
682
+ $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
683
+ // GET SQL Mode
684
+ $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
685
+ if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value;
686
+ if (empty($sql_mode)) $sql_mode = __('Not set', 'nggallery');
687
+ // Get PHP Safe Mode
688
+ if(ini_get('safe_mode')) $safe_mode = __('On', 'nggallery');
689
+ else $safe_mode = __('Off', 'nggallery');
690
+ // Get PHP allow_url_fopen
691
+ if(ini_get('allow_url_fopen')) $allow_url_fopen = __('On', 'nggallery');
692
+ else $allow_url_fopen = __('Off', 'nggallery');
693
+ // Get PHP Max Upload Size
694
+ if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
695
+ else $upload_max = __('N/A', 'nggallery');
696
+ // Get PHP Output buffer Size
697
+ if(ini_get('pcre.backtrack_limit')) $backtrack_limit = ini_get('pcre.backtrack_limit');
698
+ else $backtrack_limit = __('N/A', 'nggallery');
699
+ // Get PHP Max Post Size
700
+ if(ini_get('post_max_size')) $post_max = ini_get('post_max_size');
701
+ else $post_max = __('N/A', 'nggallery');
702
+ // Get PHP Max execution time
703
+ if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time');
704
+ else $max_execute = __('N/A', 'nggallery');
705
+ // Get PHP Memory Limit
706
+ if(ini_get('memory_limit')) $memory_limit = $ngg->memory_limit;
707
+ else $memory_limit = __('N/A', 'nggallery');
708
+ // Get actual memory_get_usage
709
+ if (function_exists('memory_get_usage')) $memory_usage = round(memory_get_usage() / 1024 / 1024, 2) . __(' MByte', 'nggallery');
710
+ else $memory_usage = __('N/A', 'nggallery');
711
+ // required for EXIF read
712
+ if (is_callable('exif_read_data')) $exif = __('Yes', 'nggallery'). " ( V" . substr(phpversion('exif'),0,4) . ")" ;
713
+ else $exif = __('No', 'nggallery');
714
+ // required for meta data
715
+ if (is_callable('iptcparse')) $iptc = __('Yes', 'nggallery');
716
+ else $iptc = __('No', 'nggallery');
717
+ // required for meta data
718
+ if (is_callable('xml_parser_create')) $xml = __('Yes', 'nggallery');
719
+ else $xml = __('No', 'nggallery');
720
+
721
+ ?>
722
+ <li><?php _e('Operating System', 'nggallery'); ?> : <span><?php echo PHP_OS; ?>&nbsp;(<?php echo (PHP_INT_SIZE * 8) ?>&nbsp;Bit)</span></li>
723
+ <li><?php _e('Server', 'nggallery'); ?> : <span><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></span></li>
724
+ <li><?php _e('Memory usage', 'nggallery'); ?> : <span><?php echo $memory_usage; ?></span></li>
725
+ <li><?php _e('MYSQL Version', 'nggallery'); ?> : <span><?php echo $sqlversion; ?></span></li>
726
+ <li><?php _e('SQL Mode', 'nggallery'); ?> : <span><?php echo $sql_mode; ?></span></li>
727
+ <li><?php _e('PHP Version', 'nggallery'); ?> : <span><?php echo PHP_VERSION; ?></span></li>
728
+ <li><?php _e('PHP Safe Mode', 'nggallery'); ?> : <span><?php echo $safe_mode; ?></span></li>
729
+ <li><?php _e('PHP Allow URL fopen', 'nggallery'); ?> : <span><?php echo $allow_url_fopen; ?></span></li>
730
+ <li><?php _e('PHP Memory Limit', 'nggallery'); ?> : <span><?php echo $memory_limit; ?></span></li>
731
+ <li><?php _e('PHP Max Upload Size', 'nggallery'); ?> : <span><?php echo $upload_max; ?></span></li>
732
+ <li><?php _e('PHP Max Post Size', 'nggallery'); ?> : <span><?php echo $post_max; ?></span></li>
733
+ <li><?php _e('PCRE Backtracking Limit', 'nggallery'); ?> : <span><?php echo $backtrack_limit; ?></span></li>
734
+ <li><?php _e('PHP Max Script Execute Time', 'nggallery'); ?> : <span><?php echo $max_execute; ?>s</span></li>
735
+ <li><?php _e('PHP Exif support', 'nggallery'); ?> : <span><?php echo $exif; ?></span></li>
736
+ <li><?php _e('PHP IPTC support', 'nggallery'); ?> : <span><?php echo $iptc; ?></span></li>
737
+ <li><?php _e('PHP XML support', 'nggallery'); ?> : <span><?php echo $xml; ?></span></li>
738
+ <?php
739
+ }
740
+
741
+ /**
742
+ * Inform about the end of PHP4
743
+ *
744
+ * @return void
745
+ */
746
+ function ngg_check_for_PHP5() {
747
+ ?>
748
+ <div class="updated">
749
+ <p><?php _e('NextGEN Gallery contains some functions which are only available under PHP 5.2. You are using the old PHP 4 version, upgrade now! It\'s no longer supported by the PHP group. Many shared hosting providers offer both PHP 4 and PHP 5, running simultaneously. Ask your provider if they can do this.', 'nggallery'); ?></p>
750
+ </div>
751
+ <?php
752
+ }
753
+
754
+ /**
755
+ * ngg_get_phpinfo() - Extract all of the data from phpinfo into a nested array
756
+ *
757
+ * @author jon@sitewizard.ca
758
+ * @return array
759
+ */
760
+ function ngg_get_phpinfo() {
761
+
762
+ ob_start();
763
+ phpinfo();
764
+ $phpinfo = array('phpinfo' => array());
765
+
766
+ if ( preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER) )
767
+ foreach($matches as $match) {
768
+ if(strlen($match[1]))
769
+ $phpinfo[$match[1]] = array();
770
+ elseif(isset($match[3]))
771
+ $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
772
+ else
773
+ $phpinfo[end(array_keys($phpinfo))][] = $match[2];
774
+ }
775
+
776
+ return $phpinfo;
777
+ }
778
+
779
+ /**
780
+ * Show NextGEN Gallery related plugins. Fetch plugins from wp.org which have added 'nextgen-gallery' as tag in readme.txt
781
+ *
782
+ * @return postbox output
783
+ */
784
+ function ngg_widget_related_plugins() {
785
+ echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>';
786
+ }
787
+ function ngg_related_plugins() {
788
+ include(ABSPATH . 'wp-admin/includes/plugin-install.php');
789
+
790
+ if ( false === ( $api = get_transient( 'ngg_related_plugins' ) ) ) {
791
+ // this api sucks , tags will not be used in the correct way : nextgen-gallery cannot be searched
792
+ $api = plugins_api('query_plugins', array('search' => 'nextgen') );
793
+
794
+ if ( is_wp_error($api) )
795
+ return;
796
+
797
+ set_transient( 'ngg_related_plugins', $api, 60*60*24 );
798
+ }
799
+
800
+ echo '<div style="margin-bottom:10px;padding:8px;font-size:110%;background:#eebbaa;"><b>Note</b>: these plugins are provided by third parties and are <b>NOT</b> supported by Photocrati Media in any way</div>';
801
+
802
+ // don't show my own plugin :-) and some other plugins, which come up with the search result
803
+ $blacklist = array(
804
+ 'nextgen-gallery',
805
+ 'galleria-wp',
806
+ 'photosmash-galleries',
807
+ 'flash-album-gallery',
808
+ 'events-calendar',
809
+ 'widgets',
810
+ 'side-content',
811
+ 'featurific-for-wordpress',
812
+ 'smooth-gallery-replacement',
813
+ 'livesig',
814
+ 'wordpress-gallery-slideshow',
815
+ 'nkmimagefield',
816
+ 'nextgen-ajax',
817
+ 'projectmanager'
818
+ );
819
+
820
+ $i = 0;
821
+ while ( $i < 4 ) {
822
+
823
+ // pick them randomly
824
+ if ( 0 == count($api->plugins) )
825
+ return;
826
+
827
+ $key = array_rand($api->plugins);
828
+ $plugin = $api->plugins[$key];
829
+
830
+ // don't forget to remove them
831
+ unset($api->plugins[$key]);
832
+
833
+ if ( !isset($plugin->name) )
834
+ continue;
835
+
836
+ if ( in_array($plugin->slug , $blacklist ) )
837
+ continue;
838
+
839
+ $link = esc_url( $plugin->homepage );
840
+ $title = esc_html( $plugin->name );
841
+
842
+ $description = esc_html( strip_tags(@html_entity_decode($plugin->short_description, ENT_QUOTES, get_option('blog_charset'))) );
843
+
844
+ $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin->slug, 'install-plugin_' . $plugin->slug) .
845
+ '&amp;TB_iframe=true&amp;width=600&amp;height=800';
846
+
847
+ echo "<h5><a href='{$link}' target='_blank'>{$title}</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
848
+ echo "<p>$description<strong> " . __( 'Author' ) . " : </strong>$plugin->author</p>\n";
849
+
850
+ $i++;
851
+ }
852
+
853
+ }
854
+ ?>
admin/roles.php CHANGED
@@ -1,139 +1,140 @@
1
- <?php
2
-
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
-
5
- function nggallery_admin_roles() {
6
-
7
- if ( isset($_POST['update_cap']) ) {
8
-
9
- check_admin_referer('ngg_addroles');
10
-
11
- // now set or remove the capability
12
- ngg_set_capability($_POST['general'],"NextGEN Gallery overview");
13
- ngg_set_capability($_POST['tinymce'],"NextGEN Use TinyMCE");
14
- ngg_set_capability($_POST['add_gallery'],"NextGEN Upload images");
15
- ngg_set_capability($_POST['manage_gallery'],"NextGEN Manage gallery");
16
- ngg_set_capability($_POST['manage_others'],"NextGEN Manage others gallery");
17
- ngg_set_capability($_POST['manage_tags'],"NextGEN Manage tags");
18
- ngg_set_capability($_POST['edit_album'],"NextGEN Edit album");
19
- ngg_set_capability($_POST['change_style'],"NextGEN Change style");
20
- ngg_set_capability($_POST['change_options'],"NextGEN Change options");
21
-
22
- nggGallery::show_message(__('Updated capabilities',"nggallery"));
23
- }
24
-
25
- ?>
26
- <div class="wrap">
27
- <?php screen_icon( 'nextgen-gallery' ); ?>
28
- <h2><?php _e('Roles / capabilities', 'nggallery') ;?></h2>
29
- <p><?php _e('Select the lowest role which should be able to access the following capabilities. NextGEN Gallery supports the standard roles from WordPress.', 'nggallery') ?> <br />
30
- <?php _e('For a more flexible user management you can use the', 'nggallery') ?> <a href="http://wordpress.org/extend/plugins/capsman/" target="_blank">Capability Manager</a>.</p>
31
- <form name="addroles" id="addroles" method="POST" accept-charset="utf-8" >
32
- <?php wp_nonce_field('ngg_addroles') ?>
33
- <table class="form-table">
34
- <tr valign="top">
35
- <th scope="row"><?php _e('Main NextGEN Gallery overview', 'nggallery') ;?>:</th>
36
- <td><label for="general"><select name="general" id="general"><?php wp_dropdown_roles( ngg_get_role('NextGEN Gallery overview') ); ?></select></label></td>
37
- </tr>
38
- <tr valign="top">
39
- <th scope="row"><?php _e('Use TinyMCE Button / Upload tab', 'nggallery') ;?>:</th>
40
- <td><label for="tinymce"><select name="tinymce" id="tinymce"><?php wp_dropdown_roles( ngg_get_role('NextGEN Use TinyMCE') ); ?></select></label></td>
41
- </tr>
42
- <tr valign="top">
43
- <th scope="row"><?php _e('Add gallery / Upload images', 'nggallery') ;?>:</th>
44
- <td><label for="add_gallery"><select name="add_gallery" id="add_gallery"><?php wp_dropdown_roles( ngg_get_role('NextGEN Upload images') ); ?></select></label></td>
45
- </tr>
46
- <tr valign="top">
47
- <th scope="row"><?php _e('Manage gallery', 'nggallery') ;?>:</th>
48
- <td><label for="manage_gallery"><select name="manage_gallery" id="manage_gallery"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage gallery') ); ?></select></label></td>
49
- </tr>
50
- <tr valign="top">
51
- <th scope="row"><?php _e('Manage others gallery', 'nggallery') ;?>:</th>
52
- <td><label for="manage_others"><select name="manage_others" id="manage_others"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage others gallery') ); ?></select></label></td>
53
- </tr>
54
- <tr valign="top">
55
- <th scope="row"><?php _e('Manage tags', 'nggallery') ;?>:</th>
56
- <td><label for="manage_tags"><select name="manage_tags" id="manage_tags"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage tags') ); ?></select></label></td>
57
- </tr>
58
- <tr valign="top">
59
- <th scope="row"><?php _e('Edit Album', 'nggallery') ;?>:</th>
60
- <td><label for="edit_album"><select name="edit_album" id="edit_album"><?php wp_dropdown_roles( ngg_get_role('NextGEN Edit album') ); ?></select></label></td>
61
- </tr>
62
- <tr valign="top">
63
- <th scope="row"><?php _e('Change style', 'nggallery') ;?>:</th>
64
- <td><label for="change_style"><select name="change_style" id="change_style"><?php wp_dropdown_roles( ngg_get_role('NextGEN Change style') ); ?></select></label></td>
65
- </tr>
66
- <tr valign="top">
67
- <th scope="row"><?php _e('Change options', 'nggallery') ;?>:</th>
68
- <td><label for="change_options"><select name="change_options" id="change_options"><?php wp_dropdown_roles( ngg_get_role('NextGEN Change options') ); ?></select></label></td>
69
- </tr>
70
- </table>
71
- <div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php _e('Update capabilities', 'nggallery') ;?>"/></div>
72
- </form>
73
- </div>
74
- <?php
75
-
76
- }
77
-
78
- function ngg_get_sorted_roles() {
79
- // This function returns all roles, sorted by user level (lowest to highest)
80
- global $wp_roles;
81
- $roles = $wp_roles->role_objects;
82
- $sorted = array();
83
-
84
- if( class_exists('RoleManager') ) {
85
- foreach( $roles as $role_key => $role_name ) {
86
- $role = get_role($role_key);
87
- if( empty($role) ) continue;
88
- $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
89
- $sorted[$role_user_level] = $role;
90
- }
91
- $sorted = array_values($sorted);
92
- } else {
93
- $role_order = array("subscriber", "contributor", "author", "editor", "administrator");
94
- foreach($role_order as $role_key) {
95
- $sorted[$role_key] = get_role($role_key);
96
- }
97
- }
98
- return $sorted;
99
- }
100
-
101
- function ngg_get_role($capability){
102
- // This function return the lowest roles which has the capabilities
103
- $check_order = ngg_get_sorted_roles();
104
-
105
- $args = array_slice(func_get_args(), 1);
106
- $args = array_merge(array($capability), $args);
107
-
108
- foreach ($check_order as $check_role) {
109
- if ( empty($check_role) )
110
- return false;
111
-
112
- if (call_user_func_array(array(&$check_role, 'has_cap'), $args))
113
- return $check_role->name;
114
- }
115
- return false;
116
- }
117
-
118
- function ngg_set_capability($lowest_role, $capability){
119
- // This function set or remove the $capability
120
- $check_order = ngg_get_sorted_roles();
121
-
122
- $add_capability = false;
123
-
124
- foreach ($check_order as $the_role) {
125
- $role = $the_role->name;
126
-
127
- if ( $lowest_role == $role )
128
- $add_capability = true;
129
-
130
- // If you rename the roles, then please use a role manager plugin
131
-
132
- if ( empty($the_role) )
133
- continue;
134
-
135
- $add_capability ? $the_role->add_cap($capability) : $the_role->remove_cap($capability) ;
136
- }
137
- }
138
-
 
139
  ?>
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ function nggallery_admin_roles() {
6
+
7
+ if ( isset($_POST['update_cap']) ) {
8
+
9
+ check_admin_referer('ngg_addroles');
10
+
11
+ // now set or remove the capability
12
+ ngg_set_capability($_POST['general'],"NextGEN Gallery overview");
13
+ ngg_set_capability($_POST['tinymce'],"NextGEN Use TinyMCE");
14
+ ngg_set_capability($_POST['add_gallery'],"NextGEN Upload images");
15
+ ngg_set_capability($_POST['manage_gallery'],"NextGEN Manage gallery");
16
+ ngg_set_capability($_POST['manage_others'],"NextGEN Manage others gallery");
17
+ ngg_set_capability($_POST['manage_tags'],"NextGEN Manage tags");
18
+ ngg_set_capability($_POST['edit_album'],"NextGEN Edit album");
19
+ ngg_set_capability($_POST['change_style'],"NextGEN Change style");
20
+ ngg_set_capability($_POST['change_options'],"NextGEN Change options");
21
+
22
+ nggGallery::show_message(__('Updated capabilities',"nggallery"));
23
+ }
24
+
25
+ ?>
26
+ <div class="wrap">
27
+ <?php include('templates/social_media_buttons.php'); ?>
28
+ <?php screen_icon( 'nextgen-gallery' ); ?>
29
+ <h2><?php _e('Roles / capabilities', 'nggallery') ;?></h2>
30
+ <p><?php _e('Select the lowest role which should be able to access the following capabilities. NextGEN Gallery supports the standard roles from WordPress.', 'nggallery') ?> <br />
31
+ <?php _e('For a more flexible user management you can use the', 'nggallery') ?> <a href="http://wordpress.org/extend/plugins/capsman/" target="_blank">Capability Manager</a>.</p>
32
+ <form name="addroles" id="addroles" method="POST" accept-charset="utf-8" >
33
+ <?php wp_nonce_field('ngg_addroles') ?>
34
+ <table class="form-table">
35
+ <tr valign="top">
36
+ <th scope="row"><?php _e('Main NextGEN Gallery overview', 'nggallery') ;?>:</th>
37
+ <td><label for="general"><select name="general" id="general"><?php wp_dropdown_roles( ngg_get_role('NextGEN Gallery overview') ); ?></select></label></td>
38
+ </tr>
39
+ <tr valign="top">
40
+ <th scope="row"><?php _e('Use TinyMCE Button / Upload tab', 'nggallery') ;?>:</th>
41
+ <td><label for="tinymce"><select name="tinymce" id="tinymce"><?php wp_dropdown_roles( ngg_get_role('NextGEN Use TinyMCE') ); ?></select></label></td>
42
+ </tr>
43
+ <tr valign="top">
44
+ <th scope="row"><?php _e('Add gallery / Upload images', 'nggallery') ;?>:</th>
45
+ <td><label for="add_gallery"><select name="add_gallery" id="add_gallery"><?php wp_dropdown_roles( ngg_get_role('NextGEN Upload images') ); ?></select></label></td>
46
+ </tr>
47
+ <tr valign="top">
48
+ <th scope="row"><?php _e('Manage gallery', 'nggallery') ;?>:</th>
49
+ <td><label for="manage_gallery"><select name="manage_gallery" id="manage_gallery"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage gallery') ); ?></select></label></td>
50
+ </tr>
51
+ <tr valign="top">
52
+ <th scope="row"><?php _e('Manage others gallery', 'nggallery') ;?>:</th>
53
+ <td><label for="manage_others"><select name="manage_others" id="manage_others"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage others gallery') ); ?></select></label></td>
54
+ </tr>
55
+ <tr valign="top">
56
+ <th scope="row"><?php _e('Manage tags', 'nggallery') ;?>:</th>
57
+ <td><label for="manage_tags"><select name="manage_tags" id="manage_tags"><?php wp_dropdown_roles( ngg_get_role('NextGEN Manage tags') ); ?></select></label></td>
58
+ </tr>
59
+ <tr valign="top">
60
+ <th scope="row"><?php _e('Edit Album', 'nggallery') ;?>:</th>
61
+ <td><label for="edit_album"><select name="edit_album" id="edit_album"><?php wp_dropdown_roles( ngg_get_role('NextGEN Edit album') ); ?></select></label></td>
62
+ </tr>
63
+ <tr valign="top">
64
+ <th scope="row"><?php _e('Change style', 'nggallery') ;?>:</th>
65
+ <td><label for="change_style"><select name="change_style" id="change_style"><?php wp_dropdown_roles( ngg_get_role('NextGEN Change style') ); ?></select></label></td>
66
+ </tr>
67
+ <tr valign="top">
68
+ <th scope="row"><?php _e('Change options', 'nggallery') ;?>:</th>
69
+ <td><label for="change_options"><select name="change_options" id="change_options"><?php wp_dropdown_roles( ngg_get_role('NextGEN Change options') ); ?></select></label></td>
70
+ </tr>
71
+ </table>
72
+ <div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php _e('Update capabilities', 'nggallery') ;?>"/></div>
73
+ </form>
74
+ </div>
75
+ <?php
76
+
77
+ }
78
+
79
+ function ngg_get_sorted_roles() {
80
+ // This function returns all roles, sorted by user level (lowest to highest)
81
+ global $wp_roles;
82
+ $roles = $wp_roles->role_objects;
83
+ $sorted = array();
84
+
85
+ if( class_exists('RoleManager') ) {
86
+ foreach( $roles as $role_key => $role_name ) {
87
+ $role = get_role($role_key);
88
+ if( empty($role) ) continue;
89
+ $role_user_level = array_reduce(array_keys($role->capabilities), array('WP_User', 'level_reduction'), 0);
90
+ $sorted[$role_user_level] = $role;
91
+ }
92
+ $sorted = array_values($sorted);
93
+ } else {
94
+ $role_order = array("subscriber", "contributor", "author", "editor", "administrator");
95
+ foreach($role_order as $role_key) {
96
+ $sorted[$role_key] = get_role($role_key);
97
+ }
98
+ }
99
+ return $sorted;
100
+ }
101
+
102
+ function ngg_get_role($capability){
103
+ // This function return the lowest roles which has the capabilities
104
+ $check_order = ngg_get_sorted_roles();
105
+
106
+ $args = array_slice(func_get_args(), 1);
107
+ $args = array_merge(array($capability), $args);
108
+
109
+ foreach ($check_order as $check_role) {
110
+ if ( empty($check_role) )
111
+ return false;
112
+
113
+ if (call_user_func_array(array(&$check_role, 'has_cap'), $args))
114
+ return $check_role->name;
115
+ }
116
+ return false;
117
+ }
118
+
119
+ function ngg_set_capability($lowest_role, $capability){
120
+ // This function set or remove the $capability
121
+ $check_order = ngg_get_sorted_roles();
122
+
123
+ $add_capability = false;
124
+
125
+ foreach ($check_order as $the_role) {
126
+ $role = $the_role->name;
127
+
128
+ if ( $lowest_role == $role )
129
+ $add_capability = true;
130
+
131
+ // If you rename the roles, then please use a role manager plugin
132
+
133
+ if ( empty($the_role) )
134
+ continue;
135
+
136
+ $add_capability ? $the_role->add_cap($capability) : $the_role->remove_cap($capability) ;
137
+ }
138
+ }
139
+
140
  ?>
admin/rotate.php CHANGED
@@ -1,94 +1,94 @@
1
- <?php
2
- /**
3
-
4
- Custom thumbnail for NGG
5
- Author : Simone Fumagalli | simone@iliveinperego.com
6
- More info and update : http://www.iliveinperego.com/rotate_for_ngg/
7
-
8
- Credits:
9
- NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
10
-
11
- **/
12
-
13
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
14
- require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
15
-
16
- if ( !is_user_logged_in() )
17
- die(__('Cheatin&#8217; uh?'));
18
-
19
- if ( !current_user_can('NextGEN Manage gallery') )
20
- die(__('Cheatin&#8217; uh?'));
21
-
22
- global $wpdb;
23
-
24
- $id = (int) $_GET['id'];
25
-
26
- // let's get the image data
27
- $picture = nggdb::find_image($id);
28
-
29
- include_once( nggGallery::graphic_library() );
30
- $ngg_options = get_option('ngg_options');
31
-
32
- $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
33
- $thumb->resize(350,350);
34
-
35
- // we need the new dimension
36
- $resizedPreviewInfo = $thumb->newDimensions;
37
- $thumb->destruct();
38
-
39
- $preview_image = trailingslashit( home_url() ) . 'index.php?callback=image&amp;pid=' . $picture->pid . '&amp;width=350&amp;height=350';
40
-
41
- ?>
42
-
43
- <script language="JavaScript">
44
- <!--
45
-
46
- function rotateImage() {
47
-
48
- var rotate_angle = jQuery('input[name=ra]:checked').val();
49
-
50
- jQuery.ajax({
51
- url: ajaxurl,
52
- type : "POST",
53
- data: {action: 'rotateImage', id: <?php echo $id ?>, ra: rotate_angle},
54
- cache: false,
55
- success: function (msg) { showMessage('<?php _e('Image rotated', 'nggallery'); ?>') },
56
- error: function (msg, status, errorThrown) { showMessage('<?php _e('Error rotating thumbnail', 'nggallery'); ?>') }
57
- });
58
-
59
- }
60
-
61
- function showMessage(message) {
62
- jQuery('#thumbMsg').html(message);
63
- jQuery('#thumbMsg').css({'display':'block'});
64
- setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
65
-
66
- var d = new Date();
67
- newUrl = jQuery("#imageToEdit").attr("src") + "?" + d.getTime();
68
- jQuery("#imageToEdit").attr("src" , newUrl);
69
-
70
- }
71
-
72
- -->
73
- </script>
74
-
75
- <table width="98%" align="center" style="border:1px solid #DADADA">
76
- <tr style="height : 360px;">
77
- <td valign="middle" align="center" style="background-color:#DADADA; width : 370px;">
78
- <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
79
- </td>
80
- <td>
81
- <input type="radio" name="ra" value="cw" /><?php esc_html_e('90&deg; clockwise', 'nggallery'); ?><br />
82
- <input type="radio" name="ra" value="ccw" /><?php esc_html_e('90&deg; anticlockwise', 'nggallery'); ?><br />
83
- <input type="radio" name="ra" value="fv" /><?php esc_html_e('Flip vertically', 'nggallery'); ?><br />
84
- <input type="radio" name="ra" value="fh" /><?php esc_html_e('Flip horizontally', 'nggallery'); ?>
85
- </td>
86
- </tr>
87
- <tr style="background-color:#DADADA;">
88
-
89
- <td colspan="2">
90
- <input type="button" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>" onclick="rotateImage()" class="button-secondary" style="float:right; margin-left:4px;"/>
91
- <div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
92
- </td>
93
- </tr>
94
  </table>
1
+ <?php
2
+ /**
3
+
4
+ Custom thumbnail for NGG
5
+ Author : Simone Fumagalli | simone@iliveinperego.com
6
+ More info and update : http://www.iliveinperego.com/rotate_for_ngg/
7
+
8
+ Credits:
9
+ NextGen Gallery : Alex Rabe | http://alexrabe.boelinger.com/wordpress-plugins/nextgen-gallery/
10
+
11
+ **/
12
+
13
+ require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
14
+ require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
15
+
16
+ if ( !is_user_logged_in() )
17
+ die(__('Cheatin&#8217; uh?'));
18
+
19
+ if ( !current_user_can('NextGEN Manage gallery') )
20
+ die(__('Cheatin&#8217; uh?'));
21
+
22
+ global $wpdb;
23
+
24
+ $id = (int) $_GET['id'];
25
+
26
+ // let's get the image data
27
+ $picture = nggdb::find_image($id);
28
+
29
+ include_once( nggGallery::graphic_library() );
30
+ $ngg_options = get_option('ngg_options');
31
+
32
+ $thumb = new ngg_Thumbnail($picture->imagePath, TRUE);
33
+ $thumb->resize(350,350);
34
+
35
+ // we need the new dimension
36
+ $resizedPreviewInfo = $thumb->newDimensions;
37
+ $thumb->destruct();
38
+
39
+ $preview_image = trailingslashit( home_url() ) . 'index.php?callback=image&amp;pid=' . $picture->pid . '&amp;width=350&amp;height=350';
40
+
41
+ ?>
42
+
43
+ <script language="JavaScript">
44
+ <!--
45
+
46
+ function rotateImage() {
47
+
48
+ var rotate_angle = jQuery('input[name=ra]:checked').val();
49
+
50
+ jQuery.ajax({
51
+ url: ajaxurl,
52
+ type : "POST",
53
+ data: {action: 'rotateImage', id: <?php echo $id ?>, ra: rotate_angle},
54
+ cache: false,
55
+ success: function (msg) { showMessage('<?php _e('Image rotated', 'nggallery'); ?>') },
56
+ error: function (msg, status, errorThrown) { showMessage('<?php _e('Error rotating thumbnail', 'nggallery'); ?>') }
57
+ });
58
+
59
+ }
60
+
61
+ function showMessage(message) {
62
+ jQuery('#thumbMsg').html(message);
63
+ jQuery('#thumbMsg').css({'display':'block'});
64
+ setTimeout(function(){ jQuery('#thumbMsg').fadeOut('slow'); }, 1500);
65
+
66
+ var d = new Date();
67
+ newUrl = jQuery("#imageToEdit").attr("src") + "?" + d.getTime();
68
+ jQuery("#imageToEdit").attr("src" , newUrl);
69
+
70
+ }
71
+
72
+ -->
73
+ </script>
74
+
75
+ <table width="98%" align="center" style="border:1px solid #DADADA">
76
+ <tr style="height : 360px;">
77
+ <td valign="middle" align="center" style="background-color:#DADADA; width : 370px;">
78
+ <img src="<?php echo esc_url( $preview_image ); ?>" alt="" id="imageToEdit" />
79
+ </td>
80
+ <td>
81
+ <input type="radio" name="ra" value="cw" /><?php esc_html_e('90&deg; clockwise', 'nggallery'); ?><br />
82
+ <input type="radio" name="ra" value="ccw" /><?php esc_html_e('90&deg; anticlockwise', 'nggallery'); ?><br />
83
+ <input type="radio" name="ra" value="fv" /><?php esc_html_e('Flip vertically', 'nggallery'); ?><br />
84
+ <input type="radio" name="ra" value="fh" /><?php esc_html_e('Flip horizontally', 'nggallery'); ?>
85
+ </td>
86
+ </tr>
87
+ <tr style="background-color:#DADADA;">
88
+
89
+ <td colspan="2">
90
+ <input type="button" name="update" value="<?php esc_attr_e('Update', 'nggallery'); ?>" onclick="rotateImage()" class="button-secondary" style="float:right; margin-left:4px;"/>
91
+ <div id="thumbMsg" style="color:#FF0000; display : none;font-size:11px; float:right; width:60%; height:2em; line-height:2em;"></div>
92
+ </td>
93
+ </tr>
94
  </table>
admin/settings.php CHANGED
@@ -1,838 +1,838 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- class nggOptions {
5
-
6
- /**
7
- * PHP4 compatibility layer for calling the PHP5 constructor.
8
- *
9
- */
10
- function nggOptions() {
11
- return $this->__construct();
12
- }
13
-
14
- /**
15
- * nggOptions::__construct()
16
- *
17
- * @return void
18
- */
19
- function __construct() {
20
-
21
- // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
22
- $this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
23
-
24
- //Look for POST updates
25
- if ( !empty($_POST) )
26
- $this->processor();
27
- }
28
-
29
- /**
30
- * Save/Load options and add a new hook for plugins
31
- *
32
- * @return void
33
- */
34
- function processor() {
35
-
36
- global $ngg, $nggRewrite;
37
-
38
- $old_state = $ngg->options['usePermalinks'];
39
- $old_slug = $ngg->options['permalinkSlug'];
40
-
41
- if ( isset($_POST['irDetect']) ) {
42
- check_admin_referer('ngg_settings');
43
- $ngg->options['irURL'] = ngg_search_imagerotator();
44
- update_option('ngg_options', $ngg->options);
45
- }
46
-
47
- if ( isset($_POST['updateoption']) ) {
48
- check_admin_referer('ngg_settings');
49
- // get the hidden option fields, taken from WP core
50
- if ( $_POST['page_options'] )
51
- $options = explode(',', stripslashes($_POST['page_options']));
52
-
53
- if ($options) {
54
- foreach ($options as $option) {
55
- $option = trim($option);
56
- $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
57
- // $value = sanitize_option($option, $value); // This does stripslashes on those that need it
58
- $ngg->options[$option] = $value;
59
- }
60
-
61
- // do not allow a empty string
62
- if ( empty ( $ngg->options['permalinkSlug'] ) )
63
- $ngg->options['permalinkSlug'] = 'nggallery';
64
-
65
- // the path should always end with a slash
66
- $ngg->options['gallerypath'] = trailingslashit($ngg->options['gallerypath']);
67
- $ngg->options['imageMagickDir'] = trailingslashit($ngg->options['imageMagickDir']);
68
-
69
- // the custom sortorder must be ascending
70
- $ngg->options['galSortDir'] = ($ngg->options['galSort'] == 'sortorder') ? 'ASC' : $ngg->options['galSortDir'];
71
- }
72
- // Save options
73
- update_option('ngg_options', $ngg->options);
74
-
75
- // Flush Rewrite rules
76
- if ( $old_state != $ngg->options['usePermalinks'] || $old_slug != $ngg->options['permalinkSlug'] )
77
- $nggRewrite->flush();
78
-
79
- nggGallery::show_message(__('Update Successfully','nggallery'));
80
- }
81
-
82
- if ( isset($_POST['clearcache']) ) {
83
- check_admin_referer('ngg_settings');
84
-
85
- $path = WINABSPATH . $ngg->options['gallerypath'] . 'cache/';
86
-
87
- if (is_dir($path))
88
- if ($handle = opendir($path)) {
89
- while (false !== ($file = readdir($handle))) {
90
- if ($file != '.' && $file != '..') {
91
- @unlink($path . '/' . $file);
92
- }
93
- }
94
- closedir($handle);
95
- }
96
-
97
- nggGallery::show_message(__('Cache cleared','nggallery'));
98
- }
99
-
100
- if ( isset($_POST['createslugs']) ) {
101
- check_admin_referer('ngg_settings');
102
- include_once (dirname (__FILE__) . '/upgrade.php');
103
- ngg_rebuild_unique_slugs::start_rebuild();
104
- }
105
-
106
- do_action( 'ngg_update_options_page' );
107
-
108
- }
109
-
110
- /**
111
- * Render the page content
112
- *
113
- * @return void
114
- */
115
- function controller() {
116
-
117
- // get list of tabs
118
- $tabs = $this->tabs_order();
119
-
120
- ?>
121
- <script type="text/javascript">
122
- jQuery(document).ready(function(){
123
- jQuery('html,body').scrollTop(0);
124
- jQuery("a.switch-expert").hide();
125
- /*
126
- jQuery(".expert").hide();
127
- jQuery("a.switch-expert").click(function(e) {
128
- jQuery(".expert").toggle();
129
- return false;
130
- });
131
- */
132
- jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
133
- jQuery('#slider').css('display', 'block');
134
- /*
135
- jQuery('.picker').ColorPicker({
136
- onSubmit: function(hsb, hex, rgb, el) {
137
- jQuery(el).val(hex);
138
- jQuery(el).ColorPickerHide();
139
- },
140
- onBeforeShow: function () {
141
- jQuery(this).ColorPickerSetColor(this.value);
142
- }
143
- })
144
- .bind('keyup', function(){
145
- jQuery(this).ColorPickerSetColor(this.value);
146
- });
147
- */
148
- });
149
-
150
- function insertcode(value) {
151
- var effectcode;
152
- switch (value) {
153
- case "none":
154
- effectcode = "";
155
- jQuery('#tbImage').hide("slow");
156
- break;
157
- case "thickbox":
158
- effectcode = 'class="thickbox" rel="%GALLERY_NAME%"';
159
- jQuery('#tbImage').show("slow");
160
- break;
161
- case "lightbox":
162
- effectcode = 'rel="lightbox[%GALLERY_NAME%]"';
163
- jQuery('#tbImage').hide("slow");
164
- break;
165
- case "highslide":
166
- effectcode = 'class="highslide" onclick="return hs.expand(this, { slideshowGroup: %GALLERY_NAME% })"';
167
- jQuery('#tbImage').hide("slow");
168
- break;
169
- case "shutter":
170
- effectcode = 'class="shutterset_%GALLERY_NAME%"';
171
- jQuery('#tbImage').hide("slow");
172
- break;
173
- default:
174
- break;
175
- }
176
- jQuery("#thumbCode").val(effectcode);
177
- };
178
-
179
- function setcolor(fileid, color) {
180
- jQuery(fileid).css("background-color", '#' + color );
181
- };
182
- </script>
183
-
184
- <div id="slider" class="wrap" style="display: none;">
185
- <ul id="tabs">
186
- <?php
187
- foreach($tabs as $tab_key => $tab_name) {
188
- echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
189
- }
190
- ?>
191
- </ul>
192
- <?php
193
- foreach($tabs as $tab_key => $tab_name) {
194
- echo "\n\t<div id='$tab_key'>\n";
195
- // Looks for the internal class function, otherwise enable a hook for plugins
196
- if ( method_exists( $this, "tab_$tab_key" ))
197
- call_user_func( array( &$this , "tab_$tab_key") );
198
- else
199
- do_action( 'ngg_tab_content_' . $tab_key );
200
- echo "\n\t</div>";
201
- }
202
- ?>
203
- </div>
204
- <?php
205
-
206
- }
207
-
208
- /**
209
- * Create array for tabs and add a filter for other plugins to inject more tabs
210
- *
211
- * @return array $tabs
212
- */
213
- function tabs_order() {
214
-
215
- $tabs = array();
216
-
217
- $tabs['generaloptions'] = __('General Options', 'nggallery');
218
- $tabs['thumbnails'] = __('Thumbnails', 'nggallery');
219
- $tabs['images'] = __('Images', 'nggallery');
220
- $tabs['gallery'] = _n( 'Gallery', 'Galleries', 1, 'nggallery' );
221
- $tabs['effects'] = __('Effects', 'nggallery');
222
- $tabs['watermark'] = __('Watermark', 'nggallery');
223
- $tabs['slideshow'] = __('Slideshow', 'nggallery');
224
-
225
- $tabs = apply_filters('ngg_settings_tabs', $tabs);
226
-
227
- return $tabs;
228
-
229
- }
230
-
231
- function tab_generaloptions() {
232
- global $ngg;
233
-
234
- ?>
235
- <!-- General Options -->
236
- <h2><?php _e('General Options','nggallery'); ?></h2>
237
- <form name="generaloptions" method="post" action="<?php echo $this->filepath; ?>">
238
- <?php wp_nonce_field('ngg_settings') ?>
239
- <input type="hidden" name="page_options" value="gallerypath,deleteImg,useMediaRSS,usePicLens,usePermalinks,permalinkSlug,graphicLibrary,imageMagickDir,activateTags,appendType,maxImages" />
240
- <table class="form-table ngg-options">
241
- <tr valign="top">
242
- <th align="left"><?php _e('Gallery path','nggallery'); ?></th>
243
- <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="gallerypath" value="<?php echo $ngg->options['gallerypath']; ?>" />
244
- <span class="setting-description"><?php _e('This is the default path for all galleries','nggallery') ?></span></td>
245
- </tr>
246
- <tr class="expert" valign="top">
247
- <th align="left"><?php _e('Delete image files','nggallery'); ?></th>
248
- <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="checkbox" name="deleteImg" value="1" <?php checked('1', $ngg->options['deleteImg']); ?> />
249
- <?php _e('Delete files, when removing a gallery in the database','nggallery'); ?></td>
250
- </tr>
251
- <tr valign="top">
252
- <th align="left"><?php _e('Activate permalinks','nggallery') ?></th>
253
- <td><input type="checkbox" name="usePermalinks" value="1" <?php checked('1', $ngg->options['usePermalinks']); ?> />
254
- <?php _e('When you activate this option, you need to update your permalink structure one time.','nggallery'); ?>
255
- <?php _e('Gallery slug name :','nggallery'); ?>
256
- <input type="text" size="15" name="permalinkSlug" value="<?php echo $ngg->options['permalinkSlug']; ?>" /></td>
257
- </tr>
258
- <tr class="expert">
259
- <th valign="top"><?php _e('Create new URL friendly image slugs','nggallery'); ?></th>
260
- <td><input type="submit" name="createslugs" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
261
- </tr>
262
- <tr class="expert">
263
- <th valign="top"><?php _e('Select graphic library','nggallery'); ?></th>
264
- <td><label><input name="graphicLibrary" type="radio" value="gd" <?php checked('gd', $ngg->options['graphicLibrary']); ?> /> <?php _e('GD Library', 'nggallery') ;?></label><br />
265
- <label><input name="graphicLibrary" type="radio" value="im" <?php checked('im', $ngg->options['graphicLibrary']); ?> /> <?php _e('ImageMagick (Experimental). Path to the library :', 'nggallery') ;?>&nbsp;
266
- <input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="imageMagickDir" value="<?php echo $ngg->options['imageMagickDir']; ?>" /></label>
267
- </td>
268
- </tr>
269
- <tr>
270
- <th align="left"><?php _e('Activate Media RSS feed','nggallery'); ?></th>
271
- <td><input type="checkbox" name="useMediaRSS" value="1" <?php checked('1', $ngg->options['useMediaRSS']); ?> />
272
- <span class="setting-description"><?php _e('A RSS feed will be added to you blog header. Useful for CoolIris/PicLens','nggallery') ?></span></td>
273
- </tr>
274
- <tr>
275
- <th align="left"><?php _e('Activate PicLens/CoolIris support','nggallery'); ?> (<a href="http://www.cooliris.com">CoolIris</a>)</th>
276
- <td><input type="checkbox" name="usePicLens" value="1" <?php checked('1', $ngg->options['usePicLens']); ?> />
277
- <span class="setting-description"><?php _e('When you activate this option, some javascript is added to your site footer. Make sure that wp_footer is called in your theme.','nggallery') ?></span></td>
278
- </tr>
279
- </table>
280
- <h3 class="expert"><?php _e('Tags / Categories','nggallery'); ?></h3>
281
- <table class="expert form-table ngg-options">
282
- <tr>
283
- <th valign="top"><?php _e('Activate related images','nggallery'); ?></th>
284
- <td><input name="activateTags" type="checkbox" value="1" <?php checked('1', $ngg->options['activateTags']); ?> />
285
- <?php _e('This option will append related images to every post','nggallery'); ?>
286
- </td>
287
- </tr>
288
- <tr>
289
- <th valign="top"><?php _e('Match with','nggallery'); ?></th>
290
- <td><label><input name="appendType" type="radio" value="category" <?php checked('category', $ngg->options['appendType']); ?> /> <?php _e('Categories', 'nggallery') ;?></label><br />
291
- <label><input name="appendType" type="radio" value="tags" <?php checked('tags', $ngg->options['appendType']); ?> /> <?php _e('Tags', 'nggallery') ;?></label>
292
- </td>
293
- </tr>
294
- <tr>
295
- <th valign="top"><?php _e('Max. number of images','nggallery'); ?></th>
296
- <td><input type="text" name="maxImages" value="<?php echo $ngg->options['maxImages']; ?>" size="3" maxlength="3" />
297
- <span class="setting-description"><?php _e('0 will show all images','nggallery'); ?></span>
298
- </td>
299
- </tr>
300
- </table>
301
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
302
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes'); ?>"/></div>
303
- </form>
304
- <?php
305
- }
306
-
307
- function tab_thumbnails() {
308
- global $ngg;
309
- ?>
310
- <!-- Thumbnail settings -->
311
- <h2><?php _e('Thumbnail settings','nggallery'); ?></h2>
312
- <form name="thumbnailsettings" method="POST" action="<?php echo $this->filepath.'#thumbnails'; ?>" >
313
- <?php wp_nonce_field('ngg_settings') ?>
314
- <input type="hidden" name="page_options" value="thumbwidth,thumbheight,thumbfix,thumbquality" />
315
- <p><?php _e('Please note : If you change the settings, you need to recreate the thumbnails under -> Manage Gallery .', 'nggallery') ?></p>
316
- <table class="form-table ngg-options">
317
- <tr valign="top">
318
- <th align="left"><?php _e('Width x height (in pixel)','nggallery'); ?></th>
319
- <td><input type="text" size="4" maxlength="4" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="4" maxlength="4" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
320
- <span class="setting-description"><?php _e('These values are maximum values ','nggallery'); ?></span></td>
321
- </tr>
322
- <tr valign="top">
323
- <th align="left"><?php _e('Set fix dimension','nggallery'); ?></th>
324
- <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
325
- <?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></td>
326
- </tr>
327
- <tr class="expert" valign="top">
328
- <th align="left"><?php _e('Thumbnail quality','nggallery'); ?></th>
329
- <td><input type="text" size="3" maxlength="3" name="thumbquality" value="<?php echo $ngg->options['thumbquality']; ?>" /> %</td>
330
- </tr>
331
- </table>
332
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
333
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
334
- </form>
335
- <?php
336
- }
337
-
338
- function tab_images() {
339
- global $ngg;
340
- ?>
341
- <!-- Image settings -->
342
- <h2><?php _e('Image settings','nggallery'); ?></h2>
343
- <form name="imagesettings" method="POST" action="<?php echo $this->filepath.'#images'; ?>" >
344
- <?php wp_nonce_field('ngg_settings') ?>
345
- <input type="hidden" name="page_options" value="imgResize,imgWidth,imgHeight,imgQuality,imgBackup,imgAutoResize" />
346
- <table class="form-table ngg-options">
347
- <tr valign="top">
348
- <th valign="top"><label for="fixratio"><?php _e('Resize Images','nggallery') ?></label></th>
349
- <td><input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
350
- <span class="setting-description"><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></span></td>
351
- </tr>
352
- <tr valign="top">
353
- <th valign="top"><?php _e('Image quality','nggallery'); ?></th>
354
- <td><input type="text" size="3" maxlength="3" name="imgQuality" value="<?php echo $ngg->options['imgQuality']; ?>" /> %</td>
355
- </tr>
356
- <tr>
357
- <th valign="top"><?php _e('Backup original images','nggallery'); ?></th>
358
- <td><input type="checkbox" name="imgBackup" value="1"<?php echo ($ngg->options['imgBackup'] == 1) ? ' checked ="chechked"' : ''; ?>/>
359
- <span class="setting-description"><?php _e('Creates a backup for inserted images','nggallery'); ?></span></td>
360
- </tr>
361
- <tr>
362
- <th valign="top"><?php _e('Automatically resize','nggallery'); ?></th>
363
- <td><input type="checkbox" name="imgAutoResize" value="1"<?php echo ($ngg->options['imgAutoResize'] == 1) ? ' checked ="chechked"' : ''; ?>/>
364
- <span class="setting-description"><?php _e('Automatically resize images on upload.','nggallery') ?></span></td>
365
- </tr>
366
- </table>
367
- <h3 class="expert"><?php _e('Single picture','nggallery') ?></h3>
368
- <table class="expert form-table ngg-options">
369
- <tr>
370
- <th valign="top"><?php _e('Clear cache folder','nggallery'); ?></th>
371
- <td><input type="submit" name="clearcache" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
372
- </tr>
373
- </table>
374
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
375
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
376
- </form>
377
-
378
- <?php
379
- }
380
-
381
- function tab_gallery() {
382
- global $ngg;
383
- ?>
384
- <!-- Gallery settings -->
385
- <h2><?php _e('Gallery settings','nggallery'); ?></h2>
386
- <form name="galleryform" method="POST" action="<?php echo $this->filepath.'#gallery'; ?>" >
387
- <?php wp_nonce_field('ngg_settings') ?>
388
- <input type="hidden" name="page_options" value="galNoPages,galImages,galColumns,galShowSlide,galTextSlide,galTextGallery,galShowOrder,galImgBrowser,galSort,galSortDir,galHiddenImg,galAjaxNav" />
389
- <table class="form-table ngg-options">
390
- <tr class="expert" >
391
- <th valign="top"><?php _e('Deactivate gallery page link','nggallery') ?></th>
392
- <td><input name="galNoPages" type="checkbox" value="1" <?php checked('1', $ngg->options['galNoPages']); ?> />
393
- <?php _e('The album will not link to a gallery subpage. The gallery is shown on the same page.','nggallery') ?>
394
- </td>
395
- </tr>
396
- <tr>
397
- <th valign="top"><?php _e('Number of images per page','nggallery') ?></th>
398
- <td><input type="text" name="galImages" value="<?php echo $ngg->options['galImages']; ?>" size="3" maxlength="3" />
399
- <span class="setting-description"><?php _e('0 will disable pagination, all images on one page','nggallery') ?></span>
400
- </td>
401
- </tr>
402
- <tr>
403
- <th valign="top"><?php _e('Number of columns','nggallery'); ?></th>
404
- <td><input type="text" name="galColumns" value="<?php echo $ngg->options['galColumns']; ?>" size="3" maxlength="3" />
405
- <span class="setting-description"><?php _e('0 will display as much as possible based on the width of your theme. Setting normally only required for captions below the images','nggallery') ?></span>
406
- </td>
407
- </tr>
408
- <tr>
409
- <th valign="top"><?php _e('Integrate slideshow','nggallery'); ?></th>
410
- <td><input name="galShowSlide" type="checkbox" value="1" <?php checked('1', $ngg->options['galShowSlide']); ?> />
411
- <input type="text" name="galTextSlide" value="<?php echo $ngg->options['galTextSlide'] ?>" size="20" />
412
- <input type="text" name="galTextGallery" value="<?php echo $ngg->options['galTextGallery'] ?>" size="20" />
413
- </td>
414
- </tr>
415
- <tr class="expert" >
416
- <th valign="top"><?php _e('Show first','nggallery'); ?></th>
417
- <td><label><input name="galShowOrder" type="radio" value="gallery" <?php checked('gallery', $ngg->options['galShowOrder']); ?> /> <?php _e('Thumbnails', 'nggallery') ;?></label><br />
418
- <label><input name="galShowOrder" type="radio" value="slide" <?php checked('slide', $ngg->options['galShowOrder']); ?> /> <?php _e('Slideshow', 'nggallery') ;?></label>
419
- </td>
420
- </tr>
421
- <tr class="expert" >
422
- <th valign="top"><?php _e('Show ImageBrowser','nggallery'); ?></th>
423
- <td><input name="galImgBrowser" type="checkbox" value="1" <?php checked('1', $ngg->options['galImgBrowser']); ?> />
424
- <?php _e('The gallery will open the ImageBrowser instead the effect.', 'nggallery'); ?>
425
- </td>
426
- </tr>
427
- <tr class="expert" >
428
- <th valign="top"><?php _e('Add hidden images','nggallery'); ?></th>
429
- <td><input name="galHiddenImg" type="checkbox" value="1" <?php checked('1', $ngg->options['galHiddenImg']); ?> />
430
- <?php _e('If pagination is used, this option will still show all images in the modal window (Thickbox, Lightbox etc.). Note : This increases the page load','nggallery'); ?>
431
- </td>
432
- </tr>
433
- <tr class="expert" >
434
- <th valign="top"><?php _e('Enable AJAX pagination','nggallery'); ?></th>
435
- <td><input name="galAjaxNav" type="checkbox" value="1" <?php checked('1', $ngg->options['galAjaxNav']); ?> />
436
- <?php _e('Browse images without reload the page. Note : Works only in combination with Shutter effect','nggallery'); ?>
437
- </td>
438
- </tr>
439
- </table>
440
- <h3 class="expert" ><?php _e('Sort options','nggallery') ?></h3>
441
- <table class="expert form-table ngg-options">
442
- <tr>
443
- <th valign="top"><?php _e('Sort thumbnails','nggallery') ?></th>
444
- <td>
445
- <label><input name="galSort" type="radio" value="sortorder" <?php checked('sortorder', $ngg->options['galSort']); ?> /> <?php _e('Custom order', 'nggallery') ;?></label><br />
446
- <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $ngg->options['galSort']); ?> /> <?php _e('Image ID', 'nggallery') ;?></label><br />
447
- <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $ngg->options['galSort']); ?> /> <?php _e('File name', 'nggallery') ;?></label><br />
448
- <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $ngg->options['galSort']); ?> /> <?php _e('Alt / Title text', 'nggallery') ;?></label><br />
449
- <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $ngg->options['galSort']); ?> /> <?php _e('Date / Time', 'nggallery') ;?></label>
450
- </td>
451
- </tr>
452
- <tr>
453
- <th valign="top"><?php _e('Sort direction','nggallery') ?></th>
454
- <td><label><input name="galSortDir" type="radio" value="ASC" <?php checked('ASC', $ngg->options['galSortDir']); ?> /> <?php _e('Ascending', 'nggallery') ;?></label><br />
455
- <label><input name="galSortDir" type="radio" value="DESC" <?php checked('DESC', $ngg->options['galSortDir']); ?> /> <?php _e('Descending', 'nggallery') ;?></label>
456
- </td>
457
- </tr>
458
- </table>
459
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
460
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
461
- </form>
462
- <?php
463
- }
464
-
465
- function tab_effects() {
466
- global $ngg;
467
- ?>
468
- <!-- Effects settings -->
469
- <h2><?php _e('Effects','nggallery'); ?></h2>
470
- <form name="effectsform" method="POST" action="<?php echo $this->filepath.'#effects'; ?>" >
471
- <?php wp_nonce_field('ngg_settings') ?>
472
- <input type="hidden" name="page_options" value="thumbEffect,thumbCode" />
473
- <p><?php _e('Here you can select the thumbnail effect, NextGEN Gallery will integrate the required HTML code in the images. Please note that only the Shutter and Thickbox effect will automatic added to your theme.','nggallery'); ?>
474
- <?php _e('With the placeholder','nggallery'); ?><strong> %GALLERY_NAME% </strong> <?php _e('you can activate a navigation through the images (depend on the effect). Change the code line only , when you use a different thumbnail effect or you know what you do.','nggallery'); ?></p>
475
- <table class="form-table ngg-options">
476
- <tr valign="top">
477
- <th><?php _e('JavaScript Thumbnail effect','nggallery') ?></th>
478
- <td>
479
- <select size="1" id="thumbEffect" name="thumbEffect" onchange="insertcode(this.value)">
480
- <option value="none" <?php selected('none', $ngg->options['thumbEffect']); ?> ><?php _e('None', 'nggallery') ;?></option>
481
- <option value="thickbox" <?php selected('thickbox', $ngg->options['thumbEffect']); ?> ><?php _e('Thickbox', 'nggallery') ;?></option>
482
- <option value="lightbox" <?php selected('lightbox', $ngg->options['thumbEffect']); ?> ><?php _e('Lightbox', 'nggallery') ;?></option>
483
- <option value="highslide" <?php selected('highslide', $ngg->options['thumbEffect']); ?> ><?php _e('Highslide', 'nggallery') ;?></option>
484
- <option value="shutter" <?php selected('shutter', $ngg->options['thumbEffect']); ?> ><?php _e('Shutter', 'nggallery') ;?></option>
485
- <option value="custom" <?php selected('custom', $ngg->options['thumbEffect']); ?> ><?php _e('Custom', 'nggallery') ;?></option>
486
- </select>
487
- </td>
488
- </tr>
489
- <tr class="expert" valign="top">
490
- <th><?php _e('Link Code line','nggallery') ?></th>
491
- <td><textarea id="thumbCode" name="thumbCode" cols="50" rows="5"><?php echo htmlspecialchars(stripslashes($ngg->options['thumbCode'])); ?></textarea></td>
492
- </tr>
493
- </table>
494
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
495
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
496
- </form>
497
-
498
- <?php
499
- }
500
-
501
- function tab_watermark() {
502
-
503
- global $wpdb, $ngg;
504
-
505
- // take the first image as sample
506
- $imageID = $wpdb->get_var("SELECT MIN(pid) FROM $wpdb->nggpictures");
507
- $imageURL = ($imageID) ? $imageURL = '<img src="'. home_url('index.php') . '?callback=image&amp;pid=' . intval ($imageID) . '&amp;mode=watermark&amp;width=300&amp;height=250" />' : '';
508
-
509
- ?>
510
- <!-- Watermark settings -->
511
- <h2><?php _e('Watermark','nggallery'); ?></h2>
512
- <p><?php _e('Please note : You can only activate the watermark under -> Manage Gallery . This action cannot be undone.', 'nggallery') ?></p>
513
- <form name="watermarkform" method="POST" action="<?php echo $this->filepath.'#watermark'; ?>" >
514
- <?php wp_nonce_field('ngg_settings') ?>
515
- <input type="hidden" name="page_options" value="wmPos,wmXpos,wmYpos,wmType,wmPath,wmFont,wmSize,wmColor,wmText,wmOpaque" />
516
- <div id="wm-preview">
517
- <h3><?php _e('Preview','nggallery') ?></h3>
518
- <p style="text-align:center;"><?php echo $imageURL; ?></p>
519
- <h3><?php _e('Position','nggallery') ?></h3>
520
- <div>
521
- <table id="wm-position">
522
- <tr>
523
- <td valign="top">
524
- <strong><?php _e('Position','nggallery') ?></strong>
525
- <table border="1">
526
- <tr>
527
- <td><input type="radio" name="wmPos" value="topLeft" <?php checked('topLeft', $ngg->options['wmPos']); ?> /></td>
528
- <td><input type="radio" name="wmPos" value="topCenter" <?php checked('topCenter', $ngg->options['wmPos']); ?> /></td>
529
- <td><input type="radio" name="wmPos" value="topRight" <?php checked('topRight', $ngg->options['wmPos']); ?> /></td>
530
- </tr>
531
- <tr>
532
- <td><input type="radio" name="wmPos" value="midLeft" <?php checked('midLeft', $ngg->options['wmPos']); ?> /></td>
533
- <td><input type="radio" name="wmPos" value="midCenter" <?php checked('midCenter', $ngg->options['wmPos']); ?> /></td>
534
- <td><input type="radio" name="wmPos" value="midRight" <?php checked('midRight', $ngg->options['wmPos']); ?> /></td>
535
- </tr>
536
- <tr>
537
- <td><input type="radio" name="wmPos" value="botLeft" <?php checked('botLeft', $ngg->options['wmPos']); ?> /></td>
538
- <td><input type="radio" name="wmPos" value="botCenter" <?php checked('botCenter', $ngg->options['wmPos']); ?> /></td>
539
- <td><input type="radio" name="wmPos" value="botRight" <?php checked('botRight', $ngg->options['wmPos']); ?> /></td>
540
- </tr>
541
- </table>
542
- </td>
543
- <td valign="top">
544
- <strong><?php _e('Offset','nggallery') ?></strong>
545
- <table border="0">
546
- <tr>
547
- <td>x</td>
548
- <td><input type="text" name="wmXpos" value="<?php echo $ngg->options['wmXpos'] ?>" size="4" /> px</td>
549
- </tr>
550
- <tr>
551
- <td>y</td>
552
- <td><input type="text" name="wmYpos" value="<?php echo $ngg->options['wmYpos'] ?>" size="4" /> px</td>
553
- </tr>
554
- </table>
555
- </td>
556
- </tr>
557
- </table>
558
- </div>
559
- </div>
560
- <h3><label><input type="radio" name="wmType" value="image" <?php checked('image', $ngg->options['wmType']); ?> /> <?php _e('Use image as watermark','nggallery') ?></label></h3>
561
- <table class="wm-table form-table">
562
- <tr>
563
- <th><?php _e('URL to file','nggallery') ?></th>
564
- <td><input type="text" size="40" name="wmPath" value="<?php echo $ngg->options['wmPath']; ?>" /><br />
565
- <?php if(!ini_get('allow_url_fopen')) _e('The accessing of URL files is disabled at your server (allow_url_fopen)','nggallery') ?> </td>
566
- </tr>
567
- </table>
568
- <h3><label><input type="radio" name="wmType" value="text" <?php checked('text', $ngg->options['wmType']); ?> /> <?php _e('Use text as watermark','nggallery') ?></label></h3>
569
- <table class="wm-table form-table">
570
- <tr>
571
- <th><?php _e('Font','nggallery') ?></th>
572
- <td><select name="wmFont" size="1"> <?php
573
- $fontlist = ngg_get_TTFfont();
574
- foreach ( $fontlist as $fontfile ) {
575
- echo "\n".'<option value="'.$fontfile.'" '.ngg_input_selected($fontfile, $ngg->options['wmFont']).' >'.$fontfile.'</option>';
576
- }
577
- ?>
578
- </select><br /><span class="setting-description">
579
- <?php if ( !function_exists('ImageTTFBBox') )
580
- _e('This function will not work, cause you need the FreeType library','nggallery');
581
- else
582
- _e('You can upload more fonts in the folder <strong>nggallery/fonts</strong>','nggallery'); ?>
583
- </span>
584
- </td>
585
- </tr>
586
- <tr>
587
- <th><?php _e('Size','nggallery') ?></th>
588
- <td><input type="text" name="wmSize" value="<?php echo $ngg->options['wmSize']; ?>" size="4" maxlength="2" /> px</td>
589
- </tr>
590
- <tr>
591
- <th><?php _e('Color','nggallery') ?></th>
592
- <td><input class="picker" type="text" size="6" maxlength="6" id="wmColor" name="wmColor" onchange="setcolor('#previewText', this.value)" value="<?php echo $ngg->options['wmColor'] ?>" />
593
- <input type="text" size="1" readonly="readonly" id="previewText" style="background-color: #<?php echo $ngg->options['wmColor']; ?>" /> <?php _e('(hex w/o #)','nggallery') ?></td>
594
- </tr>
595
- <tr>
596
- <th valign="top"><?php _e('Text','nggallery') ?></th>
597
- <td><textarea name="wmText" cols="40" rows="4"><?php echo $ngg->options['wmText'] ?></textarea></td>
598
- </tr>
599
- <tr>
600
- <th><?php _e('Opaque','nggallery') ?></th>
601
- <td><input type="text" name="wmOpaque" value="<?php echo $ngg->options['wmOpaque'] ?>" size="3" maxlength="3" /> % </td>
602
- </tr>
603
- </table>
604
- <div class="clear"> &nbsp; </div>
605
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
606
- </form>
607
- <?php
608
- }
609
-
610
- function tab_slideshow() {
611
-
612
- global $ngg;
613
- ?>
614
- <!-- Slideshow settings -->
615
- <form name="player_options" method="POST" action="<?php echo $this->filepath.'#slideshow'; ?>" >
616
- <?php wp_nonce_field('ngg_settings'); ?>
617
- <input type="hidden" name="page_options" value="slideFx,enableIR,irURL,irWidth,irHeight,irShuffle,irLinkfromdisplay,irShownavigation,irShowicons,irWatermark,irOverstretch,irRotatetime,irTransition,irKenburns,irBackcolor,irFrontcolor,irLightcolor,irScreencolor,irAudio,irXHTMLvalid" />
618
- <h2><?php _e('Slideshow','nggallery'); ?></h2>
619
- <table class="form-table ngg-options">
620
- <tr>
621
- <th><?php _e('Default size (W x H)','nggallery') ?></th>
622
- <td><input type="text" size="3" maxlength="4" name="irWidth" value="<?php echo $ngg->options['irWidth']; ?>" /> x
623
- <input type="text" size="3" maxlength="4" name="irHeight" value="<?php echo $ngg->options['irHeight']; ?>" /></td>
624
- </tr>
625
- <tr>
626
- <th><?php _e('Duration time','nggallery') ?></th>
627
- <td><input type="text" size="3" maxlength="3" name="irRotatetime" value="<?php echo $ngg->options['irRotatetime'] ?>" /> <?php _e('sec.', 'nggallery') ;?></td>
628
- </tr>
629
- <tr>
630
- <th><?php _e('Transition / Fade effect','nggallery') ?></th>
631
- <td>
632
- <select size="1" name="slideFx">
633
- <option value="fade" <?php selected('fade', $ngg->options['slideFx']); ?> ><?php _e('fade', 'nggallery') ;?></option>
634
- <option value="blindX" <?php selected('blindX', $ngg->options['slideFx']); ?> ><?php _e('blindX', 'nggallery') ;?></option>
635
- <option value="cover" <?php selected('cover', $ngg->options['slideFx']); ?> ><?php _e('cover', 'nggallery') ;?></option>
636
- <option value="scrollUp" <?php selected('scrollUp', $ngg->options['slideFx']); ?> ><?php _e('scrollUp', 'nggallery') ;?></option>
637
- <option value="scrollDown" <?php selected('scrollDown', $ngg->options['slideFx']); ?> ><?php _e('scrollDown', 'nggallery') ;?></option>
638
- <option value="shuffle" <?php selected('shuffle', $ngg->options['slideFx']); ?> ><?php _e('shuffle', 'nggallery') ;?></option>
639
- <option value="toss" <?php selected('toss', $ngg->options['slideFx']); ?> ><?php _e('toss', 'nggallery') ;?></option>
640
- <option value="wipe" <?php selected('wipe', $ngg->options['slideFx']); ?> ><?php _e('wipe', 'nggallery') ;?></option>
641
- </select>
642
- <span class="description"><?php _e('See here for more information about the effects :', 'nggallery') ?> <a href="http://jquery.malsup.com/cycle/browser.html" target="_blank" >jQuery Cycle</a></span>
643
- </td>
644
- </tr>
645
- </table>
646
- <h3 class="expert" ><?php _e('Settings for the JW Image Rotator','nggallery') ?></h3>
647
- <p><?php _e('The settings are only used in the JW Image Rotator Version', 'nggallery') ?> 3.17 .
648
- <?php _e('See more information for the Flash Player on the web page', 'nggallery') ?> <a href="http://www.longtailvideo.com/players/jw-image-rotator/" target="_blank" >JW Image Rotator from Jeroen Wijering</a>.
649
- </p>
650
- <?php if (empty($ngg->options['irURL']) && ($ngg->options['enableIR'] == '1')) { ?>
651
- <div id="message" class="error inline">
652
- <p>
653
- <?php _e('The path to imagerotator.swf is not defined, the slideshow will not work.','nggallery'); ?><br />
654
- <?php _e('If you would like to use the JW Image Rotatator, please download the player <a href="http://www.longtailvideo.com/players/jw-image-rotator/" target="_blank" >here</a> and upload it to your Upload folder (Default is wp-content/uploads).','nggallery'); ?>
655
- </p>
656
- </div>
657
- <?php }?>
658
- <table class="expert form-table ngg-options">
659
- <tr>
660
- <th><?php _e('Enable flash slideshow','nggallery') ?></th>
661
- <td><input name="enableIR" type="checkbox" value="1" <?php checked('1', $ngg->options['enableIR']); ?> />
662
- <span class="setting-description"><?php _e('Integrate the flash based slideshow for all flash supported devices','nggallery') ?></span></td>
663
- </tr>
664
- <tr>
665
- <th><?php _e('Path to the Imagerotator (URL)','nggallery') ?></th>
666
- <td>
667
- <input type="text" size="50" id="irURL" name="irURL" value="<?php echo $ngg->options['irURL']; ?>" />
668
- <input type="submit" name="irDetect" class="button-secondary" value="<?php _e('Search now','nggallery') ;?> &raquo;"/>
669
- <br /><span class="setting-description"><?php _e('Press the button to search automatically for the imagerotator, if you uploaded it to wp-content/uploads or a subfolder','nggallery') ?></span>
670
- </td>
671
- </tr>
672
- <tr>
673
- <th><?php _e('Shuffle mode','nggallery') ?></th>
674
- <td><input name="irShuffle" type="checkbox" value="1" <?php checked('1', $ngg->options['irShuffle']); ?> /></td>
675
- </tr>
676
- <tr class="expert">
677
- <th><?php _e('Show next image on click','nggallery') ?></th>
678
- <td><input name="irLinkfromdisplay" type="checkbox" value="1" <?php checked('1', $ngg->options['irLinkfromdisplay']); ?> /></td>
679
- </tr>
680
- <tr class="expert">
681
- <th><?php _e('Show navigation bar','nggallery') ?></th>
682
- <td><input name="irShownavigation" type="checkbox" value="1" <?php checked('1', $ngg->options['irShownavigation']); ?> /></td>
683
- </tr>
684
- <tr class="expert">
685
- <th><?php _e('Show loading icon','nggallery') ?></th>
686
- <td><input name="irShowicons" type="checkbox" value="1" <?php checked('1', $ngg->options['irShowicons']); ?> /></td>
687
- </tr>
688
- <tr class="expert">
689
- <th><?php _e('Use watermark logo','nggallery') ?></th>
690
- <td><input name="irWatermark" type="checkbox" value="1" <?php checked('1', $ngg->options['irWatermark']); ?> />
691
- <span class="setting-description"><?php _e('You can change the logo at the watermark settings','nggallery') ?></span></td>
692
- </tr>
693
- <tr class="expert">
694
- <th><?php _e('Stretch image','nggallery') ?></th>
695
- <td>
696
- <select size="1" name="irOverstretch">
697
- <option value="true" <?php selected('true', $ngg->options['irOverstretch']); ?> ><?php _e('true', 'nggallery') ;?></option>
698
- <option value="false" <?php selected('false', $ngg->options['irOverstretch']); ?> ><?php _e('false', 'nggallery') ;?></option>
699
- <option value="fit" <?php selected('fit', $ngg->options['irOverstretch']); ?> ><?php _e('fit', 'nggallery') ;?></option>
700
- <option value="none" <?php selected('none', $ngg->options['irOverstretch']); ?> ><?php _e('none', 'nggallery') ;?></option>
701
- </select>
702
- </td>
703
- </tr>
704
- <tr>
705
- <th><?php _e('Transition / Fade effect','nggallery') ?></th>
706
- <td>
707
- <select size="1" name="irTransition">
708
- <option value="fade" <?php selected('fade', $ngg->options['irTransition']); ?> ><?php _e('fade', 'nggallery') ;?></option>
709
- <option value="bgfade" <?php selected('bgfade', $ngg->options['irTransition']); ?> ><?php _e('bgfade', 'nggallery') ;?></option>
710
- <option value="slowfade" <?php selected('slowfade', $ngg->options['irTransition']); ?> ><?php _e('slowfade', 'nggallery') ;?></option>
711
- <option value="circles" <?php selected('circles', $ngg->options['irTransition']); ?> ><?php _e('circles', 'nggallery') ;?></option>
712
- <option value="bubbles" <?php selected('bubbles', $ngg->options['irTransition']); ?> ><?php _e('bubbles', 'nggallery') ;?></option>
713
- <option value="blocks" <?php selected('blocks', $ngg->options['irTransition']); ?> ><?php _e('blocks', 'nggallery') ;?></option>
714
- <option value="fluids" <?php selected('fluids', $ngg->options['irTransition']); ?> ><?php _e('fluids', 'nggallery') ;?></option>
715
- <option value="flash" <?php selected('flash', $ngg->options['irTransition']); ?> ><?php _e('flash', 'nggallery') ;?></option>
716
- <option value="lines" <?php selected('lines', $ngg->options['irTransition']); ?> ><?php _e('lines', 'nggallery') ;?></option>
717
- <option value="random" <?php selected('random', $ngg->options['irTransition']); ?> ><?php _e('random', 'nggallery') ;?></option>
718
- </select>
719
- </td>
720
- </tr>
721
- <tr class="expert">
722
- <th><?php _e('Use slow zooming effect','nggallery') ?></th>
723
- <td><input name="irKenburns" type="checkbox" value="1" <?php checked('1', $ngg->options['irKenburns']); ?> /></td>
724
- </tr>
725
- <tr>
726
- <th><?php _e('Background Color','nggallery') ?></th>
727
- <td><input class="picker" type="text" size="6" maxlength="6" id="irBackcolor" name="irBackcolor" onchange="setcolor('#previewBack', this.value)" value="<?php echo $ngg->options['irBackcolor'] ?>" />
728
- <input type="text" size="1" readonly="readonly" id="previewBack" style="background-color: #<?php echo $ngg->options['irBackcolor'] ?>" /></td>
729
- </tr>
730
- <tr>
731
- <th><?php _e('Texts / Buttons Color','nggallery') ?></th>
732
- <td><input class="picker" type="text" size="6" maxlength="6" id="irFrontcolor" name="irFrontcolor" onchange="setcolor('#previewFront', this.value)" value="<?php echo $ngg->options['irFrontcolor'] ?>" />
733
- <input type="text" size="1" readonly="readonly" id="previewFront" style="background-color: #<?php echo $ngg->options['irFrontcolor'] ?>" /></td>
734
- </tr>
735
- <tr class="expert">
736
- <th><?php _e('Rollover / Active Color','nggallery') ?></th>
737
- <td><input class="picker" type="text" size="6" maxlength="6" id="irLightcolor" name="irLightcolor" onchange="setcolor('#previewLight', this.value)" value="<?php echo $ngg->options['irLightcolor'] ?>" />
738
- <input type="text" size="1" readonly="readonly" id="previewLight" style="background-color: #<?php echo $ngg->options['irLightcolor'] ?>" /></td>
739
- </tr>
740
- <tr class="expert">
741
- <th><?php _e('Screen Color','nggallery') ?></th>
742
- <td><input class="picker" type="text" size="6" maxlength="6" id="irScreencolor" name="irScreencolor" onchange="setcolor('#previewScreen', this.value)" value="<?php echo $ngg->options['irScreencolor'] ?>" />
743
- <input type="text" size="1" readonly="readonly" id="previewScreen" style="background-color: #<?php echo $ngg->options['irScreencolor'] ?>" /></td>
744
- </tr>
745
- <tr class="expert">
746
- <th><?php _e('Background music (URL)','nggallery') ?></th>
747
- <td><input type="text" size="50" id="irAudio" name="irAudio" value="<?php echo $ngg->options['irAudio'] ?>" /></td>
748
- </tr>
749
- <tr class="expert">
750
- <th ><?php _e('Try XHTML validation (with CDATA)','nggallery') ?></th>
751
- <td><input name="irXHTMLvalid" type="checkbox" value="1" <?php checked('1', $ngg->options['irXHTMLvalid']); ?> />
752
- <span class="setting-description"><?php _e('Important : Could causes problem at some browser. Please recheck your page.','nggallery') ?></span></td>
753
- </tr>
754
- </table>
755
- <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
756
- <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
757
- </form>
758
- <?php
759
- }
760
- }
761
-
762
- function ngg_get_TTFfont() {
763
-
764
- $ttf_fonts = array ();
765
-
766
- // Files in wp-content/plugins/nggallery/fonts directory
767
- $plugin_root = NGGALLERY_ABSPATH . 'fonts';
768
-
769
- $plugins_dir = @ dir($plugin_root);
770
- if ($plugins_dir) {
771
- while (($file = $plugins_dir->read()) !== false) {
772
- if (preg_match('|^\.+$|', $file))
773
- continue;
774
- if (is_dir($plugin_root.'/'.$file)) {
775
- $plugins_subdir = @ dir($plugin_root.'/'.$file);
776
- if ($plugins_subdir) {
777
- while (($subfile = $plugins_subdir->read()) !== false) {
778
- if (preg_match('|^\.+$|', $subfile))
779
- continue;
780
- if (preg_match('|\.ttf$|', $subfile))
781
- $ttf_fonts[] = "$file/$subfile";
782
- }
783
- }
784
- } else {
785
- if (preg_match('|\.ttf$|', $file))
786
- $ttf_fonts[] = $file;
787
- }
788
- }
789
- }
790
-
791
- return $ttf_fonts;
792
- }
793
-
794
- function ngg_search_imagerotator() {
795
- global $wpdb;
796
-
797
- $upload = wp_upload_dir();
798
-
799
- // look first at the old place and move it to wp-content/uploads
800
- if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
801
- @rename(NGGALLERY_ABSPATH . 'imagerotator.swf', $upload['basedir'] . '/imagerotator.swf');
802
-
803
- // This should be the new place
804
- if ( file_exists( $upload['basedir'] . '/imagerotator.swf' ) )
805
- return $upload['baseurl'] . '/imagerotator.swf';
806
-
807
- // Find the path to the imagerotator via the media library
808
- if ( $path = $wpdb->get_var( "SELECT guid FROM {$wpdb->posts} WHERE guid LIKE '%imagerotator.swf%'" ) )
809
- return $path;
810
-
811
- // maybe it's located at wp-content
812
- if ( file_exists( WP_CONTENT_DIR . '/imagerotator.swf' ) )
813
- return WP_CONTENT_URL . '/imagerotator.swf';
814
-
815
- // or in the plugin folder
816
- if ( file_exists( WP_PLUGIN_DIR . '/imagerotator.swf' ) )
817
- return WP_PLUGIN_URL . '/imagerotator.swf';
818
-
819
- // this is deprecated and will be ereased during a automatic upgrade
820
- if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
821
- return NGGALLERY_URLPATH . 'imagerotator.swf';
822
-
823
- return '';
824
- }
825
-
826
- /**********************************************************/
827
- // taken from WP Core
828
-
829
- function ngg_input_selected( $selected, $current) {
830
- if ( $selected == $current)
831
- return ' selected="selected"';
832
- }
833
-
834
- function ngg_input_checked( $checked, $current) {
835
- if ( $checked == $current)
836
- return ' checked="checked"';
837
- }
838
  ?>
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ class nggOptions {
5
+
6
+ /**
7
+ * PHP4 compatibility layer for calling the PHP5 constructor.
8
+ *
9
+ */
10
+ function nggOptions() {
11
+ return $this->__construct();
12
+ }
13
+
14
+ /**
15
+ * nggOptions::__construct()
16
+ *
17
+ * @return void
18
+ */
19
+ function __construct() {
20
+
21
+ // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
22
+ $this->filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
23
+
24
+ //Look for POST updates
25
+ if ( !empty($_POST) )
26
+ $this->processor();
27
+ }
28
+
29
+ /**
30
+ * Save/Load options and add a new hook for plugins
31
+ *
32
+ * @return void
33
+ */
34
+ function processor() {
35
+
36
+ global $ngg, $nggRewrite;
37
+
38
+ $old_state = $ngg->options['usePermalinks'];
39
+ $old_slug = $ngg->options['permalinkSlug'];
40
+
41
+ if ( isset($_POST['irDetect']) ) {
42
+ check_admin_referer('ngg_settings');
43
+ $ngg->options['irURL'] = ngg_search_imagerotator();
44
+ update_option('ngg_options', $ngg->options);
45
+ }
46
+
47
+ if ( isset($_POST['updateoption']) ) {
48
+ check_admin_referer('ngg_settings');
49
+ // get the hidden option fields, taken from WP core
50
+ if ( $_POST['page_options'] )
51
+ $options = explode(',', stripslashes($_POST['page_options']));
52
+
53
+ if ($options) {
54
+ foreach ($options as $option) {
55
+ $option = trim($option);
56
+ $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
57
+ // $value = sanitize_option($option, $value); // This does stripslashes on those that need it
58
+ $ngg->options[$option] = $value;
59
+ }
60
+
61
+ // do not allow a empty string
62
+ if ( empty ( $ngg->options['permalinkSlug'] ) )
63
+ $ngg->options['permalinkSlug'] = 'nggallery';
64
+
65
+ // the path should always end with a slash
66
+ $ngg->options['gallerypath'] = trailingslashit($ngg->options['gallerypath']);
67
+ $ngg->options['imageMagickDir'] = trailingslashit($ngg->options['imageMagickDir']);
68
+
69
+ // the custom sortorder must be ascending
70
+ $ngg->options['galSortDir'] = ($ngg->options['galSort'] == 'sortorder') ? 'ASC' : $ngg->options['galSortDir'];
71
+ }
72
+ // Save options
73
+ update_option('ngg_options', $ngg->options);
74
+
75
+ // Flush Rewrite rules
76
+ if ( $old_state != $ngg->options['usePermalinks'] || $old_slug != $ngg->options['permalinkSlug'] )
77
+ $nggRewrite->flush();
78
+
79
+ nggGallery::show_message(__('Update Successfully','nggallery'));
80
+ }
81
+
82
+ if ( isset($_POST['clearcache']) ) {
83
+ check_admin_referer('ngg_settings');
84
+
85
+ $path = WINABSPATH . $ngg->options['gallerypath'] . 'cache/';
86
+
87
+ if (is_dir($path))
88
+ if ($handle = opendir($path)) {
89
+ while (false !== ($file = readdir($handle))) {
90
+ if ($file != '.' && $file != '..') {
91
+ @unlink($path . '/' . $file);
92
+ }
93
+ }
94
+ closedir($handle);
95
+ }
96
+
97
+ nggGallery::show_message(__('Cache cleared','nggallery'));
98
+ }
99
+
100
+ if ( isset($_POST['createslugs']) ) {
101
+ check_admin_referer('ngg_settings');
102
+ include_once (dirname (__FILE__) . '/upgrade.php');
103
+ ngg_rebuild_unique_slugs::start_rebuild();
104
+ }
105
+
106
+ do_action( 'ngg_update_options_page' );
107
+
108
+ }
109
+
110
+ /**
111
+ * Render the page content
112
+ *
113
+ * @return void
114
+ */
115
+ function controller() {
116
+
117
+ // get list of tabs
118
+ $tabs = $this->tabs_order();
119
+
120
+ ?>
121
+ <script type="text/javascript">
122
+ jQuery(document).ready(function(){
123
+ jQuery('html,body').scrollTop(0);
124
+ jQuery("a.switch-expert").hide();
125
+ /*
126
+ jQuery(".expert").hide();
127
+ jQuery("a.switch-expert").click(function(e) {
128
+ jQuery(".expert").toggle();
129
+ return false;
130
+ });
131
+ */
132
+ jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
133
+ jQuery('#slider').css('display', 'block');
134
+ /*
135
+ jQuery('.picker').ColorPicker({
136
+ onSubmit: function(hsb, hex, rgb, el) {
137
+ jQuery(el).val(hex);
138
+ jQuery(el).ColorPickerHide();
139
+ },
140
+ onBeforeShow: function () {
141
+ jQuery(this).ColorPickerSetColor(this.value);
142
+ }
143
+ })
144
+ .bind('keyup', function(){
145
+ jQuery(this).ColorPickerSetColor(this.value);
146
+ });
147
+ */
148
+ });
149
+
150
+ function insertcode(value) {
151
+ var effectcode;
152
+ switch (value) {
153
+ case "none":
154
+ effectcode = "";
155
+ jQuery('#tbImage').hide("slow");
156
+ break;
157
+ case "thickbox":
158
+ effectcode = 'class="thickbox" rel="%GALLERY_NAME%"';
159
+ jQuery('#tbImage').show("slow");
160
+ break;
161
+ case "lightbox":
162
+ effectcode = 'rel="lightbox[%GALLERY_NAME%]"';
163
+ jQuery('#tbImage').hide("slow");
164
+ break;
165
+ case "highslide":
166
+ effectcode = 'class="highslide" onclick="return hs.expand(this, { slideshowGroup: %GALLERY_NAME% })"';
167
+ jQuery('#tbImage').hide("slow");
168
+ break;
169
+ case "shutter":
170
+ effectcode = 'class="shutterset_%GALLERY_NAME%"';
171
+ jQuery('#tbImage').hide("slow");
172
+ break;
173
+ default:
174
+ break;
175
+ }
176
+ jQuery("#thumbCode").val(effectcode);
177
+ };
178
+
179
+ function setcolor(fileid, color) {
180
+ jQuery(fileid).css("background-color", '#' + color );
181
+ };
182
+ </script>
183
+ <?php include('templates/social_media_buttons.php'); ?>
184
+ <div id="slider" class="wrap" style="display: none;">
185
+ <ul id="tabs">
186
+ <?php
187
+ foreach($tabs as $tab_key => $tab_name) {
188
+ echo "\n\t\t<li><a href='#$tab_key'>$tab_name</a></li>";
189
+ }
190
+ ?>
191
+ </ul>
192
+ <?php
193
+ foreach($tabs as $tab_key => $tab_name) {
194
+ echo "\n\t<div id='$tab_key'>\n";
195
+ // Looks for the internal class function, otherwise enable a hook for plugins
196
+ if ( method_exists( $this, "tab_$tab_key" ))
197
+ call_user_func( array( &$this , "tab_$tab_key") );
198
+ else
199
+ do_action( 'ngg_tab_content_' . $tab_key );
200
+ echo "\n\t</div>";
201
+ }
202
+ ?>
203
+ </div>
204
+ <?php
205
+
206
+ }
207
+
208
+ /**
209
+ * Create array for tabs and add a filter for other plugins to inject more tabs
210
+ *
211
+ * @return array $tabs
212
+ */
213
+ function tabs_order() {
214
+
215
+ $tabs = array();
216
+
217
+ $tabs['generaloptions'] = __('General Options', 'nggallery');
218
+ $tabs['thumbnails'] = __('Thumbnails', 'nggallery');
219
+ $tabs['images'] = __('Images', 'nggallery');
220
+ $tabs['gallery'] = _n( 'Gallery', 'Galleries', 1, 'nggallery' );
221
+ $tabs['effects'] = __('Effects', 'nggallery');
222
+ $tabs['watermark'] = __('Watermark', 'nggallery');
223
+ $tabs['slideshow'] = __('Slideshow', 'nggallery');
224
+
225
+ $tabs = apply_filters('ngg_settings_tabs', $tabs);
226
+
227
+ return $tabs;
228
+
229
+ }
230
+
231
+ function tab_generaloptions() {
232
+ global $ngg;
233
+
234
+ ?>
235
+ <!-- General Options -->
236
+ <h2><?php _e('General Options','nggallery'); ?></h2>
237
+ <form name="generaloptions" method="post" action="<?php echo $this->filepath; ?>">
238
+ <?php wp_nonce_field('ngg_settings') ?>
239
+ <input type="hidden" name="page_options" value="gallerypath,deleteImg,useMediaRSS,usePicLens,usePermalinks,permalinkSlug,graphicLibrary,imageMagickDir,activateTags,appendType,maxImages" />
240
+ <table class="form-table ngg-options">
241
+ <tr valign="top">
242
+ <th align="left"><?php _e('Gallery path','nggallery'); ?></th>
243
+ <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="gallerypath" value="<?php echo $ngg->options['gallerypath']; ?>" />
244
+ <span class="setting-description"><?php _e('This is the default path for all galleries','nggallery') ?></span></td>
245
+ </tr>
246
+ <tr class="expert" valign="top">
247
+ <th align="left"><?php _e('Delete image files','nggallery'); ?></th>
248
+ <td><input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="checkbox" name="deleteImg" value="1" <?php checked('1', $ngg->options['deleteImg']); ?> />
249
+ <?php _e('Delete files, when removing a gallery in the database','nggallery'); ?></td>
250
+ </tr>
251
+ <tr valign="top">
252
+ <th align="left"><?php _e('Activate permalinks','nggallery') ?></th>
253
+ <td><input type="checkbox" name="usePermalinks" value="1" <?php checked('1', $ngg->options['usePermalinks']); ?> />
254
+ <?php _e('When you activate this option, you need to update your permalink structure one time.','nggallery'); ?>
255
+ <?php _e('Gallery slug name :','nggallery'); ?>
256
+ <input type="text" size="15" name="permalinkSlug" value="<?php echo $ngg->options['permalinkSlug']; ?>" /></td>
257
+ </tr>
258
+ <tr class="expert">
259
+ <th valign="top"><?php _e('Create new URL friendly image slugs','nggallery'); ?></th>
260
+ <td><input type="submit" name="createslugs" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
261
+ </tr>
262
+ <tr class="expert">
263
+ <th valign="top"><?php _e('Select graphic library','nggallery'); ?></th>
264
+ <td><label><input name="graphicLibrary" type="radio" value="gd" <?php checked('gd', $ngg->options['graphicLibrary']); ?> /> <?php _e('GD Library', 'nggallery') ;?></label><br />
265
+ <label><input name="graphicLibrary" type="radio" value="im" <?php checked('im', $ngg->options['graphicLibrary']); ?> /> <?php _e('ImageMagick (Experimental). Path to the library :', 'nggallery') ;?>&nbsp;
266
+ <input <?php if (is_multisite()) echo 'readonly = "readonly"'; ?> type="text" size="35" name="imageMagickDir" value="<?php echo $ngg->options['imageMagickDir']; ?>" /></label>
267
+ </td>
268
+ </tr>
269
+ <tr>
270
+ <th align="left"><?php _e('Activate Media RSS feed','nggallery'); ?></th>
271
+ <td><input type="checkbox" name="useMediaRSS" value="1" <?php checked('1', $ngg->options['useMediaRSS']); ?> />
272
+ <span class="setting-description"><?php _e('A RSS feed will be added to you blog header. Useful for CoolIris/PicLens','nggallery') ?></span></td>
273
+ </tr>
274
+ <tr>
275
+ <th align="left"><?php _e('Activate PicLens/CoolIris support','nggallery'); ?> (<a href="http://www.cooliris.com">CoolIris</a>)</th>
276
+ <td><input type="checkbox" name="usePicLens" value="1" <?php checked('1', $ngg->options['usePicLens']); ?> />
277
+ <span class="setting-description"><?php _e('When you activate this option, some javascript is added to your site footer. Make sure that wp_footer is called in your theme.','nggallery') ?></span></td>
278
+ </tr>
279
+ </table>
280
+ <h3 class="expert"><?php _e('Tags / Categories','nggallery'); ?></h3>
281
+ <table class="expert form-table ngg-options">
282
+ <tr>
283
+ <th valign="top"><?php _e('Activate related images','nggallery'); ?></th>
284
+ <td><input name="activateTags" type="checkbox" value="1" <?php checked('1', $ngg->options['activateTags']); ?> />
285
+ <?php _e('This option will append related images to every post','nggallery'); ?>
286
+ </td>
287
+ </tr>
288
+ <tr>
289
+ <th valign="top"><?php _e('Match with','nggallery'); ?></th>
290
+ <td><label><input name="appendType" type="radio" value="category" <?php checked('category', $ngg->options['appendType']); ?> /> <?php _e('Categories', 'nggallery') ;?></label><br />
291
+ <label><input name="appendType" type="radio" value="tags" <?php checked('tags', $ngg->options['appendType']); ?> /> <?php _e('Tags', 'nggallery') ;?></label>
292
+ </td>
293
+ </tr>
294
+ <tr>
295
+ <th valign="top"><?php _e('Max. number of images','nggallery'); ?></th>
296
+ <td><input type="text" name="maxImages" value="<?php echo $ngg->options['maxImages']; ?>" size="3" maxlength="3" />
297
+ <span class="setting-description"><?php _e('0 will show all images','nggallery'); ?></span>
298
+ </td>
299
+ </tr>
300
+ </table>
301
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
302
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes'); ?>"/></div>
303
+ </form>
304
+ <?php
305
+ }
306
+
307
+ function tab_thumbnails() {
308
+ global $ngg;
309
+ ?>
310
+ <!-- Thumbnail settings -->
311
+ <h2><?php _e('Thumbnail settings','nggallery'); ?></h2>
312
+ <form name="thumbnailsettings" method="POST" action="<?php echo $this->filepath.'#thumbnails'; ?>" >
313
+ <?php wp_nonce_field('ngg_settings') ?>
314
+ <input type="hidden" name="page_options" value="thumbwidth,thumbheight,thumbfix,thumbquality" />
315
+ <p><?php _e('Please note : If you change the settings, you need to recreate the thumbnails under -> Manage Gallery .', 'nggallery') ?></p>
316
+ <table class="form-table ngg-options">
317
+ <tr valign="top">
318
+ <th align="left"><?php _e('Width x height (in pixel)','nggallery'); ?></th>
319
+ <td><input type="text" size="4" maxlength="4" name="thumbwidth" value="<?php echo $ngg->options['thumbwidth']; ?>" /> x <input type="text" size="4" maxlength="4" name="thumbheight" value="<?php echo $ngg->options['thumbheight']; ?>" />
320
+ <span class="setting-description"><?php _e('These values are maximum values ','nggallery'); ?></span></td>
321
+ </tr>
322
+ <tr valign="top">
323
+ <th align="left"><?php _e('Set fix dimension','nggallery'); ?></th>
324
+ <td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg->options['thumbfix']); ?> />
325
+ <?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></td>
326
+ </tr>
327
+ <tr class="expert" valign="top">
328
+ <th align="left"><?php _e('Thumbnail quality','nggallery'); ?></th>
329
+ <td><input type="text" size="3" maxlength="3" name="thumbquality" value="<?php echo $ngg->options['thumbquality']; ?>" /> %</td>
330
+ </tr>
331
+ </table>
332
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
333
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
334
+ </form>
335
+ <?php
336
+ }
337
+
338
+ function tab_images() {
339
+ global $ngg;
340
+ ?>
341
+ <!-- Image settings -->
342
+ <h2><?php _e('Image settings','nggallery'); ?></h2>
343
+ <form name="imagesettings" method="POST" action="<?php echo $this->filepath.'#images'; ?>" >
344
+ <?php wp_nonce_field('ngg_settings') ?>
345
+ <input type="hidden" name="page_options" value="imgResize,imgWidth,imgHeight,imgQuality,imgBackup,imgAutoResize" />
346
+ <table class="form-table ngg-options">
347
+ <tr valign="top">
348
+ <th valign="top"><label for="fixratio"><?php _e('Resize Images','nggallery') ?></label></th>
349
+ <td><input type="text" size="5" name="imgWidth" value="<?php echo $ngg->options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg->options['imgHeight']; ?>" />
350
+ <span class="setting-description"><?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></span></td>
351
+ </tr>
352
+ <tr valign="top">
353
+ <th valign="top"><?php _e('Image quality','nggallery'); ?></th>
354
+ <td><input type="text" size="3" maxlength="3" name="imgQuality" value="<?php echo $ngg->options['imgQuality']; ?>" /> %</td>
355
+ </tr>
356
+ <tr>
357
+ <th valign="top"><?php _e('Backup original images','nggallery'); ?></th>
358
+ <td><input type="checkbox" name="imgBackup" value="1"<?php echo ($ngg->options['imgBackup'] == 1) ? ' checked ="chechked"' : ''; ?>/>
359
+ <span class="setting-description"><?php _e('Creates a backup for inserted images','nggallery'); ?></span></td>
360
+ </tr>
361
+ <tr>
362
+ <th valign="top"><?php _e('Automatically resize','nggallery'); ?></th>
363
+ <td><input type="checkbox" name="imgAutoResize" value="1"<?php echo ($ngg->options['imgAutoResize'] == 1) ? ' checked ="chechked"' : ''; ?>/>
364
+ <span class="setting-description"><?php _e('Automatically resize images on upload.','nggallery') ?></span></td>
365
+ </tr>
366
+ </table>
367
+ <h3 class="expert"><?php _e('Single picture','nggallery') ?></h3>
368
+ <table class="expert form-table ngg-options">
369
+ <tr>
370
+ <th valign="top"><?php _e('Clear cache folder','nggallery'); ?></th>
371
+ <td><input type="submit" name="clearcache" class="button-secondary" value="<?php _e('Proceed now','nggallery') ;?> &raquo;"/></td>
372
+ </tr>
373
+ </table>
374
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
375
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
376
+ </form>
377
+
378
+ <?php
379
+ }
380
+
381
+ function tab_gallery() {
382
+ global $ngg;
383
+ ?>
384
+ <!-- Gallery settings -->
385
+ <h2><?php _e('Gallery settings','nggallery'); ?></h2>
386
+ <form name="galleryform" method="POST" action="<?php echo $this->filepath.'#gallery'; ?>" >
387
+ <?php wp_nonce_field('ngg_settings') ?>
388
+ <input type="hidden" name="page_options" value="galNoPages,galImages,galColumns,galShowSlide,galTextSlide,galTextGallery,galShowOrder,galImgBrowser,galSort,galSortDir,galHiddenImg,galAjaxNav" />
389
+ <table class="form-table ngg-options">
390
+ <tr class="expert" >
391
+ <th valign="top"><?php _e('Deactivate gallery page link','nggallery') ?></th>
392
+ <td><input name="galNoPages" type="checkbox" value="1" <?php checked('1', $ngg->options['galNoPages']); ?> />
393
+ <?php _e('The album will not link to a gallery subpage. The gallery is shown on the same page.','nggallery') ?>
394
+ </td>
395
+ </tr>
396
+ <tr>
397
+ <th valign="top"><?php _e('Number of images per page','nggallery') ?></th>
398
+ <td><input type="text" name="galImages" value="<?php echo $ngg->options['galImages']; ?>" size="3" maxlength="3" />
399
+ <span class="setting-description"><?php _e('0 will disable pagination, all images on one page','nggallery') ?></span>
400
+ </td>
401
+ </tr>
402
+ <tr>
403
+ <th valign="top"><?php _e('Number of columns','nggallery'); ?></th>
404
+ <td><input type="text" name="galColumns" value="<?php echo $ngg->options['galColumns']; ?>" size="3" maxlength="3" />
405
+ <span class="setting-description"><?php _e('0 will display as much as possible based on the width of your theme. Setting normally only required for captions below the images','nggallery') ?></span>
406
+ </td>
407
+ </tr>
408
+ <tr>
409
+ <th valign="top"><?php _e('Integrate slideshow','nggallery'); ?></th>
410
+ <td><input name="galShowSlide" type="checkbox" value="1" <?php checked('1', $ngg->options['galShowSlide']); ?> />
411
+ <input type="text" name="galTextSlide" value="<?php echo $ngg->options['galTextSlide'] ?>" size="20" />
412
+ <input type="text" name="galTextGallery" value="<?php echo $ngg->options['galTextGallery'] ?>" size="20" />
413
+ </td>
414
+ </tr>
415
+ <tr class="expert" >
416
+ <th valign="top"><?php _e('Show first','nggallery'); ?></th>
417
+ <td><label><input name="galShowOrder" type="radio" value="gallery" <?php checked('gallery', $ngg->options['galShowOrder']); ?> /> <?php _e('Thumbnails', 'nggallery') ;?></label><br />
418
+ <label><input name="galShowOrder" type="radio" value="slide" <?php checked('slide', $ngg->options['galShowOrder']); ?> /> <?php _e('Slideshow', 'nggallery') ;?></label>
419
+ </td>
420
+ </tr>
421
+ <tr class="expert" >
422
+ <th valign="top"><?php _e('Show ImageBrowser','nggallery'); ?></th>
423
+ <td><input name="galImgBrowser" type="checkbox" value="1" <?php checked('1', $ngg->options['galImgBrowser']); ?> />
424
+ <?php _e('The gallery will open the ImageBrowser instead the effect.', 'nggallery'); ?>
425
+ </td>
426
+ </tr>
427
+ <tr class="expert" >
428
+ <th valign="top"><?php _e('Add hidden images','nggallery'); ?></th>
429
+ <td><input name="galHiddenImg" type="checkbox" value="1" <?php checked('1', $ngg->options['galHiddenImg']); ?> />
430
+ <?php _e('If pagination is used, this option will still show all images in the modal window (Thickbox, Lightbox etc.). Note : This increases the page load','nggallery'); ?>
431
+ </td>
432
+ </tr>
433
+ <tr class="expert" >
434
+ <th valign="top"><?php _e('Enable AJAX pagination','nggallery'); ?></th>
435
+ <td><input name="galAjaxNav" type="checkbox" value="1" <?php checked('1', $ngg->options['galAjaxNav']); ?> />
436
+ <?php _e('Browse images without reload the page. Note : Works only in combination with Shutter effect','nggallery'); ?>
437
+ </td>
438
+ </tr>
439
+ </table>
440
+ <h3 class="expert" ><?php _e('Sort options','nggallery') ?></h3>
441
+ <table class="expert form-table ngg-options">
442
+ <tr>
443
+ <th valign="top"><?php _e('Sort thumbnails','nggallery') ?></th>
444
+ <td>
445
+ <label><input name="galSort" type="radio" value="sortorder" <?php checked('sortorder', $ngg->options['galSort']); ?> /> <?php _e('Custom order', 'nggallery') ;?></label><br />
446
+ <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $ngg->options['galSort']); ?> /> <?php _e('Image ID', 'nggallery') ;?></label><br />
447
+ <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $ngg->options['galSort']); ?> /> <?php _e('File name', 'nggallery') ;?></label><br />
448
+ <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $ngg->options['galSort']); ?> /> <?php _e('Alt / Title text', 'nggallery') ;?></label><br />
449
+ <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $ngg->options['galSort']); ?> /> <?php _e('Date / Time', 'nggallery') ;?></label>
450
+ </td>
451
+ </tr>
452
+ <tr>
453
+ <th valign="top"><?php _e('Sort direction','nggallery') ?></th>
454
+ <td><label><input name="galSortDir" type="radio" value="ASC" <?php checked('ASC', $ngg->options['galSortDir']); ?> /> <?php _e('Ascending', 'nggallery') ;?></label><br />
455
+ <label><input name="galSortDir" type="radio" value="DESC" <?php checked('DESC', $ngg->options['galSortDir']); ?> /> <?php _e('Descending', 'nggallery') ;?></label>
456
+ </td>
457
+ </tr>
458
+ </table>
459
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
460
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
461
+ </form>
462
+ <?php
463
+ }
464
+
465
+ function tab_effects() {
466
+ global $ngg;
467
+ ?>
468
+ <!-- Effects settings -->
469
+ <h2><?php _e('Effects','nggallery'); ?></h2>
470
+ <form name="effectsform" method="POST" action="<?php echo $this->filepath.'#effects'; ?>" >
471
+ <?php wp_nonce_field('ngg_settings') ?>
472
+ <input type="hidden" name="page_options" value="thumbEffect,thumbCode" />
473
+ <p><?php _e('Here you can select the thumbnail effect, NextGEN Gallery will integrate the required HTML code in the images. Please note that only the Shutter and Thickbox effect will automatic added to your theme.','nggallery'); ?>
474
+ <?php _e('With the placeholder','nggallery'); ?><strong> %GALLERY_NAME% </strong> <?php _e('you can activate a navigation through the images (depend on the effect). Change the code line only , when you use a different thumbnail effect or you know what you do.','nggallery'); ?></p>
475
+ <table class="form-table ngg-options">
476
+ <tr valign="top">
477
+ <th><?php _e('JavaScript Thumbnail effect','nggallery') ?></th>
478
+ <td>
479
+ <select size="1" id="thumbEffect" name="thumbEffect" onchange="insertcode(this.value)">
480
+ <option value="none" <?php selected('none', $ngg->options['thumbEffect']); ?> ><?php _e('None', 'nggallery') ;?></option>
481
+ <option value="thickbox" <?php selected('thickbox', $ngg->options['thumbEffect']); ?> ><?php _e('Thickbox', 'nggallery') ;?></option>
482
+ <option value="lightbox" <?php selected('lightbox', $ngg->options['thumbEffect']); ?> ><?php _e('Lightbox', 'nggallery') ;?></option>
483
+ <option value="highslide" <?php selected('highslide', $ngg->options['thumbEffect']); ?> ><?php _e('Highslide', 'nggallery') ;?></option>
484
+ <option value="shutter" <?php selected('shutter', $ngg->options['thumbEffect']); ?> ><?php _e('Shutter', 'nggallery') ;?></option>
485
+ <option value="custom" <?php selected('custom', $ngg->options['thumbEffect']); ?> ><?php _e('Custom', 'nggallery') ;?></option>
486
+ </select>
487
+ </td>
488
+ </tr>
489
+ <tr class="expert" valign="top">
490
+ <th><?php _e('Link Code line','nggallery') ?></th>
491
+ <td><textarea id="thumbCode" name="thumbCode" cols="50" rows="5"><?php echo htmlspecialchars(stripslashes($ngg->options['thumbCode'])); ?></textarea></td>
492
+ </tr>
493
+ </table>
494
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
495
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
496
+ </form>
497
+
498
+ <?php
499
+ }
500
+
501
+ function tab_watermark() {
502
+
503
+ global $wpdb, $ngg;
504
+
505
+ // take the first image as sample
506
+ $imageID = $wpdb->get_var("SELECT MIN(pid) FROM $wpdb->nggpictures");
507
+ $imageURL = ($imageID) ? $imageURL = '<img src="'. home_url('index.php') . '?callback=image&amp;pid=' . intval ($imageID) . '&amp;mode=watermark&amp;width=300&amp;height=250" />' : '';
508
+
509
+ ?>
510
+ <!-- Watermark settings -->
511
+ <h2><?php _e('Watermark','nggallery'); ?></h2>
512
+ <p><?php _e('Please note : You can only activate the watermark under -> Manage Gallery . This action cannot be undone.', 'nggallery') ?></p>
513
+ <form name="watermarkform" method="POST" action="<?php echo $this->filepath.'#watermark'; ?>" >
514
+ <?php wp_nonce_field('ngg_settings') ?>
515
+ <input type="hidden" name="page_options" value="wmPos,wmXpos,wmYpos,wmType,wmPath,wmFont,wmSize,wmColor,wmText,wmOpaque" />
516
+ <div id="wm-preview">
517
+ <h3><?php _e('Preview','nggallery') ?></h3>
518
+ <p style="text-align:center;"><?php echo $imageURL; ?></p>
519
+ <h3><?php _e('Position','nggallery') ?></h3>
520
+ <div>
521
+ <table id="wm-position">
522
+ <tr>
523
+ <td valign="top">
524
+ <strong><?php _e('Position','nggallery') ?></strong>
525
+ <table border="1">
526
+ <tr>
527
+ <td><input type="radio" name="wmPos" value="topLeft" <?php checked('topLeft', $ngg->options['wmPos']); ?> /></td>
528
+ <td><input type="radio" name="wmPos" value="topCenter" <?php checked('topCenter', $ngg->options['wmPos']); ?> /></td>
529
+ <td><input type="radio" name="wmPos" value="topRight" <?php checked('topRight', $ngg->options['wmPos']); ?> /></td>
530
+ </tr>
531
+ <tr>
532
+ <td><input type="radio" name="wmPos" value="midLeft" <?php checked('midLeft', $ngg->options['wmPos']); ?> /></td>
533
+ <td><input type="radio" name="wmPos" value="midCenter" <?php checked('midCenter', $ngg->options['wmPos']); ?> /></td>
534
+ <td><input type="radio" name="wmPos" value="midRight" <?php checked('midRight', $ngg->options['wmPos']); ?> /></td>
535
+ </tr>
536
+ <tr>
537
+ <td><input type="radio" name="wmPos" value="botLeft" <?php checked('botLeft', $ngg->options['wmPos']); ?> /></td>
538
+ <td><input type="radio" name="wmPos" value="botCenter" <?php checked('botCenter', $ngg->options['wmPos']); ?> /></td>
539
+ <td><input type="radio" name="wmPos" value="botRight" <?php checked('botRight', $ngg->options['wmPos']); ?> /></td>
540
+ </tr>
541
+ </table>
542
+ </td>
543
+ <td valign="top">
544
+ <strong><?php _e('Offset','nggallery') ?></strong>
545
+ <table border="0">
546
+ <tr>
547
+ <td>x</td>
548
+ <td><input type="text" name="wmXpos" value="<?php echo $ngg->options['wmXpos'] ?>" size="4" /> px</td>
549
+ </tr>
550
+ <tr>
551
+ <td>y</td>
552
+ <td><input type="text" name="wmYpos" value="<?php echo $ngg->options['wmYpos'] ?>" size="4" /> px</td>
553
+ </tr>
554
+ </table>
555
+ </td>
556
+ </tr>
557
+ </table>
558
+ </div>
559
+ </div>
560
+ <h3><label><input type="radio" name="wmType" value="image" <?php checked('image', $ngg->options['wmType']); ?> /> <?php _e('Use image as watermark','nggallery') ?></label></h3>
561
+ <table class="wm-table form-table">
562
+ <tr>
563
+ <th><?php _e('URL to file','nggallery') ?></th>
564
+ <td><input type="text" size="40" name="wmPath" value="<?php echo $ngg->options['wmPath']; ?>" /><br />
565
+ <?php if(!ini_get('allow_url_fopen')) _e('The accessing of URL files is disabled at your server (allow_url_fopen)','nggallery') ?> </td>
566
+ </tr>
567
+ </table>
568
+ <h3><label><input type="radio" name="wmType" value="text" <?php checked('text', $ngg->options['wmType']); ?> /> <?php _e('Use text as watermark','nggallery') ?></label></h3>
569
+ <table class="wm-table form-table">
570
+ <tr>
571
+ <th><?php _e('Font','nggallery') ?></th>
572
+ <td><select name="wmFont" size="1"> <?php
573
+ $fontlist = ngg_get_TTFfont();
574
+ foreach ( $fontlist as $fontfile ) {
575
+ echo "\n".'<option value="'.$fontfile.'" '.ngg_input_selected($fontfile, $ngg->options['wmFont']).' >'.$fontfile.'</option>';
576
+ }
577
+ ?>
578
+ </select><br /><span class="setting-description">
579
+ <?php if ( !function_exists('ImageTTFBBox') )
580
+ _e('This function will not work, cause you need the FreeType library','nggallery');
581
+ else
582
+ _e('You can upload more fonts in the folder <strong>nggallery/fonts</strong>','nggallery'); ?>
583
+ </span>
584
+ </td>
585
+ </tr>
586
+ <tr>
587
+ <th><?php _e('Size','nggallery') ?></th>
588
+ <td><input type="text" name="wmSize" value="<?php echo $ngg->options['wmSize']; ?>" size="4" maxlength="2" /> px</td>
589
+ </tr>
590
+ <tr>
591
+ <th><?php _e('Color','nggallery') ?></th>
592
+ <td><input class="picker" type="text" size="6" maxlength="6" id="wmColor" name="wmColor" onchange="setcolor('#previewText', this.value)" value="<?php echo $ngg->options['wmColor'] ?>" />
593
+ <input type="text" size="1" readonly="readonly" id="previewText" style="background-color: #<?php echo $ngg->options['wmColor']; ?>" /> <?php _e('(hex w/o #)','nggallery') ?></td>
594
+ </tr>
595
+ <tr>
596
+ <th valign="top"><?php _e('Text','nggallery') ?></th>
597
+ <td><textarea name="wmText" cols="40" rows="4"><?php echo $ngg->options['wmText'] ?></textarea></td>
598
+ </tr>
599
+ <tr>
600
+ <th><?php _e('Opaque','nggallery') ?></th>
601
+ <td><input type="text" name="wmOpaque" value="<?php echo $ngg->options['wmOpaque'] ?>" size="3" maxlength="3" /> % </td>
602
+ </tr>
603
+ </table>
604
+ <div class="clear"> &nbsp; </div>
605
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
606
+ </form>
607
+ <?php
608
+ }
609
+
610
+ function tab_slideshow() {
611
+
612
+ global $ngg;
613
+ ?>
614
+ <!-- Slideshow settings -->
615
+ <form name="player_options" method="POST" action="<?php echo $this->filepath.'#slideshow'; ?>" >
616
+ <?php wp_nonce_field('ngg_settings'); ?>
617
+ <input type="hidden" name="page_options" value="slideFx,enableIR,irURL,irWidth,irHeight,irShuffle,irLinkfromdisplay,irShownavigation,irShowicons,irWatermark,irOverstretch,irRotatetime,irTransition,irKenburns,irBackcolor,irFrontcolor,irLightcolor,irScreencolor,irAudio,irXHTMLvalid" />
618
+ <h2><?php _e('Slideshow','nggallery'); ?></h2>
619
+ <table class="form-table ngg-options">
620
+ <tr>
621
+ <th><?php _e('Default size (W x H)','nggallery') ?></th>
622
+ <td><input type="text" size="3" maxlength="4" name="irWidth" value="<?php echo $ngg->options['irWidth']; ?>" /> x
623
+ <input type="text" size="3" maxlength="4" name="irHeight" value="<?php echo $ngg->options['irHeight']; ?>" /></td>
624
+ </tr>
625
+ <tr>
626
+ <th><?php _e('Duration time','nggallery') ?></th>
627
+ <td><input type="text" size="3" maxlength="3" name="irRotatetime" value="<?php echo $ngg->options['irRotatetime'] ?>" /> <?php _e('sec.', 'nggallery') ;?></td>
628
+ </tr>
629
+ <tr>
630
+ <th><?php _e('Transition / Fade effect','nggallery') ?></th>
631
+ <td>
632
+ <select size="1" name="slideFx">
633
+ <option value="fade" <?php selected('fade', $ngg->options['slideFx']); ?> ><?php _e('fade', 'nggallery') ;?></option>
634
+ <option value="blindX" <?php selected('blindX', $ngg->options['slideFx']); ?> ><?php _e('blindX', 'nggallery') ;?></option>
635
+ <option value="cover" <?php selected('cover', $ngg->options['slideFx']); ?> ><?php _e('cover', 'nggallery') ;?></option>
636
+ <option value="scrollUp" <?php selected('scrollUp', $ngg->options['slideFx']); ?> ><?php _e('scrollUp', 'nggallery') ;?></option>
637
+ <option value="scrollDown" <?php selected('scrollDown', $ngg->options['slideFx']); ?> ><?php _e('scrollDown', 'nggallery') ;?></option>
638
+ <option value="shuffle" <?php selected('shuffle', $ngg->options['slideFx']); ?> ><?php _e('shuffle', 'nggallery') ;?></option>
639
+ <option value="toss" <?php selected('toss', $ngg->options['slideFx']); ?> ><?php _e('toss', 'nggallery') ;?></option>
640
+ <option value="wipe" <?php selected('wipe', $ngg->options['slideFx']); ?> ><?php _e('wipe', 'nggallery') ;?></option>
641
+ </select>
642
+ <span class="description"><?php _e('See here for more information about the effects :', 'nggallery') ?> <a href="http://jquery.malsup.com/cycle/browser.html" target="_blank" >jQuery Cycle</a></span>
643
+ </td>
644
+ </tr>
645
+ </table>
646
+ <h3 class="expert" ><?php _e('Settings for the JW Image Rotator','nggallery') ?></h3>
647
+ <p><?php _e('The settings are only used in the JW Image Rotator Version', 'nggallery') ?> 3.17 .
648
+ <?php _e('See more information for the Flash Player on the web page', 'nggallery') ?> <a href="http://www.longtailvideo.com/players/jw-image-rotator/" target="_blank" >JW Image Rotator from Jeroen Wijering</a>.
649
+ </p>
650
+ <?php if (empty($ngg->options['irURL']) && ($ngg->options['enableIR'] == '1')) { ?>
651
+ <div id="message" class="error inline">
652
+ <p>
653
+ <?php _e('The path to imagerotator.swf is not defined, the slideshow will not work.','nggallery'); ?><br />
654
+ <?php _e('If you would like to use the JW Image Rotatator, please download the player <a href="http://www.longtailvideo.com/players/jw-image-rotator/" target="_blank" >here</a> and upload it to your Upload folder (Default is wp-content/uploads).','nggallery'); ?>
655
+ </p>
656
+ </div>
657
+ <?php }?>
658
+ <table class="expert form-table ngg-options">
659
+ <tr>
660
+ <th><?php _e('Enable flash slideshow','nggallery') ?></th>
661
+ <td><input name="enableIR" type="checkbox" value="1" <?php checked('1', $ngg->options['enableIR']); ?> />
662
+ <span class="setting-description"><?php _e('Integrate the flash based slideshow for all flash supported devices','nggallery') ?></span></td>
663
+ </tr>
664
+ <tr>
665
+ <th><?php _e('Path to the Imagerotator (URL)','nggallery') ?></th>
666
+ <td>
667
+ <input type="text" size="50" id="irURL" name="irURL" value="<?php echo $ngg->options['irURL']; ?>" />
668
+ <input type="submit" name="irDetect" class="button-secondary" value="<?php _e('Search now','nggallery') ;?> &raquo;"/>
669
+ <br /><span class="setting-description"><?php _e('Press the button to search automatically for the imagerotator, if you uploaded it to wp-content/uploads or a subfolder','nggallery') ?></span>
670
+ </td>
671
+ </tr>
672
+ <tr>
673
+ <th><?php _e('Shuffle mode','nggallery') ?></th>
674
+ <td><input name="irShuffle" type="checkbox" value="1" <?php checked('1', $ngg->options['irShuffle']); ?> /></td>
675
+ </tr>
676
+ <tr class="expert">
677
+ <th><?php _e('Show next image on click','nggallery') ?></th>
678
+ <td><input name="irLinkfromdisplay" type="checkbox" value="1" <?php checked('1', $ngg->options['irLinkfromdisplay']); ?> /></td>
679
+ </tr>
680
+ <tr class="expert">
681
+ <th><?php _e('Show navigation bar','nggallery') ?></th>
682
+ <td><input name="irShownavigation" type="checkbox" value="1" <?php checked('1', $ngg->options['irShownavigation']); ?> /></td>
683
+ </tr>
684
+ <tr class="expert">
685
+ <th><?php _e('Show loading icon','nggallery') ?></th>
686
+ <td><input name="irShowicons" type="checkbox" value="1" <?php checked('1', $ngg->options['irShowicons']); ?> /></td>
687
+ </tr>
688
+ <tr class="expert">
689
+ <th><?php _e('Use watermark logo','nggallery') ?></th>
690
+ <td><input name="irWatermark" type="checkbox" value="1" <?php checked('1', $ngg->options['irWatermark']); ?> />
691
+ <span class="setting-description"><?php _e('You can change the logo at the watermark settings','nggallery') ?></span></td>
692
+ </tr>
693
+ <tr class="expert">
694
+ <th><?php _e('Stretch image','nggallery') ?></th>
695
+ <td>
696
+ <select size="1" name="irOverstretch">
697
+ <option value="true" <?php selected('true', $ngg->options['irOverstretch']); ?> ><?php _e('true', 'nggallery') ;?></option>
698
+ <option value="false" <?php selected('false', $ngg->options['irOverstretch']); ?> ><?php _e('false', 'nggallery') ;?></option>
699
+ <option value="fit" <?php selected('fit', $ngg->options['irOverstretch']); ?> ><?php _e('fit', 'nggallery') ;?></option>
700
+ <option value="none" <?php selected('none', $ngg->options['irOverstretch']); ?> ><?php _e('none', 'nggallery') ;?></option>
701
+ </select>
702
+ </td>
703
+ </tr>
704
+ <tr>
705
+ <th><?php _e('Transition / Fade effect','nggallery') ?></th>
706
+ <td>
707
+ <select size="1" name="irTransition">
708
+ <option value="fade" <?php selected('fade', $ngg->options['irTransition']); ?> ><?php _e('fade', 'nggallery') ;?></option>
709
+ <option value="bgfade" <?php selected('bgfade', $ngg->options['irTransition']); ?> ><?php _e('bgfade', 'nggallery') ;?></option>
710
+ <option value="slowfade" <?php selected('slowfade', $ngg->options['irTransition']); ?> ><?php _e('slowfade', 'nggallery') ;?></option>
711
+ <option value="circles" <?php selected('circles', $ngg->options['irTransition']); ?> ><?php _e('circles', 'nggallery') ;?></option>
712
+ <option value="bubbles" <?php selected('bubbles', $ngg->options['irTransition']); ?> ><?php _e('bubbles', 'nggallery') ;?></option>
713
+ <option value="blocks" <?php selected('blocks', $ngg->options['irTransition']); ?> ><?php _e('blocks', 'nggallery') ;?></option>
714
+ <option value="fluids" <?php selected('fluids', $ngg->options['irTransition']); ?> ><?php _e('fluids', 'nggallery') ;?></option>
715
+ <option value="flash" <?php selected('flash', $ngg->options['irTransition']); ?> ><?php _e('flash', 'nggallery') ;?></option>
716
+ <option value="lines" <?php selected('lines', $ngg->options['irTransition']); ?> ><?php _e('lines', 'nggallery') ;?></option>
717
+ <option value="random" <?php selected('random', $ngg->options['irTransition']); ?> ><?php _e('random', 'nggallery') ;?></option>
718
+ </select>
719
+ </td>
720
+ </tr>
721
+ <tr class="expert">
722
+ <th><?php _e('Use slow zooming effect','nggallery') ?></th>
723
+ <td><input name="irKenburns" type="checkbox" value="1" <?php checked('1', $ngg->options['irKenburns']); ?> /></td>
724
+ </tr>
725
+ <tr>
726
+ <th><?php _e('Background Color','nggallery') ?></th>
727
+ <td><input class="picker" type="text" size="6" maxlength="6" id="irBackcolor" name="irBackcolor" onchange="setcolor('#previewBack', this.value)" value="<?php echo $ngg->options['irBackcolor'] ?>" />
728
+ <input type="text" size="1" readonly="readonly" id="previewBack" style="background-color: #<?php echo $ngg->options['irBackcolor'] ?>" /></td>
729
+ </tr>
730
+ <tr>
731
+ <th><?php _e('Texts / Buttons Color','nggallery') ?></th>
732
+ <td><input class="picker" type="text" size="6" maxlength="6" id="irFrontcolor" name="irFrontcolor" onchange="setcolor('#previewFront', this.value)" value="<?php echo $ngg->options['irFrontcolor'] ?>" />
733
+ <input type="text" size="1" readonly="readonly" id="previewFront" style="background-color: #<?php echo $ngg->options['irFrontcolor'] ?>" /></td>
734
+ </tr>
735
+ <tr class="expert">
736
+ <th><?php _e('Rollover / Active Color','nggallery') ?></th>
737
+ <td><input class="picker" type="text" size="6" maxlength="6" id="irLightcolor" name="irLightcolor" onchange="setcolor('#previewLight', this.value)" value="<?php echo $ngg->options['irLightcolor'] ?>" />
738
+ <input type="text" size="1" readonly="readonly" id="previewLight" style="background-color: #<?php echo $ngg->options['irLightcolor'] ?>" /></td>
739
+ </tr>
740
+ <tr class="expert">
741
+ <th><?php _e('Screen Color','nggallery') ?></th>
742
+ <td><input class="picker" type="text" size="6" maxlength="6" id="irScreencolor" name="irScreencolor" onchange="setcolor('#previewScreen', this.value)" value="<?php echo $ngg->options['irScreencolor'] ?>" />
743
+ <input type="text" size="1" readonly="readonly" id="previewScreen" style="background-color: #<?php echo $ngg->options['irScreencolor'] ?>" /></td>
744
+ </tr>
745
+ <tr class="expert">
746
+ <th><?php _e('Background music (URL)','nggallery') ?></th>
747
+ <td><input type="text" size="50" id="irAudio" name="irAudio" value="<?php echo $ngg->options['irAudio'] ?>" /></td>
748
+ </tr>
749
+ <tr class="expert">
750
+ <th ><?php _e('Try XHTML validation (with CDATA)','nggallery') ?></th>
751
+ <td><input name="irXHTMLvalid" type="checkbox" value="1" <?php checked('1', $ngg->options['irXHTMLvalid']); ?> />
752
+ <span class="setting-description"><?php _e('Important : Could causes problem at some browser. Please recheck your page.','nggallery') ?></span></td>
753
+ </tr>
754
+ </table>
755
+ <div class="alignright"><a href="" class="switch-expert" >[<?php _e('More settings','nggallery'); ?>]</a></div>
756
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes') ;?>"/></div>
757
+ </form>
758
+ <?php
759
+ }
760
+ }
761
+
762
+ function ngg_get_TTFfont() {
763
+
764
+ $ttf_fonts = array ();
765
+
766
+ // Files in wp-content/plugins/nggallery/fonts directory
767
+ $plugin_root = NGGALLERY_ABSPATH . 'fonts';
768
+
769
+ $plugins_dir = @ dir($plugin_root);
770
+ if ($plugins_dir) {
771
+ while (($file = $plugins_dir->read()) !== false) {
772
+ if (preg_match('|^\.+$|', $file))
773
+ continue;
774
+ if (is_dir($plugin_root.'/'.$file)) {
775
+ $plugins_subdir = @ dir($plugin_root.'/'.$file);
776
+ if ($plugins_subdir) {
777
+ while (($subfile = $plugins_subdir->read()) !== false) {
778
+ if (preg_match('|^\.+$|', $subfile))
779
+ continue;
780
+ if (preg_match('|\.ttf$|', $subfile))
781
+ $ttf_fonts[] = "$file/$subfile";
782
+ }
783
+ }
784
+ } else {
785
+ if (preg_match('|\.ttf$|', $file))
786
+ $ttf_fonts[] = $file;
787
+ }
788
+ }
789
+ }
790
+
791
+ return $ttf_fonts;
792
+ }
793
+
794
+ function ngg_search_imagerotator() {
795
+ global $wpdb;
796
+
797
+ $upload = wp_upload_dir();
798
+
799
+ // look first at the old place and move it to wp-content/uploads
800
+ if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
801
+ @rename(NGGALLERY_ABSPATH . 'imagerotator.swf', $upload['basedir'] . '/imagerotator.swf');
802
+
803
+ // This should be the new place
804
+ if ( file_exists( $upload['basedir'] . '/imagerotator.swf' ) )
805
+ return $upload['baseurl'] . '/imagerotator.swf';
806
+
807
+ // Find the path to the imagerotator via the media library
808
+ if ( $path = $wpdb->get_var( "SELECT guid FROM {$wpdb->posts} WHERE guid LIKE '%imagerotator.swf%'" ) )
809
+ return $path;
810
+
811
+ // maybe it's located at wp-content
812
+ if ( file_exists( WP_CONTENT_DIR . '/imagerotator.swf' ) )
813
+ return WP_CONTENT_URL . '/imagerotator.swf';
814
+
815
+ // or in the plugin folder
816
+ if ( file_exists( WP_PLUGIN_DIR . '/imagerotator.swf' ) )
817
+ return WP_PLUGIN_URL . '/imagerotator.swf';
818
+
819
+ // this is deprecated and will be ereased during a automatic upgrade
820
+ if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
821
+ return NGGALLERY_URLPATH . 'imagerotator.swf';
822
+
823
+ return '';
824
+ }
825
+
826
+ /**********************************************************/
827
+ // taken from WP Core
828
+
829
+ function ngg_input_selected( $selected, $current) {
830
+ if ( $selected == $current)
831
+ return ' selected="selected"';
832
+ }
833
+
834
+ function ngg_input_checked( $checked, $current) {
835
+ if ( $checked == $current)
836
+ return ' checked="checked"';
837
+ }
838
  ?>
admin/setup.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- function nggallery_admin_setup() {
5
- global $wpdb, $ngg;
6
-
7
- if (isset($_POST['resetdefault'])) {
8
- check_admin_referer('ngg_uninstall');
9
-
10
- include_once ( dirname (__FILE__). '/install.php');
11
-
12
- ngg_default_options();
13
- $ngg->load_options();
14
-
15
- nggGallery::show_message(__('Reset all settings to default parameter','nggallery'));
16
- }
17
-
18
- if (isset($_POST['uninstall'])) {
19
-
20
- check_admin_referer('ngg_uninstall');
21
-
22
- include_once ( dirname (__FILE__). '/install.php');
23
-
24
- nggallery_uninstall();
25
-
26
- nggGallery::show_message(__('Uninstall sucessful ! Now delete the plugin and enjoy your life ! Good luck !','nggallery'));
27
- }
28
- ?>
29
- <div class="wrap">
30
- <h2><?php _e('Reset options', 'nggallery') ;?></h2>
31
- <form name="resetsettings" method="post">
32
- <?php wp_nonce_field('ngg_uninstall') ?>
33
- <p><?php _e('Reset all options/settings to the default installation.', 'nggallery') ;?></p>
34
- <div align="center"><input type="submit" class="button" name="resetdefault" value="<?php _e('Reset settings', 'nggallery') ;?>" onclick="javascript:check=confirm('<?php _e('Reset all options to default settings ?\n\nChoose [Cancel] to Stop, [OK] to proceed.\n','nggallery'); ?>');if(check==false) return false;" /></div>
35
- </form>
36
- </div>
37
- <?php if ( !is_multisite() || wpmu_site_admin() ) : ?>
38
- <div class="wrap">
39
- <h2><?php _e('Uninstall plugin tables', 'nggallery') ;?></h2>
40
-
41
- <form name="resetsettings" method="post">
42
- <div>
43
- <?php wp_nonce_field('ngg_uninstall') ?>
44
- <p><?php _e('You don\'t like NextGEN Gallery ?', 'nggallery') ;?></p>
45
- <p><?php _e('No problem, before you deactivate this plugin press the Uninstall Button, because deactivating NextGEN Gallery does not remove any data that may have been created. ', 'nggallery') ;?>
46
- </div>
47
- <p><font color="red"><strong><?php _e('WARNING:', 'nggallery') ;?></strong><br />
48
- <?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to backup all the tables first. NextGEN gallery is stored in the tables', 'nggallery') ;?> <strong><?php echo $wpdb->nggpictures; ?></strong>, <strong><?php echo $wpdb->nggalbum; ?></strong> <?php _e('and', 'nggallery') ;?> <strong><?php echo $wpdb->nggalbum; ?></strong>.</font></p>
49
- <div align="center">
50
- <input type="submit" name="uninstall" class="button delete" value="<?php _e('Uninstall plugin', 'nggallery') ?>" onclick="javascript:check=confirm('<?php _e('You are about to Uninstall this plugin from WordPress.\nThis action is not reversible.\n\nChoose [Cancel] to Stop, [OK] to Uninstall.\n','nggallery'); ?>');if(check==false) return false;"/>
51
- </div>
52
- </form>
53
- </div>
54
- <?php endif; ?>
55
-
56
- <?php
57
- }
58
- ?>
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ function nggallery_admin_setup() {
5
+ global $wpdb, $ngg;
6
+
7
+ if (isset($_POST['resetdefault'])) {
8
+ check_admin_referer('ngg_uninstall');
9
+
10
+ include_once ( dirname (__FILE__). '/install.php');
11
+
12
+ ngg_default_options();
13
+ $ngg->load_options();
14
+
15
+ nggGallery::show_message(__('Reset all settings to default parameter','nggallery'));
16
+ }
17
+
18
+ if (isset($_POST['uninstall'])) {
19
+
20
+ check_admin_referer('ngg_uninstall');
21
+
22
+ include_once ( dirname (__FILE__). '/install.php');
23
+
24
+ nggallery_uninstall();
25
+
26
+ nggGallery::show_message(__('Uninstall sucessful ! Now delete the plugin and enjoy your life ! Good luck !','nggallery'));
27
+ }
28
+ ?>
29
+ <div class="wrap">
30
+ <h2><?php _e('Reset options', 'nggallery') ;?></h2>
31
+ <form name="resetsettings" method="post">
32
+ <?php wp_nonce_field('ngg_uninstall') ?>
33
+ <p><?php _e('Reset all options/settings to the default installation.', 'nggallery') ;?></p>
34
+ <div align="center"><input type="submit" class="button" name="resetdefault" value="<?php _e('Reset settings', 'nggallery') ;?>" onclick="javascript:check=confirm('<?php _e('Reset all options to default settings ?\n\nChoose [Cancel] to Stop, [OK] to proceed.\n','nggallery'); ?>');if(check==false) return false;" /></div>
35
+ </form>
36
+ </div>
37
+ <?php if ( !is_multisite() || wpmu_site_admin() ) : ?>
38
+ <div class="wrap">
39
+ <h2><?php _e('Uninstall plugin tables', 'nggallery') ;?></h2>
40
+
41
+ <form name="resetsettings" method="post">
42
+ <div>
43
+ <?php wp_nonce_field('ngg_uninstall') ?>
44
+ <p><?php _e('You don\'t like NextGEN Gallery ?', 'nggallery') ;?></p>
45
+ <p><?php _e('No problem, before you deactivate this plugin press the Uninstall Button, because deactivating NextGEN Gallery does not remove any data that may have been created. ', 'nggallery') ;?>
46
+ </div>
47
+ <p><font color="red"><strong><?php _e('WARNING:', 'nggallery') ;?></strong><br />
48
+ <?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to backup all the tables first. NextGEN gallery is stored in the tables', 'nggallery') ;?> <strong><?php echo $wpdb->nggpictures; ?></strong>, <strong><?php echo $wpdb->nggalbum; ?></strong> <?php _e('and', 'nggallery') ;?> <strong><?php echo $wpdb->nggalbum; ?></strong>.</font></p>
49
+ <div align="center">
50
+ <input type="submit" name="uninstall" class="button delete" value="<?php _e('Uninstall plugin', 'nggallery') ?>" onclick="javascript:check=confirm('<?php _e('You are about to Uninstall this plugin from WordPress.\nThis action is not reversible.\n\nChoose [Cancel] to Stop, [OK] to Uninstall.\n','nggallery'); ?>');if(check==false) return false;"/>
51
+ </div>
52
+ </form>
53
+ </div>
54
+ <?php endif; ?>
55
+
56
+ <?php
57
+ }
58
+ ?>
admin/showmeta.php CHANGED
@@ -1,124 +1,124 @@
1
- <?php
2
-
3
- // look up for the path
4
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
5
-
6
- require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
7
- require_once(NGGALLERY_ABSPATH . '/lib/image.php');
8
-
9
- if ( !is_user_logged_in() )
10
- die(__('Cheatin&#8217; uh?'));
11
-
12
- if ( !current_user_can('NextGEN Manage gallery') )
13
- die(__('Cheatin&#8217; uh?'));
14
-
15
- global $wpdb;
16
-
17
- $id = (int) $_GET['id'];
18
- // let's get the meta data'
19
- $meta = new nggMeta($id);
20
- $dbdata = $meta->get_saved_meta();
21
- $exifdata = $meta->get_EXIF();
22
- $iptcdata = $meta->get_IPTC();
23
- $xmpdata = $meta->get_XMP();
24
- $class = '';
25
-
26
- ?>
27
- <!-- META DATA -->
28
- <fieldset class="options nggallery">
29
- <h3><?php _e('Meta Data','nggallery'); ?></h3>
30
- <?php if ($dbdata) { ?>
31
- <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
32
- <thead>
33
- <tr>
34
- <th scope="col"><?php _e('Tag','nggallery'); ?></th>
35
- <th scope="col"><?php _e('Value','nggallery'); ?></th>
36
- </tr>
37
- </thead>
38
- <?php
39
- foreach ($dbdata as $key => $value){
40
- if ( is_array($value) ) continue;
41
- $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
42
- echo '<tr '.$class.'>
43
- <td style="width:230px">'. esc_html( $meta->i8n_name($key) ).'</td>
44
- <td>' . esc_html( $value ) . '</td>
45
- </tr>';
46
- }
47
- ?>
48
- </table>
49
- <?php } else echo "<strong>" . __('No meta data saved','nggallery') . "</strong>"; ?>
50
- </fieldset>
51
-
52
- <!-- EXIF DATA -->
53
- <?php if ($exifdata) { ?>
54
- <fieldset class="options nggallery">
55
- <h3><?php _e('EXIF Data','nggallery'); ?></h3>
56
- <?php if ($exifdata) { ?>
57
- <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
58
- <thead>
59
- <tr>
60
- <th scope="col"><?php _e('Tag','nggallery'); ?></th>
61
- <th scope="col"><?php _e('Value','nggallery'); ?></th>
62
- </tr>
63
- </thead>
64
- <?php
65
- foreach ($exifdata as $key => $value){
66
- $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
67
- echo '<tr '.$class.'>
68
- <td style="width:230px">' . esc_html ( $meta->i8n_name($key) ) . '</td>
69
- <td>' . esc_html( $value ) .'</td>
70
- </tr>';
71
- }
72
- ?>
73
- </table>
74
- <?php } else echo "<strong>". __('No exif data','nggallery'). "</strong>"; ?>
75
- </fieldset>
76
- <?php } ?>
77
-
78
- <!-- IPTC DATA -->
79
- <?php if ($iptcdata) { ?>
80
- <fieldset class="options nggallery">
81
- <h3><?php _e('IPTC Data','nggallery'); ?></h3>
82
- <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
83
- <thead>
84
- <tr>
85
- <th scope="col"><?php _e('Tag','nggallery'); ?></th>
86
- <th scope="col"><?php _e('Value','nggallery'); ?></th>
87
- </tr>
88
- </thead>
89
- <?php
90
- foreach ($iptcdata as $key => $value){
91
- $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
92
- echo '<tr '.$class.'>
93
- <td style="width:230px">' . esc_html( $meta->i8n_name($key) ) . '</td>
94
- <td>' . esc_html( $value ) . '</td>
95
- </tr>';
96
- }
97
- ?>
98
- </table>
99
- </fieldset>
100
- <?php } ?>
101
-
102
- <!-- XMP DATA -->
103
- <?php if ($xmpdata) { ?>
104
- <fieldset class="options nggallery">
105
- <h3><?php _e('XMP Data','nggallery'); ?></h3>
106
- <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
107
- <thead>
108
- <tr>
109
- <th scope="col"><?php _e('Tag','nggallery'); ?></th>
110
- <th scope="col"><?php _e('Value','nggallery'); ?></th>
111
- </tr>
112
- </thead>
113
- <?php
114
- foreach ($xmpdata as $key => $value){
115
- $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
116
- echo '<tr '.$class.'>
117
- <td style="width:230px">' . esc_html( $meta->i8n_name($key) ) . '</td>
118
- <td>' . esc_html( $value ) . '</td>
119
- </tr>';
120
- }
121
- ?>
122
- </table>
123
- </fieldset>
124
  <?php } ?>
1
+ <?php
2
+
3
+ // look up for the path
4
+ require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
5
+
6
+ require_once(NGGALLERY_ABSPATH . '/lib/meta.php');
7
+ require_once(NGGALLERY_ABSPATH . '/lib/image.php');
8
+
9
+ if ( !is_user_logged_in() )
10
+ die(__('Cheatin&#8217; uh?'));
11
+
12
+ if ( !current_user_can('NextGEN Manage gallery') )
13
+ die(__('Cheatin&#8217; uh?'));
14
+
15
+ global $wpdb;
16
+
17
+ $id = (int) $_GET['id'];
18
+ // let's get the meta data'
19
+ $meta = new nggMeta($id);
20
+ $dbdata = $meta->get_saved_meta();
21
+ $exifdata = $meta->get_EXIF();
22
+ $iptcdata = $meta->get_IPTC();
23
+ $xmpdata = $meta->get_XMP();
24
+ $class = '';
25
+
26
+ ?>
27
+ <!-- META DATA -->
28
+ <fieldset class="options nggallery">
29
+ <h3><?php _e('Meta Data','nggallery'); ?></h3>
30
+ <?php if ($dbdata) { ?>
31
+ <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
32
+ <thead>
33
+ <tr>
34
+ <th scope="col"><?php _e('Tag','nggallery'); ?></th>
35
+ <th scope="col"><?php _e('Value','nggallery'); ?></th>
36
+ </tr>
37
+ </thead>
38
+ <?php
39
+ foreach ($dbdata as $key => $value){
40
+ if ( is_array($value) ) continue;
41
+ $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
42
+ echo '<tr '.$class.'>
43
+ <td style="width:230px">'. esc_html( $meta->i8n_name($key) ).'</td>
44
+ <td>' . esc_html( $value ) . '</td>
45
+ </tr>';
46
+ }
47
+ ?>
48
+ </table>
49
+ <?php } else echo "<strong>" . __('No meta data saved','nggallery') . "</strong>"; ?>
50
+ </fieldset>
51
+
52
+ <!-- EXIF DATA -->
53
+ <?php if ($exifdata) { ?>
54
+ <fieldset class="options nggallery">
55
+ <h3><?php _e('EXIF Data','nggallery'); ?></h3>
56
+ <?php if ($exifdata) { ?>
57
+ <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
58
+ <thead>
59
+ <tr>
60
+ <th scope="col"><?php _e('Tag','nggallery'); ?></th>
61
+ <th scope="col"><?php _e('Value','nggallery'); ?></th>
62
+ </tr>
63
+ </thead>
64
+ <?php
65
+ foreach ($exifdata as $key => $value){
66
+ $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
67
+ echo '<tr '.$class.'>
68
+ <td style="width:230px">' . esc_html ( $meta->i8n_name($key) ) . '</td>
69
+ <td>' . esc_html( $value ) .'</td>
70
+ </tr>';
71
+ }
72
+ ?>
73
+ </table>
74
+ <?php } else echo "<strong>". __('No exif data','nggallery'). "</strong>"; ?>
75
+ </fieldset>
76
+ <?php } ?>
77
+
78
+ <!-- IPTC DATA -->
79
+ <?php if ($iptcdata) { ?>
80
+ <fieldset class="options nggallery">
81
+ <h3><?php _e('IPTC Data','nggallery'); ?></h3>
82
+ <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
83
+ <thead>
84
+ <tr>
85
+ <th scope="col"><?php _e('Tag','nggallery'); ?></th>
86
+ <th scope="col"><?php _e('Value','nggallery'); ?></th>
87
+ </tr>
88
+ </thead>
89
+ <?php
90
+ foreach ($iptcdata as $key => $value){
91
+ $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
92
+ echo '<tr '.$class.'>
93
+ <td style="width:230px">' . esc_html( $meta->i8n_name($key) ) . '</td>
94
+ <td>' . esc_html( $value ) . '</td>
95
+ </tr>';
96
+ }
97
+ ?>
98
+ </table>
99
+ </fieldset>
100
+ <?php } ?>
101
+
102
+ <!-- XMP DATA -->
103
+ <?php if ($xmpdata) { ?>
104
+ <fieldset class="options nggallery">
105
+ <h3><?php _e('XMP Data','nggallery'); ?></h3>
106
+ <table id="the-list-x" width="100%" cellspacing="3" cellpadding="3">
107
+ <thead>
108
+ <tr>
109
+ <th scope="col"><?php _e('Tag','nggallery'); ?></th>
110
+ <th scope="col"><?php _e('Value','nggallery'); ?></th>
111
+ </tr>
112
+ </thead>
113
+ <?php
114
+ foreach ($xmpdata as $key => $value){
115
+ $class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
116
+ echo '<tr '.$class.'>
117
+ <td style="width:230px">' . esc_html( $meta->i8n_name($key) ) . '</td>
118
+ <td>' . esc_html( $value ) . '</td>
119
+ </tr>';
120
+ }
121
+ ?>
122
+ </table>
123
+ </fieldset>
124
  <?php } ?>
admin/style.php CHANGED
@@ -1,252 +1,252 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- function nggallery_admin_style() {
5
-
6
- global $ngg;
7
-
8
- if ( $theme_css_exists = file_exists (TEMPLATEPATH . "/nggallery.css") ) {
9
-
10
- $real_file = TEMPLATEPATH . "/nggallery.css";
11
- $file_show = 'nggallery.css ' . __('(From the theme folder)','nggallery');
12
-
13
- } else {
14
-
15
- if (isset($_POST['css'])) {
16
- check_admin_referer('ngg_style');
17
- $act_cssfile = $_POST['css'];
18
-
19
- if ( isset( $_POST['activate'] ) ) {
20
- // save option now
21
- $ngg->options['activateCSS'] = $_POST['activateCSS'];
22
- $ngg->options['CSSfile'] = $act_cssfile;
23
- update_option('ngg_options', $ngg->options);
24
- nggGallery::show_message(__('Update Successfully','nggallery'));
25
- }
26
- } else {
27
- // get the options
28
- if (isset($_POST['file']))
29
- $act_cssfile = $_POST['file'];
30
- else
31
- $act_cssfile = $ngg->options['CSSfile'];
32
- }
33
-
34
- // set the path
35
- $real_file = NGGALLERY_ABSPATH . "css/" . $act_cssfile;
36
- }
37
-
38
- if (isset($_POST['updatecss'])) {
39
-
40
- check_admin_referer('ngg_style');
41
-
42
- if ( !current_user_can('edit_themes') )
43
- wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
44
-
45
- $newcontent = stripslashes($_POST['newcontent']);
46
-
47
- if (is_writeable($real_file)) {
48
- $f = fopen($real_file, 'w+');
49
- fwrite($f, $newcontent);
50
-
51
- fclose($f);
52
- nggGallery::show_message(__('CSS file successfully updated','nggallery'));
53
- }
54
- }
55
-
56
- // get the content of the file
57
- //TODO: BUG : Read failed after write a file, maybe a Cache problem
58
- $error = ( !is_file($real_file) );
59
-
60
- if (!$error && filesize($real_file) > 0) {
61
- $f = fopen($real_file, 'r');
62
- $content = fread($f, filesize($real_file));
63
- $content = htmlspecialchars($content);
64
- }
65
-
66
- ?>
67
- <script type="text/javascript">
68
- jQuery(document).ready(function(){
69
- jQuery('#colorSelector').ColorPicker({
70
- color: '#0000ff',
71
- onShow: function (colpkr) {
72
- jQuery(colpkr).fadeIn(500);
73
- return false;
74
- },
75
- onHide: function (colpkr) {
76
- jQuery(colpkr).fadeOut(500);
77
- return false;
78
- },
79
- onChange: function (hsb, hex, rgb) {
80
- jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
81
- }
82
- });
83
- });
84
- </script>
85
- <div class="wrap">
86
-
87
- <div class="bordertitle">
88
- <?php screen_icon( 'nextgen-gallery' ); ?>
89
- <h2><?php _e('Style Editor','nggallery') ?></h2>
90
- <?php if (!$theme_css_exists) : ?>
91
- <form id="themeselector" name="cssfiles" method="post">
92
- <?php wp_nonce_field('ngg_style') ?>
93
- <strong><?php _e('Activate and use style sheet:','nggallery') ?></strong>
94
- <input type="checkbox" name="activateCSS" value="1" <?php checked('1', $ngg->options['activateCSS']); ?> />
95
- <select name="css" id="theme" style="margin: 0pt; padding: 0pt;" onchange="this.form.submit();">
96
- <?php
97
- $csslist = ngg_get_cssfiles();
98
- foreach ($csslist as $key =>$a_cssfile) {
99
- $css_name = $a_cssfile['Name'];
100
- if ($key == $act_cssfile) {
101
- $file_show = $key;
102
- $selected = " selected='selected'";
103
- $act_css_description = $a_cssfile['Description'];
104
- $act_css_author = $a_cssfile['Author'];
105
- $act_css_version = $a_cssfile['Version'];
106
- }
107
- else $selected = '';
108
- $css_name = esc_attr($css_name);
109
- echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
110
- }
111
- ?>
112
- </select>
113
- <input class="button" type="submit" name="activate" value="<?php _e('Activate','nggallery') ?> &raquo;" class="button" />
114
- </form>
115
- <?php endif; ?>
116
- </div>
117
- <br style="clear: both;"/>
118
-
119
- <?php if (!is_multisite() || wpmu_site_admin() ) { ?>
120
- <div class="tablenav">
121
- <?php
122
- if ( is_writeable($real_file) ) {
123
- echo '<big>' . sprintf(__('Editing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
124
- } else {
125
- echo '<big>' . sprintf(__('Browsing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
126
- }
127
- ?>
128
- </div>
129
- <br style="clear: both;"/>
130
-
131
- <div id="templateside">
132
- <?php if (!$theme_css_exists) : ?>
133
- <ul>
134
- <li><strong><?php _e('Author','nggallery') ?> :</strong> <?php echo $act_css_author ?></li>
135
- <li><strong><?php _e('Version','nggallery') ?> :</strong> <?php echo $act_css_version ?></li>
136
- <li><strong><?php _e('Description','nggallery') ?> :<br /></strong> <?php echo $act_css_description ?></li>
137
- </ul>
138
- <p><?php _e('Tip : Copy your stylesheet (nggallery.css) to your theme folder, so it will be not lost during a upgrade','nggallery') ?></p>
139
- <?php else: ?>
140
- <p><?php _e('Your theme contain a NextGEN Gallery stylesheet (nggallery.css), this file will be used','nggallery') ?></p>
141
- <?php endif; ?>
142
- <p><?php _e('Tip No. 2: Use the color picker below to help you find the right color scheme for your gallery!','nggallery') ?></p>
143
- <div id="colorSelector">
144
- <div></div>
145
- </div>
146
- </div>
147
- <?php
148
- if (!$error) {
149
- ?>
150
- <form name="template" id="template" method="post">
151
- <?php wp_nonce_field('ngg_style') ?>
152
- <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress css"><?php echo $content ?></textarea>
153
- <input type="hidden" name="updatecss" value="updatecss" />
154
- <input type="hidden" name="file" value="<?php echo $file_show ?>" />
155
- </div>
156
- <?php if ( is_writeable($real_file) ) : ?>
157
- <p class="submit">
158
- <input class="button-primary action" type="submit" name="submit" value="<?php _e('Update File','nggallery') ?>" tabindex="2" />
159
- </p>
160
- <?php else : ?>
161
- <p><em><?php _e('If this file were writable you could edit it.','nggallery'); ?></em></p>
162
- <?php endif; ?>
163
- </form>
164
- <?php
165
- } else {
166
- echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.','nggallery') . '</p></div>';
167
- }
168
- ?>
169
- <div class="clear"> &nbsp; </div>
170
- </div> <!-- wrap-->
171
-
172
- <?php
173
- }
174
-
175
- } // END nggallery_admin_style()
176
-
177
- /**********************************************************/
178
- // ### Code from wordpress plugin import
179
- // read in the css files
180
- function ngg_get_cssfiles() {
181
- global $cssfiles;
182
-
183
- if (isset ($cssfiles)) {
184
- return $cssfiles;
185
- }
186
-
187
- $cssfiles = array ();
188
-
189
- // Files in wp-content/plugins/nggallery/css directory
190
- $plugin_root = NGGALLERY_ABSPATH . "css";
191
-
192
- $plugins_dir = @ dir($plugin_root);
193
- if ($plugins_dir) {
194
- while (($file = $plugins_dir->read()) !== false) {
195
- if (preg_match('|^\.+$|', $file))
196
- continue;
197
- if (is_dir($plugin_root.'/'.$file)) {
198
- $plugins_subdir = @ dir($plugin_root.'/'.$file);
199
- if ($plugins_subdir) {
200
- while (($subfile = $plugins_subdir->read()) !== false) {
201
- if (preg_match('|^\.+$|', $subfile))
202
- continue;
203
- if (preg_match('|\.css$|', $subfile))
204
- $plugin_files[] = "$file/$subfile";
205
- }
206
- }
207
- } else {
208
- if (preg_match('|\.css$|', $file))
209
- $plugin_files[] = $file;
210
- }
211
- }
212
- }
213
-
214
- if ( !$plugins_dir || !$plugin_files )
215
- return $cssfiles;
216
-
217
- foreach ( $plugin_files as $plugin_file ) {
218
- if ( !is_readable("$plugin_root/$plugin_file"))
219
- continue;
220
-
221
- $plugin_data = ngg_get_cssfiles_data("$plugin_root/$plugin_file");
222
-
223
- if ( empty ($plugin_data['Name']) )
224
- continue;
225
-
226
- $cssfiles[plugin_basename($plugin_file)] = $plugin_data;
227
- }
228
-
229
- uasort($cssfiles, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
230
-
231
- return $cssfiles;
232
- }
233
-
234
- // parse the Header information
235
- function ngg_get_cssfiles_data($plugin_file) {
236
- $plugin_data = implode('', file($plugin_file));
237
- preg_match("|CSS Name:(.*)|i", $plugin_data, $plugin_name);
238
- preg_match("|Description:(.*)|i", $plugin_data, $description);
239
- preg_match("|Author:(.*)|i", $plugin_data, $author_name);
240
- if (preg_match("|Version:(.*)|i", $plugin_data, $version))
241
- $version = trim($version[1]);
242
- else
243
- $version = '';
244
-
245
- $description = wptexturize(trim($description[1]));
246
-
247
- $name = trim($plugin_name[1]);
248
- $author = trim($author_name[1]);
249
-
250
- return array ('Name' => $name, 'Description' => $description, 'Author' => $author, 'Version' => $version );
251
- }
252
  ?>
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ function nggallery_admin_style() {
5
+
6
+ global $ngg;
7
+
8
+ if ( $theme_css_exists = file_exists (TEMPLATEPATH . "/nggallery.css") ) {
9
+
10
+ $real_file = TEMPLATEPATH . "/nggallery.css";
11
+ $file_show = 'nggallery.css ' . __('(From the theme folder)','nggallery');
12
+
13
+ } else {
14
+
15
+ if (isset($_POST['css'])) {
16
+ check_admin_referer('ngg_style');
17
+ $act_cssfile = $_POST['css'];
18
+
19
+ if ( isset( $_POST['activate'] ) ) {
20
+ // save option now
21
+ $ngg->options['activateCSS'] = $_POST['activateCSS'];
22
+ $ngg->options['CSSfile'] = $act_cssfile;
23
+ update_option('ngg_options', $ngg->options);
24
+ nggGallery::show_message(__('Update Successfully','nggallery'));
25
+ }
26
+ } else {
27
+ // get the options
28
+ if (isset($_POST['file']))
29
+ $act_cssfile = $_POST['file'];
30
+ else
31
+ $act_cssfile = $ngg->options['CSSfile'];
32
+ }
33
+
34
+ // set the path
35
+ $real_file = NGGALLERY_ABSPATH . "css/" . $act_cssfile;
36
+ }
37
+
38
+ if (isset($_POST['updatecss'])) {
39
+
40
+ check_admin_referer('ngg_style');
41
+
42
+ if ( !current_user_can('edit_themes') )
43
+ wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
44
+
45
+ $newcontent = stripslashes($_POST['newcontent']);
46
+
47
+ if (is_writeable($real_file)) {
48
+ $f = fopen($real_file, 'w+');
49
+ fwrite($f, $newcontent);
50
+
51
+ fclose($f);
52
+ nggGallery::show_message(__('CSS file successfully updated','nggallery'));
53
+ }
54
+ }
55
+
56
+ // get the content of the file
57
+ //TODO: BUG : Read failed after write a file, maybe a Cache problem
58
+ $error = ( !is_file($real_file) );
59
+
60
+ if (!$error && filesize($real_file) > 0) {
61
+ $f = fopen($real_file, 'r');
62
+ $content = fread($f, filesize($real_file));
63
+ $content = htmlspecialchars($content);
64
+ }
65
+
66
+ ?>
67
+ <script type="text/javascript">
68
+ jQuery(document).ready(function(){
69
+ jQuery('#colorSelector').ColorPicker({
70
+ color: '#0000ff',
71
+ onShow: function (colpkr) {
72
+ jQuery(colpkr).fadeIn(500);
73
+ return false;
74
+ },
75
+ onHide: function (colpkr) {
76
+ jQuery(colpkr).fadeOut(500);
77
+ return false;
78
+ },
79
+ onChange: function (hsb, hex, rgb) {
80
+ jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
81
+ }
82
+ });
83
+ });
84
+ </script>
85
+ <div class="wrap">
86
+
87
+ <div class="bordertitle">
88
+ <?php screen_icon( 'nextgen-gallery' ); ?>
89
+ <h2><?php _e('Style Editor','nggallery') ?></h2>
90
+ <?php if (!$theme_css_exists) : ?>
91
+ <form id="themeselector" name="cssfiles" method="post">
92
+ <?php wp_nonce_field('ngg_style') ?>
93
+ <strong><?php _e('Activate and use style sheet:','nggallery') ?></strong>
94
+ <input type="checkbox" name="activateCSS" value="1" <?php checked('1', $ngg->options['activateCSS']); ?> />
95
+ <select name="css" id="theme" style="margin: 0pt; padding: 0pt;" onchange="this.form.submit();">
96
+ <?php
97
+ $csslist = ngg_get_cssfiles();
98
+ foreach ($csslist as $key =>$a_cssfile) {
99
+ $css_name = $a_cssfile['Name'];
100
+ if ($key == $act_cssfile) {
101
+ $file_show = $key;
102
+ $selected = " selected='selected'";
103
+ $act_css_description = $a_cssfile['Description'];
104
+ $act_css_author = $a_cssfile['Author'];
105
+ $act_css_version = $a_cssfile['Version'];
106
+ }
107
+ else $selected = '';
108
+ $css_name = esc_attr($css_name);
109
+ echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
110
+ }
111
+ ?>
112
+ </select>
113
+ <input class="button" type="submit" name="activate" value="<?php _e('Activate','nggallery') ?> &raquo;" class="button" />
114
+ </form>
115
+ <?php endif; ?>
116
+ </div>
117
+ <br style="clear: both;"/>
118
+
119
+ <?php if (!is_multisite() || wpmu_site_admin() ) { ?>
120
+ <div class="tablenav">
121
+ <?php
122
+ if ( is_writeable($real_file) ) {
123
+ echo '<big>' . sprintf(__('Editing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
124
+ } else {
125
+ echo '<big>' . sprintf(__('Browsing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
126
+ }
127
+ ?>
128
+ </div>
129
+ <br style="clear: both;"/>
130
+
131
+ <div id="templateside">
132
+ <?php if (!$theme_css_exists) : ?>
133
+ <ul>
134
+ <li><strong><?php _e('Author','nggallery') ?> :</strong> <?php echo $act_css_author ?></li>
135
+ <li><strong><?php _e('Version','nggallery') ?> :</strong> <?php echo $act_css_version ?></li>
136
+ <li><strong><?php _e('Description','nggallery') ?> :<br /></strong> <?php echo $act_css_description ?></li>
137
+ </ul>
138
+ <p><?php _e('Tip : Copy your stylesheet (nggallery.css) to your theme folder, so it will be not lost during a upgrade','nggallery') ?></p>
139
+ <?php else: ?>
140
+ <p><?php _e('Your theme contain a NextGEN Gallery stylesheet (nggallery.css), this file will be used','nggallery') ?></p>
141
+ <?php endif; ?>
142
+ <p><?php _e('Tip No. 2: Use the color picker below to help you find the right color scheme for your gallery!','nggallery') ?></p>
143
+ <div id="colorSelector">
144
+ <div></div>
145
+ </div>
146
+ </div>
147
+ <?php
148
+ if (!$error) {
149
+ ?>
150
+ <form name="template" id="template" method="post">
151
+ <?php wp_nonce_field('ngg_style') ?>
152
+ <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress css"><?php echo $content ?></textarea>
153
+ <input type="hidden" name="updatecss" value="updatecss" />
154
+ <input type="hidden" name="file" value="<?php echo $file_show ?>" />
155
+ </div>
156
+ <?php if ( is_writeable($real_file) ) : ?>
157
+ <p class="submit">
158
+ <input class="button-primary action" type="submit" name="submit" value="<?php _e('Update File','nggallery') ?>" tabindex="2" />
159
+ </p>
160
+ <?php else : ?>
161
+ <p><em><?php _e('If this file were writable you could edit it.','nggallery'); ?></em></p>
162
+ <?php endif; ?>
163
+ </form>
164
+ <?php
165
+ } else {
166
+ echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.','nggallery') . '</p></div>';
167
+ }
168
+ ?>
169
+ <div class="clear"> &nbsp; </div>
170
+ </div> <!-- wrap-->
171
+
172
+ <?php
173
+ }
174
+
175
+ } // END nggallery_admin_style()
176
+
177
+ /**********************************************************/
178
+ // ### Code from wordpress plugin import
179
+ // read in the css files
180
+ function ngg_get_cssfiles() {
181
+ global $cssfiles;
182
+
183
+ if (isset ($cssfiles)) {
184
+ return $cssfiles;
185
+ }
186
+
187
+ $cssfiles = array ();
188
+
189
+ // Files in wp-content/plugins/nggallery/css directory
190
+ $plugin_root = NGGALLERY_ABSPATH . "css";
191
+
192
+ $plugins_dir = @ dir($plugin_root);
193
+ if ($plugins_dir) {
194
+ while (($file = $plugins_dir->read()) !== false) {
195
+ if (preg_match('|^\.+$|', $file))
196
+ continue;
197
+ if (is_dir($plugin_root.'/'.$file)) {
198
+ $plugins_subdir = @ dir($plugin_root.'/'.$file);
199
+ if ($plugins_subdir) {
200
+ while (($subfile = $plugins_subdir->read()) !== false) {
201
+ if (preg_match('|^\.+$|', $subfile))
202
+ continue;
203
+ if (preg_match('|\.css$|', $subfile))
204
+ $plugin_files[] = "$file/$subfile";
205
+ }
206
+ }
207
+ } else {
208
+ if (preg_match('|\.css$|', $file))
209
+ $plugin_files[] = $file;
210
+ }
211
+ }
212
+ }
213
+
214
+ if ( !$plugins_dir || !$plugin_files )
215
+ return $cssfiles;
216
+
217
+ foreach ( $plugin_files as $plugin_file ) {
218
+ if ( !is_readable("$plugin_root/$plugin_file"))
219
+ continue;
220
+
221
+ $plugin_data = ngg_get_cssfiles_data("$plugin_root/$plugin_file");
222
+
223
+ if ( empty ($plugin_data['Name']) )
224
+ continue;
225
+
226
+ $cssfiles[plugin_basename($plugin_file)] = $plugin_data;
227
+ }
228
+
229
+ uasort($cssfiles, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
230
+
231
+ return $cssfiles;
232
+ }
233
+
234
+ // parse the Header information
235
+ function ngg_get_cssfiles_data($plugin_file) {
236
+ $plugin_data = implode('', file($plugin_file));
237
+ preg_match("|CSS Name:(.*)|i", $plugin_data, $plugin_name);
238
+ preg_match("|Description:(.*)|i", $plugin_data, $description);
239
+ preg_match("|Author:(.*)|i", $plugin_data, $author_name);
240
+ if (preg_match("|Version:(.*)|i", $plugin_data, $version))
241
+ $version = trim($version[1]);
242
+ else
243
+ $version = '';
244
+
245
+ $description = wptexturize(trim($description[1]));
246
+
247
+ $name = trim($plugin_name[1]);
248
+ $author = trim($author_name[1]);
249
+
250
+ return array ('Name' => $name, 'Description' => $description, 'Author' => $author, 'Version' => $version );
251
+ }
252
  ?>
admin/tags.php CHANGED
@@ -1,291 +1,292 @@
1
- <?php
2
- /**
3
- * Tag management page. Inspired from the Simple Tags plugin by Amaury Balmer.
4
- * http://code.google.com/p/simple-tags/
5
- */
6
-
7
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
8
-
9
- $action_status = array('message' => '', 'status' => 'ok');
10
-
11
- if ( isset($_POST['tag_action']) ) {
12
-
13
- check_admin_referer('nggallery_admin_tags');
14
-
15
- if ( $_POST['tag_action'] == 'renametag' ) {
16
- $oldtag = (isset($_POST['renametag_old'])) ? $_POST['renametag_old'] : '';
17
- $newtag = (isset($_POST['renametag_new'])) ? $_POST['renametag_new'] : '';
18
- $action_status = nggTags::rename_tags( $oldtag, $newtag );
19
- } elseif ( $_POST['tag_action'] == 'deletetag' ) {
20
- $todelete = (isset($_POST['deletetag_name'])) ? $_POST['deletetag_name'] : '';
21
- $action_status = nggTags::delete_tags( $todelete );
22
- } elseif ( $_POST['tag_action'] == 'editslug' ) {
23
- $matchtag = (isset($_POST['tagname_match'])) ? $_POST['tagname_match'] : '';
24
- $newslug = (isset($_POST['tagslug_new'])) ? $_POST['tagslug_new'] : '';
25
- $action_status = nggTags::edit_tag_slug( $matchtag, $newslug );
26
- }
27
- }
28
-
29
- // Som useful variables
30
- $admin_base_url = admin_url() . 'admin.php?page=nggallery-tags';
31
- $nb_tags = 50; // Number of tags to show on a single page
32
-
33
- // Manage URL
34
-
35
- $sort_order = ( isset($_GET['tag_sortorder']) ) ? esc_attr( stripslashes($_GET['tag_sortorder']) ) : 'desc';
36
- $search_url = ( isset($_GET['search']) ) ? '&amp;search=' . esc_attr ( stripslashes($_GET['search']) ) : '';
37
- $action_url = $admin_base_url . '&amp;tag_sortorder=' . $sort_order. $search_url;
38
-
39
- // Tags Filters
40
- $order_array = array(
41
- 'desc' => __('Most popular', 'nggallery'),
42
- 'asc' => __('Least used', 'nggallery'),
43
- 'natural' => __('Alphabetical', 'nggallery'));
44
-
45
- // Build Tags Param
46
- $param = 'hide_empty=false';
47
- switch ($sort_order) {
48
- case 'natural' :
49
- $param .= '&number='.$nb_tags.'&orderby=name&order=asc';
50
- break;
51
- case 'asc' :
52
- $param .= '&number='.$nb_tags.'&orderby=count&order=asc';
53
- break;
54
- default :
55
- $param .= '&number='.$nb_tags.'&orderby=count&order=desc';
56
- break;
57
- }
58
-
59
-
60
- // Search
61
- if ( !empty($_GET['search']) ) {
62
- $search = stripslashes($_GET['search']);
63
- $param .= '&name__like=' . $search;
64
- }
65
-
66
- // Offset
67
- if ( !empty($_GET['offset']) ) {
68
- $param .= '&offset=' . intval( $_GET['offset'] );
69
- }
70
-
71
- // Navigation urls
72
- if ( empty($_GET['offset']) ) {
73
- $offset = 0;
74
- } else {
75
- $offset = intval( $_GET['offset'] );
76
- }
77
-
78
- $tag_count = (int)wp_count_terms('ngg_tag', 'ignore_empty=true');
79
-
80
- if ($offset + $nb_tags < $tag_count) {
81
- $next_offset = '' . min($offset + $nb_tags, $tag_count - $nb_tags);
82
- } else {
83
- $next_offset = '';
84
- }
85
-
86
- if ($nb_tags < $tag_count && $offset>0) {
87
- $prev_offset = '' . max($offset - $nb_tags, 0);
88
- } else {
89
- $prev_offset = '';
90
- }
91
-
92
- ?>
93
- <style>
94
- .disabled, .disabled:hover { border-color: #E5E5E5; color: #999999; cursor: default; }
95
- </style>
96
-
97
- <div class="wrap ngg_wrap">
98
- <?php screen_icon( 'nextgen-gallery' ); ?>
99
- <h2><?php _e('Manage image tags', 'nggallery'); ?></h2>
100
-
101
- <?php if ($action_status['message']!='') : ?>
102
- <div id="message" class="<?php echo ($action_status['status']=='ok' ? 'updated' : $action_status['status']); ?> fade">
103
- <p><strong><?php echo $action_status['message']; ?></strong></p>
104
- </div>
105
- <?php endif; ?>
106
-
107
- <table>
108
- <tr>
109
- <td class="list_tags">
110
- <fieldset class="options" id="taglist">
111
- <h3><?php _e('Existing Tags', 'nggallery'); ?></h3>
112
-
113
- <form method="get">
114
- <p>
115
- <label for="search"><?php _e('Search tags', 'nggallery'); ?></label><br />
116
- <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
117
- <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
118
- <input type="text" name="search" id="search" size="10" value="<?php if (isset($_GET['search'])) echo esc_attr( stripslashes($_GET['search']) ); ?>" />
119
- <input class="button" type="submit" value="<?php _e('Go', 'nggallery'); ?>" />
120
- </p>
121
- </form>
122
-
123
- <div class="sort_order">
124
- <h3><?php _e('Sort Order:', 'nggallery'); ?></h3>
125
- <?php
126
- $output = array();
127
- foreach( $order_array as $sort => $title ) {
128
- $output[] = ($sort == $sort_order) ? '<span style="color: red;">'.$title.'</span>' : '<a href="'. $admin_base_url . '&amp;tag_sortorder=' . $sort . $search_url .'">'.$title.'</a>';
129
- }
130
- echo implode('<br />', $output);
131
- $output = array();
132
- unset($output);
133
- ?>
134
- </div>
135
-
136
- <div id="ajax_area_tagslist">
137
- <ul>
138
- <?php
139
- $tags = (array) nggTags::find_tags($param, true);
140
- foreach( $tags as $tag ) {
141
- //TODO:Tag link should be call a list of images in manage gallery
142
- //echo '<li><span>' . $tag->name . '</span>&nbsp;<a href="'.(ngg_get_tag_link( $tag->term_id )).'" title="'.sprintf(__('View all images tagged with %s', 'nggallery'), $tag->name).'">('.$tag->count.')</a></li>'."\n";
143
- echo '<li><span>' . esc_html( $tag->name ). '</span>&nbsp;'.'('. esc_html( $tag->count ).')</li>'."\n";
144
-
145
- }
146
- unset($tags);
147
- ?>
148
- </ul>
149
-
150
- <?php if ( $prev_offset!='' || $next_offset!='' ) : ?>
151
- <div class="navigation">
152
-
153
- <?php if ($prev_offset!='') { ?>
154
- <form method="get" style="display: inline;">
155
- <span>
156
- <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
157
- <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
158
- <input type="hidden" name="offset" value="<?php echo $prev_offset; ?>" />
159
- <input class="button" type="submit" value="&laquo; <?php _e('Previous tags', 'nggallery'); ?>" />
160
- </span>
161
- </form>
162
- <?php } else { ?>
163
- <span><span class="button disabled">&laquo; <?php _e('Previous tags', 'nggallery'); ?></span></span>
164
- <?php } ?>
165
-
166
- <?php if ($next_offset!='') { ?>
167
- <form method="get" style="display: inline;">
168
- <span>
169
- <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
170
- <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
171
- <input type="hidden" name="offset" value="<?php echo $next_offset; ?>" />
172
- <input class="button" type="submit" value="<?php _e('Next tags', 'nggallery'); ?> &raquo;" />
173
- </span>
174
- </form>
175
- <?php } else { ?>
176
- <span><span class="button disabled"><?php _e('Previous tags', 'nggallery'); ?> &raquo;</span></span>
177
- <?php } ?>
178
- </div>
179
- <?php endif; ?>
180
- </div>
181
- </fieldset>
182
- </td>
183
- <td class="forms_manage">
184
- <h3><?php _e('Rename Tag', 'nggallery'); ?></h3>
185
- <form action="<?php echo $action_url; ?>" method="post">
186
- <input type="hidden" name="tag_action" value="renametag" />
187
- <?php wp_nonce_field('nggallery_admin_tags'); ?>
188
-
189
- <table class="form-table">
190
- <tr valign="top">
191
- <td colspan="2">
192
- <p><?php _e('Enter the tag to rename and its new value. You can use this feature to merge tags too. Click "Rename" and all posts which use this tag will be updated.', 'nggallery'); ?></p>
193
- <p><?php _e('You can specify multiple tags to rename by separating them with commas.', 'nggallery'); ?></p>
194
- </td>
195
- </tr>
196
- <tr valign="top">
197
- <th scope="row"><label for="renametag_old"><?php _e('Tag(s) to rename:', 'nggallery'); ?></label></th>
198
- <td><input type="text" id="renametag_old" name="renametag_old" value="" size="40" /></td>
199
- </tr>
200
- <tr valign="top">
201
- <th scope="row"><label for="renametag_new"><?php _e('New tag name(s):', 'nggallery'); ?></label></th>
202
- <td>
203
- <input type="text" id="renametag_new" name="renametag_new" value="" size="40" />
204
- <input class="button" type="submit" name="rename" value="<?php _e('Rename', 'nggallery'); ?>" />
205
- </td>
206
- </tr>
207
- </table>
208
- </form>
209
-
210
- <h3><?php _e('Delete Tag', 'nggallery'); ?></h3>
211
- <form action="<?php echo $action_url; ?>" method="post">
212
- <input type="hidden" name="tag_action" value="deletetag" />
213
- <?php wp_nonce_field('nggallery_admin_tags'); ?>
214
-
215
- <table class="form-table">
216
- <tr valign="top">
217
- <td colspan="2">
218
- <p><?php _e('Enter the name of the tag to delete. This tag will be removed from all posts.', 'nggallery'); ?></p>
219
- <p><?php _e('You can specify multiple tags to delete by separating them with commas', 'nggallery'); ?>.</p>
220
- </td>
221
- </tr>
222
- <tr valign="top">
223
- <th scope="row"><label for="deletetag_name"><?php _e('Tag(s) to delete:', 'nggallery'); ?></label></th>
224
- <td>
225
- <input type="text" id="deletetag_name" name="deletetag_name" value="" size="40" />
226
- <input class="button" type="submit" name="delete" value="<?php _e('Delete', 'nggallery'); ?>" />
227
- </td>
228
- </tr>
229
- </table>
230
- </form>
231
-
232
- <h3><?php _e('Edit Tag Slug', 'nggallery'); ?></h3>
233
- <form action="<?php echo $action_url; ?>" method="post">
234
- <input type="hidden" name="tag_action" value="editslug" />
235
- <?php wp_nonce_field('nggallery_admin_tags'); ?>
236
-
237
- <table class="form-table">
238
- <tr valign="top">
239
- <td colspan="2">
240
- <p><?php _e('Enter the tag name to edit and its new slug. <a href="http://codex.wordpress.org/Glossary#Slug">Slug definition</a>', 'nggallery'); ?></p>
241
- <p><?php _e('You can specify multiple tags to rename by separating them with commas.', 'nggallery'); ?></p>
242
- </td>
243
- </tr>
244
- <tr valign="top">
245
- <th scope="row"><label for="tagname_match"><?php _e('Tag(s) to match:', 'nggallery'); ?></label></th>
246
- <td><input type="text" id="tagname_match" name="tagname_match" value="" size="40" /></td>
247
- </tr>
248
- <tr valign="top">
249
- <th scope="row"><label for="tagslug_new"><?php _e('Slug(s) to set:', 'nggallery'); ?></label></th>
250
- <td>
251
- <input type="text" id="tagslug_new" name="tagslug_new" value="" size="40" />
252
- <input class="button" type="submit" name="edit" value="<?php _e('Edit', 'nggallery'); ?>" />
253
- </td>
254
- </tr>
255
- </table>
256
- </form>
257
- </td>
258
- </tr>
259
- </table>
260
- <script type="text/javascript">
261
- // <![CDATA[
262
- // Register onclick event
263
- function registerClick() {
264
- jQuery('#taglist ul li span').bind("click", function(){
265
- addTag(this.innerHTML, "renametag_old");
266
- addTag(this.innerHTML, "deletetag_name");
267
- addTag(this.innerHTML, "tagname_match");
268
- });
269
- }
270
-
271
- // Register initial event
272
- jQuery(document).ready(function() {
273
- registerClick();
274
- });
275
-
276
- // Add tag into input
277
- function addTag( tag, name_element ) {
278
- var input_element = document.getElementById( name_element );
279
-
280
- if ( input_element.value.length > 0 && !input_element.value.match(/,\s*$/) )
281
- input_element.value += ", ";
282
-
283
- var re = new RegExp(tag + ",");
284
- if ( !input_element.value.match(re) )
285
- input_element.value += tag + ", ";
286
-
287
- return true;
288
- }
289
- // ]]>
290
- </script>
 
291
  </div>
1
+ <?php
2
+ /**
3
+ * Tag management page. Inspired from the Simple Tags plugin by Amaury Balmer.
4
+ * http://code.google.com/p/simple-tags/
5
+ */
6
+
7
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
8
+
9
+ $action_status = array('message' => '', 'status' => 'ok');
10
+
11
+ if ( isset($_POST['tag_action']) ) {
12
+
13
+ check_admin_referer('nggallery_admin_tags');
14
+
15
+ if ( $_POST['tag_action'] == 'renametag' ) {
16
+ $oldtag = (isset($_POST['renametag_old'])) ? $_POST['renametag_old'] : '';
17
+ $newtag = (isset($_POST['renametag_new'])) ? $_POST['renametag_new'] : '';
18
+ $action_status = nggTags::rename_tags( $oldtag, $newtag );
19
+ } elseif ( $_POST['tag_action'] == 'deletetag' ) {
20
+ $todelete = (isset($_POST['deletetag_name'])) ? $_POST['deletetag_name'] : '';
21
+ $action_status = nggTags::delete_tags( $todelete );
22
+ } elseif ( $_POST['tag_action'] == 'editslug' ) {
23
+ $matchtag = (isset($_POST['tagname_match'])) ? $_POST['tagname_match'] : '';
24
+ $newslug = (isset($_POST['tagslug_new'])) ? $_POST['tagslug_new'] : '';
25
+ $action_status = nggTags::edit_tag_slug( $matchtag, $newslug );
26
+ }
27
+ }
28
+
29
+ // Som useful variables
30
+ $admin_base_url = admin_url() . 'admin.php?page=nggallery-tags';
31
+ $nb_tags = 50; // Number of tags to show on a single page
32
+
33
+ // Manage URL
34
+
35
+ $sort_order = ( isset($_GET['tag_sortorder']) ) ? esc_attr( stripslashes($_GET['tag_sortorder']) ) : 'desc';
36
+ $search_url = ( isset($_GET['search']) ) ? '&amp;search=' . esc_attr ( stripslashes($_GET['search']) ) : '';
37
+ $action_url = $admin_base_url . '&amp;tag_sortorder=' . $sort_order. $search_url;
38
+
39
+ // Tags Filters
40
+ $order_array = array(
41
+ 'desc' => __('Most popular', 'nggallery'),
42
+ 'asc' => __('Least used', 'nggallery'),
43
+ 'natural' => __('Alphabetical', 'nggallery'));
44
+
45
+ // Build Tags Param
46
+ $param = 'hide_empty=false';
47
+ switch ($sort_order) {
48
+ case 'natural' :
49
+ $param .= '&number='.$nb_tags.'&orderby=name&order=asc';
50
+ break;
51
+ case 'asc' :
52
+ $param .= '&number='.$nb_tags.'&orderby=count&order=asc';
53
+ break;
54
+ default :
55
+ $param .= '&number='.$nb_tags.'&orderby=count&order=desc';
56
+ break;
57
+ }
58
+
59
+
60
+ // Search
61
+ if ( !empty($_GET['search']) ) {
62
+ $search = stripslashes($_GET['search']);
63
+ $param .= '&name__like=' . $search;
64
+ }
65
+
66
+ // Offset
67
+ if ( !empty($_GET['offset']) ) {
68
+ $param .= '&offset=' . intval( $_GET['offset'] );
69
+ }
70
+
71
+ // Navigation urls
72
+ if ( empty($_GET['offset']) ) {
73
+ $offset = 0;
74
+ } else {
75
+ $offset = intval( $_GET['offset'] );
76
+ }
77
+
78
+ $tag_count = (int)wp_count_terms('ngg_tag', 'ignore_empty=true');
79
+
80
+ if ($offset + $nb_tags < $tag_count) {
81
+ $next_offset = '' . min($offset + $nb_tags, $tag_count - $nb_tags);
82
+ } else {
83
+ $next_offset = '';
84
+ }
85
+
86
+ if ($nb_tags < $tag_count && $offset>0) {
87
+ $prev_offset = '' . max($offset - $nb_tags, 0);
88
+ } else {
89
+ $prev_offset = '';
90
+ }
91
+
92
+ ?>
93
+ <style>
94
+ .disabled, .disabled:hover { border-color: #E5E5E5; color: #999999; cursor: default; }
95
+ </style>
96
+
97
+ <div class="wrap ngg_wrap">
98
+ <?php include('templates/social_media_buttons.php'); ?>
99
+ <?php screen_icon( 'nextgen-gallery' ); ?>
100
+ <h2><?php _e('Manage image tags', 'nggallery'); ?></h2>
101
+
102
+ <?php if ($action_status['message']!='') : ?>
103
+ <div id="message" class="<?php echo ($action_status['status']=='ok' ? 'updated' : $action_status['status']); ?> fade">
104
+ <p><strong><?php echo $action_status['message']; ?></strong></p>
105
+ </div>
106
+ <?php endif; ?>
107
+
108
+ <table>
109
+ <tr>
110
+ <td class="list_tags">
111
+ <fieldset class="options" id="taglist">
112
+ <h3><?php _e('Existing Tags', 'nggallery'); ?></h3>
113
+
114
+ <form method="get">
115
+ <p>
116
+ <label for="search"><?php _e('Search tags', 'nggallery'); ?></label><br />
117
+ <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
118
+ <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
119
+ <input type="text" name="search" id="search" size="10" value="<?php if (isset($_GET['search'])) echo esc_attr( stripslashes($_GET['search']) ); ?>" />
120
+ <input class="button" type="submit" value="<?php _e('Go', 'nggallery'); ?>" />
121
+ </p>
122
+ </form>
123
+
124
+ <div class="sort_order">
125
+ <h3><?php _e('Sort Order:', 'nggallery'); ?></h3>
126
+ <?php
127
+ $output = array();
128
+ foreach( $order_array as $sort => $title ) {
129
+ $output[] = ($sort == $sort_order) ? '<span style="color: red;">'.$title.'</span>' : '<a href="'. $admin_base_url . '&amp;tag_sortorder=' . $sort . $search_url .'">'.$title.'</a>';
130
+ }
131
+ echo implode('<br />', $output);
132
+ $output = array();
133
+ unset($output);
134
+ ?>
135
+ </div>
136
+
137
+ <div id="ajax_area_tagslist">
138
+ <ul>
139
+ <?php
140
+ $tags = (array) nggTags::find_tags($param, true);
141
+ foreach( $tags as $tag ) {
142
+ //TODO:Tag link should be call a list of images in manage gallery
143
+ //echo '<li><span>' . $tag->name . '</span>&nbsp;<a href="'.(ngg_get_tag_link( $tag->term_id )).'" title="'.sprintf(__('View all images tagged with %s', 'nggallery'), $tag->name).'">('.$tag->count.')</a></li>'."\n";
144
+ echo '<li><span>' . esc_html( $tag->name ). '</span>&nbsp;'.'('. esc_html( $tag->count ).')</li>'."\n";
145
+
146
+ }
147
+ unset($tags);
148
+ ?>
149
+ </ul>
150
+
151
+ <?php if ( $prev_offset!='' || $next_offset!='' ) : ?>
152
+ <div class="navigation">
153
+
154
+ <?php if ($prev_offset!='') { ?>
155
+ <form method="get" style="display: inline;">
156
+ <span>
157
+ <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
158
+ <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
159
+ <input type="hidden" name="offset" value="<?php echo $prev_offset; ?>" />
160
+ <input class="button" type="submit" value="&laquo; <?php _e('Previous tags', 'nggallery'); ?>" />
161
+ </span>
162
+ </form>
163
+ <?php } else { ?>
164
+ <span><span class="button disabled">&laquo; <?php _e('Previous tags', 'nggallery'); ?></span></span>
165
+ <?php } ?>
166
+
167
+ <?php if ($next_offset!='') { ?>
168
+ <form method="get" style="display: inline;">
169
+ <span>
170
+ <input type="hidden" name="page" value="<?php echo esc_attr( stripslashes($_GET['page']) ); ?>" />
171
+ <input type="hidden" name="tag_sortorder" value="<?php echo $sort_order; ?>" />
172
+ <input type="hidden" name="offset" value="<?php echo $next_offset; ?>" />
173
+ <input class="button" type="submit" value="<?php _e('Next tags', 'nggallery'); ?> &raquo;" />
174
+ </span>
175
+ </form>
176
+ <?php } else { ?>
177
+ <span><span class="button disabled"><?php _e('Previous tags', 'nggallery'); ?> &raquo;</span></span>
178
+ <?php } ?>
179
+ </div>
180
+ <?php endif; ?>
181
+ </div>
182
+ </fieldset>
183
+ </td>
184
+ <td class="forms_manage">
185
+ <h3><?php _e('Rename Tag', 'nggallery'); ?></h3>
186
+ <form action="<?php echo $action_url; ?>" method="post">
187
+ <input type="hidden" name="tag_action" value="renametag" />
188
+ <?php wp_nonce_field('nggallery_admin_tags'); ?>
189
+
190
+ <table class="form-table">
191
+ <tr valign="top">
192
+ <td colspan="2">
193
+ <p><?php _e('Enter the tag to rename and its new value. You can use this feature to merge tags too. Click "Rename" and all posts which use this tag will be updated.', 'nggallery'); ?></p>
194
+ <p><?php _e('You can specify multiple tags to rename by separating them with commas.', 'nggallery'); ?></p>
195
+ </td>
196
+ </tr>
197
+ <tr valign="top">
198
+ <th scope="row"><label for="renametag_old"><?php _e('Tag(s) to rename:', 'nggallery'); ?></label></th>
199
+ <td><input type="text" id="renametag_old" name="renametag_old" value="" size="40" /></td>
200
+ </tr>
201
+ <tr valign="top">
202
+ <th scope="row"><label for="renametag_new"><?php _e('New tag name(s):', 'nggallery'); ?></label></th>
203
+ <td>
204
+ <input type="text" id="renametag_new" name="renametag_new" value="" size="40" />
205
+ <input class="button" type="submit" name="rename" value="<?php _e('Rename', 'nggallery'); ?>" />
206
+ </td>
207
+ </tr>
208
+ </table>
209
+ </form>
210
+
211
+ <h3><?php _e('Delete Tag', 'nggallery'); ?></h3>
212
+ <form action="<?php echo $action_url; ?>" method="post">
213
+ <input type="hidden" name="tag_action" value="deletetag" />
214
+ <?php wp_nonce_field('nggallery_admin_tags'); ?>
215
+
216
+ <table class="form-table">
217
+ <tr valign="top">
218
+ <td colspan="2">
219
+ <p><?php _e('Enter the name of the tag to delete. This tag will be removed from all posts.', 'nggallery'); ?></p>
220
+ <p><?php _e('You can specify multiple tags to delete by separating them with commas', 'nggallery'); ?>.</p>
221
+ </td>
222
+ </tr>
223
+ <tr valign="top">
224
+ <th scope="row"><label for="deletetag_name"><?php _e('Tag(s) to delete:', 'nggallery'); ?></label></th>
225
+ <td>
226
+ <input type="text" id="deletetag_name" name="deletetag_name" value="" size="40" />
227
+ <input class="button" type="submit" name="delete" value="<?php _e('Delete', 'nggallery'); ?>" />
228
+ </td>
229
+ </tr>
230
+ </table>
231
+ </form>
232
+
233
+ <h3><?php _e('Edit Tag Slug', 'nggallery'); ?></h3>
234
+ <form action="<?php echo $action_url; ?>" method="post">
235
+ <input type="hidden" name="tag_action" value="editslug" />
236
+ <?php wp_nonce_field('nggallery_admin_tags'); ?>
237
+
238
+ <table class="form-table">
239
+ <tr valign="top">
240
+ <td colspan="2">
241
+ <p><?php _e('Enter the tag name to edit and its new slug. <a href="http://codex.wordpress.org/Glossary#Slug">Slug definition</a>', 'nggallery'); ?></p>
242
+ <p><?php _e('You can specify multiple tags to rename by separating them with commas.', 'nggallery'); ?></p>
243
+ </td>
244
+ </tr>
245
+ <tr valign="top">
246
+ <th scope="row"><label for="tagname_match"><?php _e('Tag(s) to match:', 'nggallery'); ?></label></th>
247
+ <td><input type="text" id="tagname_match" name="tagname_match" value="" size="40" /></td>
248
+ </tr>
249
+ <tr valign="top">
250
+ <th scope="row"><label for="tagslug_new"><?php _e('Slug(s) to set:', 'nggallery'); ?></label></th>
251
+ <td>
252
+ <input type="text" id="tagslug_new" name="tagslug_new" value="" size="40" />
253
+ <input class="button" type="submit" name="edit" value="<?php _e('Edit', 'nggallery'); ?>" />
254
+ </td>
255
+ </tr>
256
+ </table>
257
+ </form>
258
+ </td>
259
+ </tr>
260
+ </table>
261
+ <script type="text/javascript">
262
+ // <![CDATA[
263
+ // Register onclick event
264
+ function registerClick() {
265
+ jQuery('#taglist ul li span').bind("click", function(){
266
+ addTag(this.innerHTML, "renametag_old");
267
+ addTag(this.innerHTML, "deletetag_name");
268
+ addTag(this.innerHTML, "tagname_match");
269
+ });
270
+ }
271
+
272
+ // Register initial event
273
+ jQuery(document).ready(function() {
274
+ registerClick();
275
+ });
276
+
277
+ // Add tag into input
278
+ function addTag( tag, name_element ) {
279
+ var input_element = document.getElementById( name_element );
280
+
281
+ if ( input_element.value.length > 0 && !input_element.value.match(/,\s*$/) )
282
+ input_element.value += ", ";
283
+
284
+ var re = new RegExp(tag + ",");
285
+ if ( !input_element.value.match(re) )
286
+ input_element.value += tag + ", ";
287
+
288
+ return true;
289
+ }
290
+ // ]]>
291
+ </script>
292
  </div>
admin/templates/facebook_like_button.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <div id="fb-root"></div>
2
+ <div id="ngg_facebook_like" class="fb-like" data-href="https://www.facebook.com/NextGENGallery" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
admin/templates/latest_news_notice.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <style>
2
+ .ngg_latest_news_notice .wp-pointer-arrow{
3
+ left: 20px;
4
+ }
5
+ </style>
6
+ <h3>Important Announcement</h3>
7
+ <p>We're happy to announce Photocrati has acquired NextGEN Gallery.</p>
8
+ <p>
9
+ For more on our plans, visit the new <a target="_blank" href='http://www.nextgen-gallery.com'>NextGEN Gallery website</a>.
10
+ For more on what's included in our first NextGEN Update, see <a target="_blank" href='http://www.nextgen-gallery.com/latest-release-notes'>here</a>.
11
+ </p>
12
+ <p>
13
+ <?php include('twitter_follow_link.php'); ?>
14
+ </p>
admin/templates/social_media_buttons.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <div id="ngg_social_media">
2
+ <?php include('twitter_follow_link.php'); ?>
3
+ <?php include('facebook_like_button.php'); ?>
4
+ </div>
admin/templates/twitter_follow_link.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <a
2
+ href='https://twitter.com/NextGENGallery'
3
+ id="ngg_twitter_follow"
4
+ class='twitter-follow-button'
5
+ data-show-count='false'
6
+ data-lang='en'>
7
+ Follow @NextGENGallery
8
+ </a>
admin/tinymce/editor_plugin.js CHANGED
@@ -1,77 +1,77 @@
1
- // Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
2
-
3
- (function() {
4
- // Load plugin specific language pack
5
- tinymce.PluginManager.requireLangPack('NextGEN');
6
-
7
- tinymce.create('tinymce.plugins.NextGEN', {
8
- /**
9
- * Initializes the plugin, this will be executed after the plugin has been created.
10
- * This call is done before the editor instance has finished it's initialization so use the onInit event
11
- * of the editor instance to intercept that event.
12
- *
13
- * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
14
- * @param {string} url Absolute URL to where the plugin is located.
15
- */
16
- init : function(ed, url) {
17
- // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
18
-
19
- ed.addCommand('mceNextGEN', function() {
20
- ed.windowManager.open({
21
- // call content via admin-ajax, no need to know the full plugin path
22
- file : ajaxurl + '?action=ngg_tinymce',
23
- width : 360 + ed.getLang('NextGEN.delta_width', 0),
24
- height : 210 + ed.getLang('NextGEN.delta_height', 0),
25
- inline : 1
26
- }, {
27
- plugin_url : url // Plugin absolute URL
28
- });
29
- });
30
-
31
- // Register example button
32
- ed.addButton('NextGEN', {
33
- title : 'NextGEN.desc',
34
- cmd : 'mceNextGEN',
35
- image : url + '/nextgen.gif'
36
- });
37
-
38
- // Add a node change handler, selects the button in the UI when a image is selected
39
- ed.onNodeChange.add(function(ed, cm, n) {
40
- cm.setActive('NextGEN', n.nodeName == 'IMG');
41
- });
42
- },
43
-
44
- /**
45
- * Creates control instances based in the incomming name. This method is normally not
46
- * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
47
- * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
48
- * method can be used to create those.
49
- *
50
- * @param {String} n Name of the control to create.
51
- * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
52
- * @return {tinymce.ui.Control} New control instance or null if no control was created.
53
- */
54
- createControl : function(n, cm) {
55
- return null;
56
- },
57
-
58
- /**
59
- * Returns information about the plugin as a name/value array.
60
- * The current keys are longname, author, authorurl, infourl and version.
61
- *
62
- * @return {Object} Name/value array containing information about the plugin.
63
- */
64
- getInfo : function() {
65
- return {
66
- longname : 'NextGEN',
67
- author : 'Alex Rabe',
68
- authorurl : 'http://alexrabe.de',
69
- infourl : 'http://alexrabe.de',
70
- version : "2.0"
71
- };
72
- }
73
- });
74
-
75
- // Register plugin
76
- tinymce.PluginManager.add('NextGEN', tinymce.plugins.NextGEN);
77
- })();
1
+ // Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
2
+
3
+ (function() {
4
+ // Load plugin specific language pack
5
+ tinymce.PluginManager.requireLangPack('NextGEN');
6
+
7
+ tinymce.create('tinymce.plugins.NextGEN', {
8
+ /**
9
+ * Initializes the plugin, this will be executed after the plugin has been created.
10
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
11
+ * of the editor instance to intercept that event.
12
+ *
13
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
14
+ * @param {string} url Absolute URL to where the plugin is located.
15
+ */
16
+ init : function(ed, url) {
17
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
18
+
19
+ ed.addCommand('mceNextGEN', function() {
20
+ ed.windowManager.open({
21
+ // call content via admin-ajax, no need to know the full plugin path
22
+ file : ajaxurl + '?action=ngg_tinymce',
23
+ width : 360 + ed.getLang('NextGEN.delta_width', 0),
24
+ height : 210 + ed.getLang('NextGEN.delta_height', 0),
25
+ inline : 1
26
+ }, {
27
+ plugin_url : url // Plugin absolute URL
28
+ });
29
+ });
30
+
31
+ // Register example button
32
+ ed.addButton('NextGEN', {
33
+ title : 'NextGEN.desc',
34
+ cmd : 'mceNextGEN',
35
+ image : url + '/nextgen.gif'
36
+ });
37
+
38
+ // Add a node change handler, selects the button in the UI when a image is selected
39
+ ed.onNodeChange.add(function(ed, cm, n) {
40
+ cm.setActive('NextGEN', n.nodeName == 'IMG');
41
+ });
42
+ },
43
+
44
+ /**
45
+ * Creates control instances based in the incomming name. This method is normally not
46
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
47
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
48
+ * method can be used to create those.
49
+ *
50
+ * @param {String} n Name of the control to create.
51
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
52
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
53
+ */
54
+ createControl : function(n, cm) {
55
+ return null;
56
+ },
57
+
58
+ /**
59
+ * Returns information about the plugin as a name/value array.
60
+ * The current keys are longname, author, authorurl, infourl and version.
61
+ *
62
+ * @return {Object} Name/value array containing information about the plugin.
63
+ */
64
+ getInfo : function() {
65
+ return {
66
+ longname : 'NextGEN',
67
+ author : 'Photocrati',
68
+ authorurl : 'http://www.photocrati.com/',
69
+ infourl : 'http://www.nextgen-gallery.com/',
70
+ version : "2.0"
71
+ };
72
+ }
73
+ });
74
+
75
+ // Register plugin
76
+ tinymce.PluginManager.add('NextGEN', tinymce.plugins.NextGEN);
77
+ })();
admin/tinymce/tinymce.js CHANGED
@@ -1,75 +1,75 @@
1
- function init() {
2
- tinyMCEPopup.resizeToInnerSize();
3
- }
4
-
5
- function getCheckedValue(radioObj) {
6
- if(!radioObj)
7
- return "";
8
- var radioLength = radioObj.length;
9
- if(radioLength == undefined)
10
- if(radioObj.checked)
11
- return radioObj.value;
12
- else
13
- return "";
14
- for(var i = 0; i < radioLength; i++) {
15
- if(radioObj[i].checked) {
16
- return radioObj[i].value;
17
- }
18
- }
19
- return "";
20
- }
21
-
22
- function insertNGGLink() {
23
-
24
- var tagtext;
25
-
26
- var gallery = document.getElementById('gallery_panel');
27
- var album = document.getElementById('album_panel');
28
- var singlepic = document.getElementById('singlepic_panel');
29
-
30
- // who is active ?
31
- if (gallery.className.indexOf('current') != -1) {
32
- var galleryid = document.getElementById('gallerytag').value;
33
- var showtype = getCheckedValue(document.getElementsByName('showtype'));
34
- if (galleryid != 0 )
35
- tagtext = "["+ showtype + " id=" + galleryid + "]";
36
- else
37
- tinyMCEPopup.close();
38
- }
39
-
40
- if (album.className.indexOf('current') != -1) {
41
- var albumid = document.getElementById('albumtag').value;
42
- var showtype = getCheckedValue(document.getElementsByName('albumtype'));
43
- if (albumid != 0 )
44
- tagtext = "[album id=" + albumid + " template=" + showtype + "]";
45
- else
46
- tinyMCEPopup.close();
47
- }
48
-
49
- if (singlepic.className.indexOf('current') != -1) {
50
- var singlepicid = document.getElementById('singlepictag').value;
51
- var imgWidth = document.getElementById('imgWidth').value;
52
- var imgHeight = document.getElementById('imgHeight').value;
53
- var imgeffect = document.getElementById('imgeffect').value;
54
- var imgfloat = document.getElementById('imgfloat').value;
55
-
56
- if (singlepicid != 0 ) {
57
- if (imgeffect == "none")
58
- tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " float=" + imgfloat + "]";
59
- else
60
- tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " mode=" + imgeffect + " float=" + imgfloat + "]";
61
- } else {
62
- tinyMCEPopup.close();
63
- }
64
- }
65
-
66
- if(window.tinyMCE) {
67
- window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, tagtext);
68
- //Peforms a clean up of the current editor HTML.
69
- //tinyMCEPopup.editor.execCommand('mceCleanup');
70
- //Repaints the editor. Sometimes the browser has graphic glitches.
71
- tinyMCEPopup.editor.execCommand('mceRepaint');
72
- tinyMCEPopup.close();
73
- }
74
- return;
75
- }
1
+ function init() {
2
+ tinyMCEPopup.resizeToInnerSize();
3
+ }
4
+
5
+ function getCheckedValue(radioObj) {
6
+ if(!radioObj)
7
+ return "";
8
+ var radioLength = radioObj.length;
9
+ if(radioLength == undefined)
10
+ if(radioObj.checked)
11
+ return radioObj.value;
12
+ else
13
+ return "";
14
+ for(var i = 0; i < radioLength; i++) {
15
+ if(radioObj[i].checked) {
16
+ return radioObj[i].value;
17
+ }
18
+ }
19
+ return "";
20
+ }
21
+
22
+ function insertNGGLink() {
23
+
24
+ var tagtext;
25
+
26
+ var gallery = document.getElementById('gallery_panel');
27
+ var album = document.getElementById('album_panel');
28
+ var singlepic = document.getElementById('singlepic_panel');
29
+
30
+ // who is active ?
31
+ if (gallery.className.indexOf('current') != -1) {
32
+ var galleryid = document.getElementById('gallerytag').value;
33
+ var showtype = getCheckedValue(document.getElementsByName('showtype'));
34
+ if (galleryid != 0 )
35
+ tagtext = "["+ showtype + " id=" + galleryid + "]";
36
+ else
37
+ tinyMCEPopup.close();
38
+ }
39
+
40
+ if (album.className.indexOf('current') != -1) {
41
+ var albumid = document.getElementById('albumtag').value;
42
+ var showtype = getCheckedValue(document.getElementsByName('albumtype'));
43
+ if (albumid != 0 )
44
+ tagtext = "[album id=" + albumid + " template=" + showtype + "]";
45
+ else
46
+ tinyMCEPopup.close();
47
+ }
48
+
49
+ if (singlepic.className.indexOf('current') != -1) {
50
+ var singlepicid = document.getElementById('singlepictag').value;
51
+ var imgWidth = document.getElementById('imgWidth').value;
52
+ var imgHeight = document.getElementById('imgHeight').value;
53
+ var imgeffect = document.getElementById('imgeffect').value;
54
+ var imgfloat = document.getElementById('imgfloat').value;
55
+
56
+ if (singlepicid != 0 ) {
57
+ if (imgeffect == "none")
58
+ tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " float=" + imgfloat + "]";
59
+ else
60
+ tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " mode=" + imgeffect + " float=" + imgfloat + "]";
61
+ } else {
62
+ tinyMCEPopup.close();
63
+ }
64
+ }
65
+
66
+ if(window.tinyMCE) {
67
+ window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, tagtext);
68
+ //Peforms a clean up of the current editor HTML.
69
+ //tinyMCEPopup.editor.execCommand('mceCleanup');
70
+ //Repaints the editor. Sometimes the browser has graphic glitches.
71
+ tinyMCEPopup.editor.execCommand('mceRepaint');
72
+ tinyMCEPopup.close();
73
+ }
74
+ return;
75
+ }
admin/tinymce/tinymce.php CHANGED
@@ -1,101 +1,102 @@
1
- <?php
2
-
3
- /**
4
- * add_nextgen_button
5
- *
6
- * @package NextGEN Gallery
7
- * @title TinyMCE V3 Button Integration (for WP2.5 and higher)
8
- * @author Alex Rabe
9
- * @access public
10
- */
11
- class add_nextgen_button {
12
-
13
- var $pluginname = 'NextGEN';
14
- var $path = '';
15
- var $internalVersion = 200;
16
-
17
- /**
18
- * add_nextgen_button::add_nextgen_button()
19
- * the constructor
20
- *
21
- * @return void
22
- */
23
- function add_nextgen_button() {
24
-
25
- // Set path to editor_plugin.js
26
- $this->path = NGGALLERY_URLPATH . 'admin/tinymce/';
27
-
28
- // Modify the version when tinyMCE plugins are changed.
29
- add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
30
-
31
- // init process for button control
32
- add_action('init', array (&$this, 'addbuttons') );
33
- }
34
-
35
- /**
36
- * add_nextgen_button::addbuttons()
37
- *
38
- * @return void
39
- */
40
- function addbuttons() {
41
-
42
- // Don't bother doing this stuff if the current user lacks permissions
43
- if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
44
- return;
45
-
46
- // Check for NextGEN capability
47
- if ( !current_user_can('NextGEN Use TinyMCE') )
48
- return;
49
-
50
- // Add only in Rich Editor mode
51
- if ( get_user_option('rich_editing') == 'true') {
52
-
53
- // add the button for wp2.5 in a new way
54
- add_filter("mce_external_plugins", array (&$this, 'add_tinymce_plugin' ), 5);
55
- add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
56
- }
57
- }
58
-
59
- /**
60
- * add_nextgen_button::register_button()
61
- * used to insert button in wordpress 2.5x editor
62
- *
63
- * @return $buttons
64
- */
65
- function register_button($buttons) {
66
-
67
- array_push($buttons, 'separator', $this->pluginname );
68
-
69
- return $buttons;
70
- }
71
-
72
- /**
73
- * add_nextgen_button::add_tinymce_plugin()
74
- * Load the TinyMCE plugin : editor_plugin.js
75
- *
76
- * @return $plugin_array
77
- */
78
- function add_tinymce_plugin($plugin_array) {
79
-
80
- $plugin_array[$this->pluginname] = $this->path . 'editor_plugin.js';
81
-
82
- return $plugin_array;
83
- }
84
-
85
- /**
86
- * add_nextgen_button::change_tinymce_version()
87
- * A different version will rebuild the cache
88
- *
89
- * @return $versio
90
- */
91
- function change_tinymce_version($version) {
92
- $version = $version + $this->internalVersion;
93
- return $version;
94
- }
95
-
96
- }
97
-
98
- // Call it now
99
- $tinymce_button = new add_nextgen_button ();
100
-
101
- ?>
 
1
+ <?php
2
+
3
+ /**
4
+ * add_nextgen_button
5
+ *
6
+ * @package NextGEN Gallery
7
+ * @title TinyMCE V3 Button Integration (for WP2.5 and higher)
8
+ * @author Alex Rabe
9
+ *
10
+ * @access public
11
+ */
12
+ class add_nextgen_button {
13
+
14
+ var $pluginname = 'NextGEN';
15
+ var $path = '';
16
+ var $internalVersion = 200;
17
+
18
+ /**
19
+ * add_nextgen_button::add_nextgen_button()
20
+ * the constructor
21
+ *
22
+ * @return void
23
+ */
24
+ function add_nextgen_button() {
25
+
26
+ // Set path to editor_plugin.js
27
+ $this->path = NGGALLERY_URLPATH . 'admin/tinymce/';
28
+
29
+ // Modify the version when tinyMCE plugins are changed.
30
+ add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') );
31
+
32
+ // init process for button control
33
+ add_action('init', array (&$this, 'addbuttons') );
34
+ }
35
+
36
+ /**
37
+ * add_nextgen_button::addbuttons()
38
+ *
39
+ * @return void
40
+ */
41
+ function addbuttons() {
42
+
43
+ // Don't bother doing this stuff if the current user lacks permissions
44
+ if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
45
+ return;
46
+
47
+ // Check for NextGEN capability
48
+ if ( !current_user_can('NextGEN Use TinyMCE') )
49
+ return;
50
+
51
+ // Add only in Rich Editor mode
52
+ if ( get_user_option('rich_editing') == 'true') {
53
+
54
+ // add the button for wp2.5 in a new way
55
+ add_filter("mce_external_plugins", array (&$this, 'add_tinymce_plugin' ), 5);
56
+ add_filter('mce_buttons', array (&$this, 'register_button' ), 5);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * add_nextgen_button::register_button()
62
+ * used to insert button in wordpress 2.5x editor
63
+ *
64
+ * @return $buttons
65
+ */
66
+ function register_button($buttons) {
67
+
68
+ array_push($buttons, 'separator', $this->pluginname );
69
+
70
+ return $buttons;
71
+ }
72
+
73
+ /**
74
+ * add_nextgen_button::add_tinymce_plugin()
75
+ * Load the TinyMCE plugin : editor_plugin.js
76
+ *
77
+ * @return $plugin_array
78
+ */
79
+ function add_tinymce_plugin($plugin_array) {
80
+
81
+ $plugin_array[$this->pluginname] = $this->path . 'editor_plugin.js';
82
+
83
+ return $plugin_array;
84
+ }
85
+
86
+ /**
87
+ * add_nextgen_button::change_tinymce_version()
88
+ * A different version will rebuild the cache
89
+ *
90
+ * @return $versio
91
+ */
92
+ function change_tinymce_version($version) {
93
+ $version = $version + $this->internalVersion;
94
+ return $version;
95
+ }
96
+
97
+ }
98
+
99
+ // Call it now
100
+ $tinymce_button = new add_nextgen_button ();
101
+
102
+ ?>
admin/tinymce/window.php CHANGED
@@ -1,146 +1,146 @@
1
- <?php
2
-
3
- if ( !defined('ABSPATH') )
4
- die('You are not allowed to call this page directly.');
5
-
6
- global $wpdb, $nggdb;
7
-
8
- @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
9
- ?>
10
- <html xmlns="http://www.w3.org/1999/xhtml">
11
- <head>
12
- <title>NextGEN Gallery</title>
13
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
14
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
15
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
16
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
17
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/jquery.js"></script>
18
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.core.min.js"></script>
19
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.widget.min.js"></script>
20
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.position.min.js"></script>
21
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js"></script>
22
- <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/ngg.autocomplete.js"></script>
23
- <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/tinymce/tinymce.js"></script>
24
- <link rel="stylesheet" type="text/css" href="<?php echo NGGALLERY_URLPATH ?>admin/css/jquery.ui.css" media="all" />
25
- <base target="_self" />
26
- </head>
27
- <script type="text/javascript">
28
- jQuery(document).ready(function(){
29
- jQuery("#gallerytag").nggAutocomplete( {
30
- type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
31
- });
32
- jQuery("#albumtag").nggAutocomplete( {
33
- type: 'album',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
34
- });
35
- jQuery("#singlepictag").nggAutocomplete( {
36
- type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
37
- });
38
- });
39
- </script>
40
- <body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
41
- <!-- <form onsubmit="insertLink();return false;" action="#"> -->
42
- <form name="NextGEN" action="#">
43
- <div class="tabs">
44
- <ul>
45
- <li id="gallery_tab" class="current"><span><a href="javascript:mcTabs.displayTab('gallery_tab','gallery_panel');" onmousedown="return false;"><?php echo _n( 'Gallery', 'Galleries', 1, 'nggallery' ) ?></a></span></li>
46
- <li id="album_tab"><span><a href="javascript:mcTabs.displayTab('album_tab','album_panel');" onmousedown="return false;"><?php echo _n( 'Album', 'Albums', 1, 'nggallery' ) ?></a></span></li>
47
- <li id="singlepic_tab"><span><a href="javascript:mcTabs.displayTab('singlepic_tab','singlepic_panel');" onmousedown="return false;"><?php _e('Picture', 'nggallery'); ?></a></span></li>
48
- </ul>
49
- </div>
50
-
51
- <div class="panel_wrapper">
52
- <!-- gallery panel -->
53
- <div id="gallery_panel" class="panel current">
54
- <br />
55
- <table border="0" cellpadding="4" cellspacing="0">
56
- <tr>
57
- <td nowrap="nowrap"><label for="gallerytag"><?php _e("Gallery", 'nggallery'); ?></label></td>
58
- <td><select id="gallerytag" name="gallerytag" style="width: 200px">
59
- <option value="0" selected="selected"><?php _e("Select or enter gallery", 'nggallery'); ?></option>
60
- </select>
61
- </td>
62
- </tr>
63
- <tr>
64
- <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
65
- <td><label><input name="showtype" type="radio" value="nggallery" checked="checked" /> <?php _e('Image list', 'nggallery') ;?></label><br />
66
- <label><input name="showtype" type="radio" value="slideshow" /> <?php _e('Slideshow', 'nggallery') ;?></label><br />
67
- <label><input name="showtype" type="radio" value="imagebrowser" /> <?php _e('Imagebrowser', 'nggallery') ;?></label></td>
68
- </tr>
69
- </table>
70
- </div>
71
- <!-- gallery panel -->
72
-
73
- <!-- album panel -->
74
- <div id="album_panel" class="panel">
75
- <br />
76
- <table border="0" cellpadding="4" cellspacing="0">
77
- <tr>
78
- <td nowrap="nowrap"><label for="albumtag"><?php _e("Album", 'nggallery'); ?></label></td>
79
- <td><select id="albumtag" name="albumtag" style="width: 200px">
80
- <option value="0" selected="selected"><?php _e("Select or enter album", 'nggallery'); ?></option>
81
- </select>
82
- </td>
83
- </tr>
84
- <tr>
85
- <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
86
- <td><label><input name="albumtype" type="radio" value="extend" checked="checked" /> <?php _e('Extended version', 'nggallery') ;?></label><br />
87
- <label><input name="albumtype" type="radio" value="compact" /> <?php _e('Compact version', 'nggallery') ;?></label></td>
88
- </tr>
89
- </table>
90
- </div>
91
- <!-- album panel -->
92
-
93
- <!-- single pic panel -->
94
- <div id="singlepic_panel" class="panel">
95
- <br />
96
- <table border="0" cellpadding="4" cellspacing="0">
97
- <tr>
98
- <td nowrap="nowrap"><label for="singlepictag"><?php _e("Picture", 'nggallery'); ?></label></td>
99
- <td><select id="singlepictag" name="singlepictag" style="width: 200px">
100
- <option value="0" selected="selected"><?php _e("Select or enter picture", 'nggallery'); ?></option>
101
- </select>
102
- </td>
103
- </tr>
104
- <tr>
105
- <td nowrap="nowrap"><?php _e("Width x Height", 'nggallery'); ?></td>
106
- <td><input type="text" size="5" id="imgWidth" name="imgWidth" value="320" /> x <input type="text" size="5" id="imgHeight" name="imgHeight" value="240" /></td>
107
- </tr>
108
- <tr>
109
- <td nowrap="nowrap" valign="top"><?php _e("Effect", 'nggallery'); ?></td>
110
- <td>
111
- <label><select id="imgeffect" name="imgeffect">
112
- <option value="none"><?php _e("No effect", 'nggallery'); ?></option>
113
- <option value="watermark"><?php _e("Watermark", 'nggallery'); ?></option>
114
- <option value="web20"><?php _e("Web 2.0", 'nggallery'); ?></option>
115
- </select></label>
116
- </td>
117
- </tr>
118
- <tr>
119
- <td nowrap="nowrap" valign="top"><?php _e("Float", 'nggallery'); ?></td>
120
- <td>
121
- <label><select id="imgfloat" name="imgfloat">
122
- <option value=""><?php _e("No float", 'nggallery'); ?></option>
123
- <option value="left"><?php _e("Left", 'nggallery'); ?></option>
124
- <option value="center"><?php _e("Center", 'nggallery'); ?></option>
125
- <option value="right"><?php _e("Right", 'nggallery'); ?></option>
126
- </select></label>
127
- </td>
128
- </tr>
129
-
130
- </table>
131
- </div>
132
- <!-- single pic panel -->
133
- </div>
134
-
135
- <div class="mceActionPanel">
136
- <div style="float: left">
137
- <input type="button" id="cancel" name="cancel" value="<?php _e("Cancel", 'nggallery'); ?>" onclick="tinyMCEPopup.close();" />
138
- </div>
139
-
140
- <div style="float: right">
141
- <input type="submit" id="insert" name="insert" value="<?php _e("Insert", 'nggallery'); ?>" onclick="insertNGGLink();" />
142
- </div>
143
- </div>
144
- </form>
145
- </body>
146
  </html>
1
+ <?php
2
+
3
+ if ( !defined('ABSPATH') )
4
+ die('You are not allowed to call this page directly.');
5
+
6
+ global $wpdb, $nggdb;
7
+
8
+ @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
9
+ ?>
10
+ <html xmlns="http://www.w3.org/1999/xhtml">
11
+ <head>
12
+ <title>NextGEN Gallery</title>
13
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
14
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
15
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
16
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
17
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/jquery.js"></script>
18
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.core.min.js"></script>
19
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.widget.min.js"></script>
20
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.position.min.js"></script>
21
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js"></script>
22
+ <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/ngg.autocomplete.js"></script>
23
+ <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/tinymce/tinymce.js"></script>
24
+ <link rel="stylesheet" type="text/css" href="<?php echo NGGALLERY_URLPATH ?>admin/css/jquery.ui.css" media="all" />
25
+ <base target="_self" />
26
+ </head>
27
+ <script type="text/javascript">
28
+ jQuery(document).ready(function(){
29
+ jQuery("#gallerytag").nggAutocomplete( {
30
+ type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
31
+ });
32
+ jQuery("#albumtag").nggAutocomplete( {
33
+ type: 'album',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
34
+ });
35
+ jQuery("#singlepictag").nggAutocomplete( {
36
+ type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
37
+ });
38
+ });
39
+ </script>
40
+ <body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
41
+ <!-- <form onsubmit="insertLink();return false;" action="#"> -->
42
+ <form name="NextGEN" action="#">
43
+ <div class="tabs">
44
+ <ul>
45
+ <li id="gallery_tab" class="current"><span><a href="javascript:mcTabs.displayTab('gallery_tab','gallery_panel');" onmousedown="return false;"><?php echo _n( 'Gallery', 'Galleries', 1, 'nggallery' ) ?></a></span></li>
46
+ <li id="album_tab"><span><a href="javascript:mcTabs.displayTab('album_tab','album_panel');" onmousedown="return false;"><?php echo _n( 'Album', 'Albums', 1, 'nggallery' ) ?></a></span></li>
47
+ <li id="singlepic_tab"><span><a href="javascript:mcTabs.displayTab('singlepic_tab','singlepic_panel');" onmousedown="return false;"><?php _e('Picture', 'nggallery'); ?></a></span></li>
48
+ </ul>
49
+ </div>
50
+
51
+ <div class="panel_wrapper">
52
+ <!-- gallery panel -->
53
+ <div id="gallery_panel" class="panel current">
54
+ <br />
55
+ <table border="0" cellpadding="4" cellspacing="0">
56
+ <tr>
57
+ <td nowrap="nowrap"><label for="gallerytag"><?php _e("Gallery", 'nggallery'); ?></label></td>
58
+ <td><select id="gallerytag" name="gallerytag" style="width: 200px">
59
+ <option value="0" selected="selected"><?php _e("Select or enter gallery", 'nggallery'); ?></option>
60
+ </select>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
65
+ <td><label><input name="showtype" type="radio" value="nggallery" checked="checked" /> <?php _e('Image list', 'nggallery') ;?></label><br />
66
+ <label><input name="showtype" type="radio" value="slideshow" /> <?php _e('Slideshow', 'nggallery') ;?></label><br />
67
+ <label><input name="showtype" type="radio" value="imagebrowser" /> <?php _e('Imagebrowser', 'nggallery') ;?></label></td>
68
+ </tr>
69
+ </table>
70
+ </div>
71
+ <!-- gallery panel -->
72
+
73
+ <!-- album panel -->
74
+ <div id="album_panel" class="panel">
75
+ <br />
76
+ <table border="0" cellpadding="4" cellspacing="0">
77
+ <tr>
78
+ <td nowrap="nowrap"><label for="albumtag"><?php _e("Album", 'nggallery'); ?></label></td>
79
+ <td><select id="albumtag" name="albumtag" style="width: 200px">
80
+ <option value="0" selected="selected"><?php _e("Select or enter album", 'nggallery'); ?></option>
81
+ </select>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
86
+ <td><label><input name="albumtype" type="radio" value="extend" checked="checked" /> <?php _e('Extended version', 'nggallery') ;?></label><br />
87
+ <label><input name="albumtype" type="radio" value="compact" /> <?php _e('Compact version', 'nggallery') ;?></label></td>
88
+ </tr>
89
+ </table>
90
+ </div>
91
+ <!-- album panel -->
92
+
93
+ <!-- single pic panel -->
94
+ <div id="singlepic_panel" class="panel">
95
+ <br />
96
+ <table border="0" cellpadding="4" cellspacing="0">
97
+ <tr>
98
+ <td nowrap="nowrap"><label for="singlepictag"><?php _e("Picture", 'nggallery'); ?></label></td>
99
+ <td><select id="singlepictag" name="singlepictag" style="width: 200px">
100
+ <option value="0" selected="selected"><?php _e("Select or enter picture", 'nggallery'); ?></option>
101
+ </select>
102
+ </td>
103
+ </tr>
104
+ <tr>
105
+ <td nowrap="nowrap"><?php _e("Width x Height", 'nggallery'); ?></td>
106
+ <td><input type="text" size="5" id="imgWidth" name="imgWidth" value="320" /> x <input type="text" size="5" id="imgHeight" name="imgHeight" value="240" /></td>
107
+ </tr>
108
+ <tr>
109
+ <td nowrap="nowrap" valign="top"><?php _e("Effect", 'nggallery'); ?></td>
110
+ <td>
111
+ <label><select id="imgeffect" name="imgeffect">
112
+ <option value="none"><?php _e("No effect", 'nggallery'); ?></option>
113
+ <option value="watermark"><?php _e("Watermark", 'nggallery'); ?></option>
114
+ <option value="web20"><?php _e("Web 2.0", 'nggallery'); ?></option>
115
+ </select></label>
116
+ </td>
117
+ </tr>
118
+ <tr>
119
+ <td nowrap="nowrap" valign="top"><?php _e("Float", 'nggallery'); ?></td>
120
+ <td>
121
+ <label><select id="imgfloat" name="imgfloat">
122
+ <option value=""><?php _e("No float", 'nggallery'); ?></option>
123
+ <option value="left"><?php _e("Left", 'nggallery'); ?></option>
124
+ <option value="center"><?php _e("Center", 'nggallery'); ?></option>
125
+ <option value="right"><?php _e("Right", 'nggallery'); ?></option>
126
+ </select></label>
127
+ </td>
128
+ </tr>
129
+
130
+ </table>
131
+ </div>
132
+ <!-- single pic panel -->
133
+ </div>
134
+
135
+ <div class="mceActionPanel">
136
+ <div style="float: left">
137
+ <input type="button" id="cancel" name="cancel" value="<?php _e("Cancel", 'nggallery'); ?>" onclick="tinyMCEPopup.close();" />
138
+ </div>
139
+
140
+ <div style="float: right">
141
+ <input type="submit" id="insert" name="insert" value="<?php _e("Insert", 'nggallery'); ?>" onclick="insertNGGLink();" />
142
+ </div>
143
+ </div>
144
+ </form>
145
+ </body>
146
  </html>
admin/upgrade.php CHANGED
@@ -1,480 +1,480 @@
1
- <?php
2
- /**
3
- * ngg_upgrade() - update routine for older version
4
- *
5
- * @return Success message
6
- */
7
- function ngg_upgrade() {
8
-
9
- global $wpdb, $user_ID, $nggRewrite;
10
-
11
- // get the current user ID
12
- get_currentuserinfo();
13
-
14
- // in multisite environment the pointer $wpdb->nggpictures need to be set again
15
- $wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
16
- $wpdb->nggallery = $wpdb->prefix . 'ngg_gallery';
17
- $wpdb->nggalbum = $wpdb->prefix . 'ngg_album';
18
-
19
- // Be sure that the tables exist, avoid case sensitive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
20
- if( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->nggpictures'" ) ) {
21
-
22
- echo __('Upgrade database structure...', 'nggallery');
23
- $wpdb->show_errors();
24
-
25
- $installed_ver = get_option( 'ngg_db_version' );
26
-
27
- // 0.9.7 is smaller that 0.97, my fault :-)
28
- if ( $installed_ver == '0.9.7' ) $installed_ver = '0.97';
29
-
30
- // v0.33 -> v.071
31
- if (version_compare($installed_ver, '0.71', '<')) {
32
- $wpdb->query("ALTER TABLE $wpdb->nggpictures CHANGE pid pid BIGINT(20) NOT NULL AUTO_INCREMENT ");
33
- $wpdb->query("ALTER TABLE $wpdb->nggpictures CHANGE galleryid galleryid BIGINT(20) NOT NULL ");
34
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE gid gid BIGINT(20) NOT NULL AUTO_INCREMENT ");
35
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE pageid pageid BIGINT(20) NULL DEFAULT '0'");
36
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE previewpic previewpic BIGINT(20) NULL DEFAULT '0'");
37
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE gid gid BIGINT(20) NOT NULL AUTO_INCREMENT ");
38
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE description galdesc MEDIUMTEXT NULL");
39
- }
40
-
41
- // v0.71 -> v0.84
42
- if (version_compare($installed_ver, '0.84', '<')) {
43
- ngg_maybe_add_column( $wpdb->nggpictures, 'sortorder', "BIGINT(20) DEFAULT '0' NOT NULL AFTER exclude");
44
- }
45
-
46
- // v0.84 -> v0.95
47
- if (version_compare($installed_ver, '0.95', '<')) {
48
- // first add the author field and set it to the current administrator
49
- ngg_maybe_add_column( $wpdb->nggallery, 'author', "BIGINT(20) NOT NULL DEFAULT '$user_ID' AFTER previewpic");
50
- // switch back to zero
51
- $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE author author BIGINT(20) NOT NULL DEFAULT '0'");
52
- }
53
-
54
- // v0.95 -> v0.97
55
- if (version_compare($installed_ver, '0.96', '<')) {
56
- // Convert into WordPress Core taxonomy scheme
57
- ngg_convert_tags();
58
- // Drop tables, we don't need them anymore
59
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "ngg_tags");
60
- $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "ngg_pic2tags");
61
-
62
- // New capability for administrator role
63
- $role = get_role('administrator');
64
- $role->add_cap('NextGEN Manage tags');
65
-
66
- // Add new option
67
- $ngg_options = get_option('ngg_options');
68
- $ngg_options['graphicLibrary'] = 'gd';
69
- update_option('ngg_options', $ngg_options);
70
-
71
- }
72
-
73
- // v0.97 -> v1.00
74
- if (version_compare($installed_ver, '0.97', '<')) {
75
- ngg_maybe_add_column( $wpdb->nggpictures, 'imagedate', "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER alttext");
76
- }
77
-
78
- // v0.97 -> v1.3.0
79
- if (version_compare($installed_ver, '1.3.0', '<')) {
80
- ngg_maybe_add_column( $wpdb->nggpictures, 'post_id', "BIGINT(20) DEFAULT '0' NOT NULL AFTER pid");
81
- ngg_maybe_add_column( $wpdb->nggpictures, 'meta_data', "LONGTEXT AFTER sortorder");
82
- $wpdb->query("ALTER TABLE " . $wpdb->nggpictures . " ADD INDEX post_id ( post_id )");
83
- }
84
-
85
- // v1.3.0 -> v1.3.1
86
- if (version_compare($installed_ver, '1.3.1', '<')) {
87
- // add description and previewpic for the album itself
88
- ngg_maybe_add_column( $wpdb->nggalbum, 'previewpic', "BIGINT(20) DEFAULT '0' NOT NULL AFTER name");
89
- ngg_maybe_add_column( $wpdb->nggalbum, 'albumdesc', "MEDIUMTEXT NULL AFTER previewpic");
90
- }
91
-
92
- // v1.3.5 -> v1.4.0
93
- if (version_compare($installed_ver, '1.4.0', '<')) {
94
- // add link from album to a page
95
- ngg_maybe_add_column( $wpdb->nggalbum, 'pageid', "BIGINT(20) DEFAULT '0' NOT NULL AFTER sortorder");
96
- }
97
-
98
- // v1.4.0 -> v1.7.0
99
- if (version_compare($installed_ver, '1.7.0', '<')) {
100
- // add slug fields
101
- ngg_maybe_add_column( $wpdb->nggpictures, 'image_slug', "VARCHAR(255) NOT NULL AFTER pid");
102
- ngg_maybe_add_column( $wpdb->nggalbum, 'slug', "VARCHAR(255) NOT NULL AFTER name");
103
- ngg_maybe_add_column( $wpdb->nggallery, 'slug', "VARCHAR(255) NOT NULL AFTER name");
104
- }
105
-
106
- // update now the database
107
- update_option( "ngg_db_version", NGG_DBVERSION );
108
- echo __('finished', 'nggallery') . "<br />\n";
109
-
110
- $wpdb->hide_errors();
111
-
112
- // *** From here we start file operation which could failed sometimes,
113
- // *** ensure that the DB changes are not performed two times...
114
-
115
- // Change all thumbnail folders to "thumbs"
116
- if (version_compare($installed_ver, '0.96', '<')) {
117
- echo __('Update file structure...', 'nggallery');
118
- ngg_convert_filestructure();
119
- echo __('finished', 'nggallery') . "<br />\n";
120
- }
121
-
122
- // On some reason the import / date sometimes failed, due to the memory limit
123
- if (version_compare($installed_ver, '0.97', '<')) {
124
- echo __('Import date and time information...', 'nggallery');
125
- ngg_import_date_time();
126
- echo __('finished', 'nggallery') . "<br />\n";
127
- }
128
-
129
- // Move imagerotator outside the plugin folder
130
- if (version_compare($installed_ver, '1.1.0', '<')) {
131
- $ngg_options = get_option('ngg_options');
132
- echo __('Move imagerotator to new location...', 'nggallery');
133
- $ngg_options['irURL'] = ngg_move_imagerotator();
134
- $ngg_options['galPagedGalleries'] = 0;
135
- $ngg_options['galColumns'] = 0;
136
- update_option('ngg_options', $ngg_options);
137
- echo __('finished', 'nggallery') . "<br />\n";
138
- }
139
-
140
- // Remove thumbcrop setting, thumbfix and quare size do the same
141
- if (version_compare($installed_ver, '1.4.0', '<')) {
142
- $ngg_options = get_option('ngg_options');
143
- echo __('Update settings...', 'nggallery');
144
- if ( $ngg_options['thumpcrop'] ) {
145
- $ngg_options['thumbfix'] = true;
146
- $ngg_options['thumbheight'] = $ngg_options['thumbwidth'] ;
147
- $ngg_options['galAjaxNav'] = true;
148
- }
149
- $ngg_options['galHiddenImg'] = false;
150
- update_option('ngg_options', $ngg_options);
151
- echo __('finished', 'nggallery') . "<br />\n";
152
- }
153
-
154
- // Remove the old widget options
155
- if (version_compare($installed_ver, '1.4.4', '<')) {
156
- delete_option( 'ngg_widget' );
157
- echo __('Updated widget structure. If you used NextGEN Widgets, you need to setup them again...', 'nggallery');
158
- }
159
-
160
- if (version_compare($installed_ver, '1.6.0', '<')) {
161
- $ngg_options = get_option('ngg_options');
162
- $ngg_options['enableIR'] = '1';
163
- $ngg_options['slideFx'] = 'fade';
164
- update_option('ngg_options', $ngg_options);
165
- echo __('Updated options.', 'nggallery');
166
- }
167
-
168
- if (version_compare($installed_ver, '1.7.0', '<')) {
169
- // Network blogs need to call this manually
170
- if ( !is_multisite() ) {
171
- ?>
172
- <h2><?php _e('Create unique slug', 'nggallery') ;?></h2>
173
- <p><?php _e('One of the upcomming features are a reworked permalinks structure.', 'nggallery') ;?>
174
- <?php _e('Therefore it\'s needed to have a unique identifier for each image, gallery and album.', 'nggallery'); ?><br />
175
- <?php _e('Depend on the amount of database entries this will take a while, don\'t reload this page.', 'nggallery') ;?></p>
176
- <?php
177
- ngg_rebuild_unique_slugs::start_rebuild();
178
- }
179
-
180
- }
181
-
182
- if (version_compare($installed_ver, '1.8.0', '<')) {
183
- $ngg_options = get_option('ngg_options');
184
- // new permalink structure
185
- $ngg_options['permalinkSlug'] = 'nggallery';
186
- update_option('ngg_options', $ngg_options);
187
- echo __('Updated options.', 'nggallery');
188
- }
189
-
190
- // better to flush rewrite rules after upgrades
191
- $nggRewrite->flush();
192
- return;
193
- }
194
-
195
- echo __('Could not find NextGEN Gallery database tables, upgrade failed !', 'nggallery');
196
-
197
- return;
198
- }
199
-
200
- /**
201
- * ngg_convert_tags() - Import the tags into the wp tables (only required for pre V1.00 versions)
202
- *
203
- * @return Success Message
204
- */
205
- function ngg_convert_tags() {
206
- global $wpdb, $wp_taxonomies;
207
-
208
- // get the obsolete tables
209
- $wpdb->nggtags = $wpdb->prefix . 'ngg_tags';
210
- $wpdb->nggpic2tags = $wpdb->prefix . 'ngg_pic2tags';
211
-
212
- $picturelist = $wpdb->get_col("SELECT pid FROM $wpdb->nggpictures");
213
- if ( is_array($picturelist) ) {
214
- foreach($picturelist as $id) {
215
- $tags = array();
216
- $tagarray = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggpic2tags AS t INNER JOIN $wpdb->nggtags AS tt ON t.tagid = tt.id WHERE t.picid = '$id' ORDER BY tt.slug ASC ");
217
- if (!empty($tagarray)){
218
- foreach($tagarray as $element) {
219
- $tags[$element->id] = $element->name;
220
- }
221
- wp_set_object_terms($id, $tags, 'ngg_tag');
222
- }
223
- }
224
- }
225
- }
226
-
227
- /**
228
- * ngg_convert_filestructure() - converter for old thumnail folder structure
229
- *
230
- * @return void
231
- */
232
- function ngg_convert_filestructure() {
233
- global $wpdb;
234
-
235
- $gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC", OBJECT_K);
236
- if ( is_array($gallerylist) ) {
237
- $errors = array();
238
- foreach($gallerylist as $gallery) {
239
- $gallerypath = WINABSPATH.$gallery->path;
240
-
241
- // old mygallery check, convert the wrong folder/ file name now
242
- if (@is_dir($gallerypath . '/tumbs')) {
243
- if ( !@rename($gallerypath . '/tumbs' , $gallerypath .'/thumbs') )
244
- $errors[] = $gallery->path . '/thumbs';
245
- // read list of images
246
- $imageslist = nggAdmin::scandir($gallerypath . '/thumbs');
247
- if ( !empty($imageslist)) {
248
- foreach($imageslist as $image) {
249
- $purename = substr($image, 4);
250
- if ( !@rename($gallerypath . '/thumbs/' . $image, $gallerypath . '/thumbs/thumbs_' . $purename ))
251
- $errors[] = $gallery->path . '/thumbs/thumbs_' . $purename ;
252
- }
253
- }
254
- }
255
- }
256
-
257
- if (!empty($errors)) {
258
- echo "<div class='error_inline'><p>". __('Some folders/files could not renamed, please recheck the permission and rescan the folder in the manage gallery section.', 'nggallery') ."</p>";
259
- foreach($errors as $value) {
260
- echo __('Rename failed', 'nggallery') . ' : <strong>' . $value . "</strong><br />\n";
261
- }
262
- echo '</div>';
263
- }
264
- }
265
- }
266
-
267
- /**
268
- * Move the imagerotator outside the plugin folder, as we remove it from the REPO with the next update
269
- *
270
- * @return string $path URL to the imagerotator
271
- */
272
- function ngg_move_imagerotator() {
273
-
274
- $upload = wp_upload_dir();
275
-
276
- // look first at the old place and move it
277
- if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
278
- @rename(NGGALLERY_ABSPATH . 'imagerotator.swf', $upload['basedir'] . '/imagerotator.swf');
279
-
280
- // If it's successful then we return the new path
281
- if ( file_exists( $upload['basedir'] . '/imagerotator.swf' ) )
282
- return $upload['baseurl'] . '/imagerotator.swf';
283
-
284
- //In some worse case it's still at the old place
285
- if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
286
- return NGGALLERY_URLPATH . 'imagerotator.swf';
287
-
288
- // if something failed, we must return a empty string
289
- return '';
290
- }
291
-
292
- /**
293
- * ngg_import_date_time() - Read the timestamp from exif and insert it into the database
294
- *
295
- * @return void
296
- */
297
- function ngg_import_date_time() {
298
- global $wpdb;
299
-
300
- $imagelist = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid ORDER BY tt.pid ASC");
301
- if ( is_array($imagelist) ) {
302
- foreach ($imagelist as $image) {
303
- $picture = new nggImage($image);
304
- $meta = new nggMeta($picture->pid, true);
305
- $date = $meta->get_date_time();
306
- $wpdb->query("UPDATE $wpdb->nggpictures SET imagedate = '$date' WHERE pid = '$picture->pid'");
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * Adding a new column if needed
313
- * Example : ngg_maybe_add_column( $wpdb->nggpictures, 'imagedate', "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER alttext");
314
- *
315
- * @param string $table_name Database table name.
316
- * @param string $column_name Database column name to create.
317
- * @param string $create_ddl SQL statement to create column
318
- * @return bool True, when done with execution.
319
- */
320
- function ngg_maybe_add_column($table_name, $column_name, $create_ddl) {
321
- global $wpdb;
322
-
323
- foreach ($wpdb->get_col("SHOW COLUMNS FROM $table_name") as $column ) {
324
- if ($column == $column_name)
325
- return true;
326
- }
327
-
328
- //didn't find it try to create it.
329
- $wpdb->query("ALTER TABLE $table_name ADD $column_name " . $create_ddl);
330
-
331
- // we cannot directly tell that whether this succeeded!
332
- foreach ($wpdb->get_col("SHOW COLUMNS FROM $table_name") as $column ) {
333
- if ($column == $column_name)
334
- return true;
335
- }
336
-
337
- echo("Could not add column $column_name in table $table_name<br />\n");
338
- return false;
339
- }
340
-
341
- /**
342
- * nggallery_upgrade_page() - This page showsup , when the database version doesn't fir to the script NGG_DBVERSION constant.
343
- *
344
- * @return Upgrade Message
345
- */
346
- function nggallery_upgrade_page() {
347
-
348
- $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
349
-
350
- if ( isset($_GET['upgrade']) && $_GET['upgrade'] == 'now') {
351
- nggallery_start_upgrade($filepath);
352
- return;
353
- }
354
- ?>
355
- <div class="wrap">
356
- <h2><?php _e('Upgrade NextGEN Gallery', 'nggallery') ;?></h2>
357
- <p><?php _e('The script detect that you upgrade from a older version.', 'nggallery') ;?>
358
- <?php _e('Your database tables for NextGEN Gallery is out-of-date, and must be upgraded before you can continue.', 'nggallery'); ?>
359
- <?php _e('If you would like to downgrade later, please make first a complete backup of your database and the images.', 'nggallery') ;?></p>
360
- <p><?php _e('The upgrade process may take a while, so please be patient.', 'nggallery'); ?></p>
361
- <h3><a href="<?php echo $filepath;?>&amp;upgrade=now"><?php _e('Start upgrade now', 'nggallery'); ?>...</a></h3>
362
- </div>
363
- <?php
364
- }
365
-
366
- /**
367
- * nggallery_start_upgrade() - Proceed the upgrade routine
368
- *
369
- * @param mixed $filepath
370
- * @return void
371
- */
372
- function nggallery_start_upgrade($filepath) {
373
- ?>
374
- <div class="wrap">
375
- <h2><?php _e('Upgrade NextGEN Gallery', 'nggallery') ;?></h2>
376
- <p><?php ngg_upgrade();?></p>
377
- <p class="finished"><?php _e('Upgrade finished...', 'nggallery') ;?></p>
378
- <h3><a class="finished" href="<?php echo $filepath;?>"><?php _e('Continue', 'nggallery'); ?>...</a></h3>
379
- </div>
380
- <?php
381
- }
382
-
383
- /**
384
- * Rebuild slugs for albums, galleries and images via AJAX request
385
- *
386
- * @sine 1.7.0
387
- * @access internal
388
- */
389
- class ngg_rebuild_unique_slugs {
390
-
391
- function start_rebuild() {
392
- global $wpdb;
393
-
394
- $total = array();
395
- // get the total number of images
396
- $total['images'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") );
397
- $total['gallery'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") );
398
- $total['album'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
399
-
400
- $messages = array(
401
- 'images' => __( 'Rebuild image structure : %s / %s images', 'nggallery' ),
402
- 'gallery' => __( 'Rebuild gallery structure : %s / %s galleries', 'nggallery' ),
403
- 'album' => __( 'Rebuild album structure : %s / %s albums', 'nggallery' ),
404
- );
405
-
406
- ?>
407
- <?php
408
-
409
- foreach ( array_keys( $messages ) as $key ) {
410
-
411
- $message = sprintf( $messages[ $key ] ,
412
- "<span class='ngg-count-current'>0</span>",
413
- "<span class='ngg-count-total'>" . $total[ $key ] . "</span>"
414
- );
415
-
416
- echo "<div class='$key updated'><p class='ngg'>$message</p></div>";
417
- }
418
-
419
- $ajax_url = add_query_arg( 'action', 'ngg_rebuild_unique_slugs', admin_url( 'admin-ajax.php' ) );
420
- ?>
421
- <script type="text/javascript">
422
- jQuery(document).ready(function($) {
423
- var ajax_url = '<?php echo $ajax_url; ?>',
424
- _action = 'images',
425
- images = <?php echo $total['images']; ?>,
426
- gallery = <?php echo $total['gallery']; ?>,
427
- album = <?php echo $total['album']; ?>,
428
- total = 0,
429
- offset = 0,
430
- count = 50;
431
-
432
- var $display = $('.ngg-count-current');
433
- $('.finished, .gallery, .album').hide();
434
- total = images;
435
-
436
- function call_again() {
437
- if ( offset > total ) {
438
- offset = 0;
439
- // 1st run finished
440
- if (_action == 'images') {
441
- _action = 'gallery';
442
- total = gallery;
443
- $('.images, .gallery').toggle();
444
- $display.html(offset);
445
- call_again();
446
- return;
447
- }
448
- // 2nd run finished
449
- if (_action == 'gallery') {
450
- _action = 'album';
451
- total = album;
452
- $('.gallery, .album').toggle();
453
- $display.html(offset);
454
- call_again();
455
- return;
456
- }
457
- // 3rd run finished, exit now
458
- if (_action == 'album') {
459
- $('.ngg')
460
- .html('<?php _e( 'Done.', 'nggallery' ); ?>')
461
- .parent('div').hide();
462
- $('.finished').show();
463
- return;
464
- }
465
- }
466
-
467
- $.post(ajax_url, {'_action': _action, 'offset': offset}, function(response) {
468
- $display.html(offset);
469
-
470
- offset += count;
471
- call_again();
472
- });
473
- }
474
-
475
- call_again();
476
- });
477
- </script>
478
- <?php
479
- }
480
  }
1
+ <?php
2
+ /**
3
+ * ngg_upgrade() - update routine for older version
4
+ *
5
+ * @return Success message
6
+ */
7
+ function ngg_upgrade() {
8
+
9
+ global $wpdb, $user_ID, $nggRewrite;
10
+
11
+ // get the current user ID
12
+ get_currentuserinfo();
13
+
14
+ // in multisite environment the pointer $wpdb->nggpictures need to be set again
15
+ $wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
16
+ $wpdb->nggallery = $wpdb->prefix . 'ngg_gallery';
17
+ $wpdb->nggalbum = $wpdb->prefix . 'ngg_album';
18
+
19
+ // Be sure that the tables exist, avoid case sensitive : http://dev.mysql.com/doc/refman/5.1/en/identifier-case-sensitivity.html
20
+ if( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->nggpictures'" ) ) {
21
+
22
+ echo __('Upgrade database structure...', 'nggallery');
23
+ $wpdb->show_errors();
24
+
25
+ $installed_ver = get_option( 'ngg_db_version' );
26
+
27
+ // 0.9.7 is smaller that 0.97, my fault :-)
28
+ if ( $installed_ver == '0.9.7' ) $installed_ver = '0.97';
29
+
30
+ // v0.33 -> v.071
31
+ if (version_compare($installed_ver, '0.71', '<')) {
32
+ $wpdb->query("ALTER TABLE $wpdb->nggpictures CHANGE pid pid BIGINT(20) NOT NULL AUTO_INCREMENT ");
33
+ $wpdb->query("ALTER TABLE $wpdb->nggpictures CHANGE galleryid galleryid BIGINT(20) NOT NULL ");
34
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE gid gid BIGINT(20) NOT NULL AUTO_INCREMENT ");
35
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE pageid pageid BIGINT(20) NULL DEFAULT '0'");
36
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE previewpic previewpic BIGINT(20) NULL DEFAULT '0'");
37
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE gid gid BIGINT(20) NOT NULL AUTO_INCREMENT ");
38
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE description galdesc MEDIUMTEXT NULL");
39
+ }
40
+
41
+ // v0.71 -> v0.84
42
+ if (version_compare($installed_ver, '0.84', '<')) {
43
+ ngg_maybe_add_column( $wpdb->nggpictures, 'sortorder', "BIGINT(20) DEFAULT '0' NOT NULL AFTER exclude");
44
+ }
45
+
46
+ // v0.84 -> v0.95
47
+ if (version_compare($installed_ver, '0.95', '<')) {
48
+ // first add the author field and set it to the current administrator
49
+ ngg_maybe_add_column( $wpdb->nggallery, 'author', "BIGINT(20) NOT NULL DEFAULT '$user_ID' AFTER previewpic");
50
+ // switch back to zero
51
+ $wpdb->query("ALTER TABLE $wpdb->nggallery CHANGE author author BIGINT(20) NOT NULL DEFAULT '0'");
52
+ }
53
+
54
+ // v0.95 -> v0.97
55
+ if (version_compare($installed_ver, '0.96', '<')) {
56
+ // Convert into WordPress Core taxonomy scheme
57
+ ngg_convert_tags();
58
+ // Drop tables, we don't need them anymore
59
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "ngg_tags");
60
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "ngg_pic2tags");
61
+
62
+ // New capability for administrator role
63
+ $role = get_role('administrator');
64
+ $role->add_cap('NextGEN Manage tags');
65
+
66
+ // Add new option
67
+ $ngg_options = get_option('ngg_options');
68
+ $ngg_options['graphicLibrary'] = 'gd';
69
+ update_option('ngg_options', $ngg_options);
70
+
71
+ }
72
+
73
+ // v0.97 -> v1.00
74
+ if (version_compare($installed_ver, '0.97', '<')) {
75
+ ngg_maybe_add_column( $wpdb->nggpictures, 'imagedate', "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER alttext");
76
+ }
77
+
78
+ // v0.97 -> v1.3.0
79
+ if (version_compare($installed_ver, '1.3.0', '<')) {
80
+ ngg_maybe_add_column( $wpdb->nggpictures, 'post_id', "BIGINT(20) DEFAULT '0' NOT NULL AFTER pid");
81
+ ngg_maybe_add_column( $wpdb->nggpictures, 'meta_data', "LONGTEXT AFTER sortorder");
82
+ $wpdb->query("ALTER TABLE " . $wpdb->nggpictures . " ADD INDEX post_id ( post_id )");
83
+ }
84
+
85
+ // v1.3.0 -> v1.3.1
86
+ if (version_compare($installed_ver, '1.3.1', '<')) {
87
+ // add description and previewpic for the album itself
88
+ ngg_maybe_add_column( $wpdb->nggalbum, 'previewpic', "BIGINT(20) DEFAULT '0' NOT NULL AFTER name");
89
+ ngg_maybe_add_column( $wpdb->nggalbum, 'albumdesc', "MEDIUMTEXT NULL AFTER previewpic");
90
+ }
91
+
92
+ // v1.3.5 -> v1.4.0
93
+ if (version_compare($installed_ver, '1.4.0', '<')) {
94
+ // add link from album to a page
95
+ ngg_maybe_add_column( $wpdb->nggalbum, 'pageid', "BIGINT(20) DEFAULT '0' NOT NULL AFTER sortorder");
96
+ }
97
+
98
+ // v1.4.0 -> v1.7.0
99
+ if (version_compare($installed_ver, '1.7.0', '<')) {
100
+ // add slug fields
101
+ ngg_maybe_add_column( $wpdb->nggpictures, 'image_slug', "VARCHAR(255) NOT NULL AFTER pid");
102
+ ngg_maybe_add_column( $wpdb->nggalbum, 'slug', "VARCHAR(255) NOT NULL AFTER name");
103
+ ngg_maybe_add_column( $wpdb->nggallery, 'slug', "VARCHAR(255) NOT NULL AFTER name");
104
+ }
105
+
106
+ // update now the database
107
+ update_option( "ngg_db_version", NGG_DBVERSION );
108
+ echo __('finished', 'nggallery') . "<br />\n";
109
+
110
+ $wpdb->hide_errors();
111
+
112
+ // *** From here we start file operation which could failed sometimes,
113
+ // *** ensure that the DB changes are not performed two times...
114
+
115
+ // Change all thumbnail folders to "thumbs"
116
+ if (version_compare($installed_ver, '0.96', '<')) {
117
+ echo __('Update file structure...', 'nggallery');
118
+ ngg_convert_filestructure();
119
+ echo __('finished', 'nggallery') . "<br />\n";
120
+ }
121
+
122
+ // On some reason the import / date sometimes failed, due to the memory limit
123
+ if (version_compare($installed_ver, '0.97', '<')) {
124
+ echo __('Import date and time information...', 'nggallery');
125
+ ngg_import_date_time();
126
+ echo __('finished', 'nggallery') . "<br />\n";
127
+ }
128
+
129
+ // Move imagerotator outside the plugin folder
130
+ if (version_compare($installed_ver, '1.1.0', '<')) {
131
+ $ngg_options = get_option('ngg_options');
132
+ echo __('Move imagerotator to new location...', 'nggallery');
133
+ $ngg_options['irURL'] = ngg_move_imagerotator();
134
+ $ngg_options['galPagedGalleries'] = 0;
135
+ $ngg_options['galColumns'] = 0;
136
+ update_option('ngg_options', $ngg_options);
137
+ echo __('finished', 'nggallery') . "<br />\n";
138
+ }
139
+
140
+ // Remove thumbcrop setting, thumbfix and quare size do the same
141
+ if (version_compare($installed_ver, '1.4.0', '<')) {
142
+ $ngg_options = get_option('ngg_options');
143
+ echo __('Update settings...', 'nggallery');
144
+ if ( $ngg_options['thumpcrop'] ) {
145
+ $ngg_options['thumbfix'] = true;
146
+ $ngg_options['thumbheight'] = $ngg_options['thumbwidth'] ;
147
+ $ngg_options['galAjaxNav'] = true;
148
+ }
149
+ $ngg_options['galHiddenImg'] = false;
150
+ update_option('ngg_options', $ngg_options);
151
+ echo __('finished', 'nggallery') . "<br />\n";
152
+ }
153
+
154
+ // Remove the old widget options
155
+ if (version_compare($installed_ver, '1.4.4', '<')) {
156
+ delete_option( 'ngg_widget' );
157
+ echo __('Updated widget structure. If you used NextGEN Widgets, you need to setup them again...', 'nggallery');
158
+ }
159
+
160
+ if (version_compare($installed_ver, '1.6.0', '<')) {
161
+ $ngg_options = get_option('ngg_options');
162
+ $ngg_options['enableIR'] = '1';
163
+ $ngg_options['slideFx'] = 'fade';
164
+ update_option('ngg_options', $ngg_options);
165
+ echo __('Updated options.', 'nggallery');
166
+ }
167
+
168
+ if (version_compare($installed_ver, '1.7.0', '<')) {
169
+ // Network blogs need to call this manually
170
+ if ( !is_multisite() ) {
171
+ ?>
172
+ <h2><?php _e('Create unique slug', 'nggallery') ;?></h2>
173
+ <p><?php _e('One of the upcomming features are a reworked permalinks structure.', 'nggallery') ;?>
174
+ <?php _e('Therefore it\'s needed to have a unique identifier for each image, gallery and album.', 'nggallery'); ?><br />
175
+ <?php _e('Depend on the amount of database entries this will take a while, don\'t reload this page.', 'nggallery') ;?></p>
176
+ <?php
177
+ ngg_rebuild_unique_slugs::start_rebuild();
178
+ }
179
+
180
+ }
181
+
182
+ if (version_compare($installed_ver, '1.8.0', '<')) {
183
+ $ngg_options = get_option('ngg_options');
184
+ // new permalink structure
185
+ $ngg_options['permalinkSlug'] = 'nggallery';
186
+ update_option('ngg_options', $ngg_options);
187
+ echo __('Updated options.', 'nggallery');
188
+ }
189
+
190
+ // better to flush rewrite rules after upgrades
191
+ $nggRewrite->flush();
192
+ return;
193
+ }
194
+
195
+ echo __('Could not find NextGEN Gallery database tables, upgrade failed !', 'nggallery');
196
+
197
+ return;
198
+ }
199
+
200
+ /**
201
+ * ngg_convert_tags() - Import the tags into the wp tables (only required for pre V1.00 versions)
202
+ *
203
+ * @return Success Message
204
+ */
205
+ function ngg_convert_tags() {
206
+ global $wpdb, $wp_taxonomies;
207
+
208
+ // get the obsolete tables
209
+ $wpdb->nggtags = $wpdb->prefix . 'ngg_tags';
210
+ $wpdb->nggpic2tags = $wpdb->prefix . 'ngg_pic2tags';
211
+
212
+ $picturelist = $wpdb->get_col("SELECT pid FROM $wpdb->nggpictures");
213
+ if ( is_array($picturelist) ) {
214
+ foreach($picturelist as $id) {
215
+ $tags = array();
216
+ $tagarray = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggpic2tags AS t INNER JOIN $wpdb->nggtags AS tt ON t.tagid = tt.id WHERE t.picid = '$id' ORDER BY tt.slug ASC ");
217
+ if (!empty($tagarray)){
218
+ foreach($tagarray as $element) {
219
+ $tags[$element->id] = $element->name;
220
+ }
221
+ wp_set_object_terms($id, $tags, 'ngg_tag');
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ /**
228
+ * ngg_convert_filestructure() - converter for old thumnail folder structure
229
+ *
230
+ * @return void
231
+ */
232
+ function ngg_convert_filestructure() {
233
+ global $wpdb;
234
+
235
+ $gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC", OBJECT_K);
236
+ if ( is_array($gallerylist) ) {
237
+ $errors = array();
238
+ foreach($gallerylist as $gallery) {
239
+ $gallerypath = WINABSPATH.$gallery->path;
240
+
241
+ // old mygallery check, convert the wrong folder/ file name now
242
+ if (@is_dir($gallerypath . '/tumbs')) {
243
+ if ( !@rename($gallerypath . '/tumbs' , $gallerypath .'/thumbs') )
244
+ $errors[] = $gallery->path . '/thumbs';
245
+ // read list of images
246
+ $imageslist = nggAdmin::scandir($gallerypath . '/thumbs');
247
+ if ( !empty($imageslist)) {
248
+ foreach($imageslist as $image) {
249
+ $purename = substr($image, 4);
250
+ if ( !@rename($gallerypath . '/thumbs/' . $image, $gallerypath . '/thumbs/thumbs_' . $purename ))
251
+ $errors[] = $gallery->path . '/thumbs/thumbs_' . $purename ;
252
+ }
253
+ }
254
+ }
255
+ }
256
+
257
+ if (!empty($errors)) {
258
+ echo "<div class='error_inline'><p>". __('Some folders/files could not renamed, please recheck the permission and rescan the folder in the manage gallery section.', 'nggallery') ."</p>";
259
+ foreach($errors as $value) {
260
+ echo __('Rename failed', 'nggallery') . ' : <strong>' . $value . "</strong><br />\n";
261
+ }
262
+ echo '</div>';
263
+ }
264
+ }
265
+ }
266
+
267
+ /**
268
+ * Move the imagerotator outside the plugin folder, as we remove it from the REPO with the next update
269
+ *
270
+ * @return string $path URL to the imagerotator
271
+ */
272
+ function ngg_move_imagerotator() {
273
+
274
+ $upload = wp_upload_dir();
275
+
276
+ // look first at the old place and move it
277
+ if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
278
+ @rename(NGGALLERY_ABSPATH . 'imagerotator.swf', $upload['basedir'] . '/imagerotator.swf');
279
+
280
+ // If it's successful then we return the new path
281
+ if ( file_exists( $upload['basedir'] . '/imagerotator.swf' ) )
282
+ return $upload['baseurl'] . '/imagerotator.swf';
283
+
284
+ //In some worse case it's still at the old place
285
+ if ( file_exists( NGGALLERY_ABSPATH . 'imagerotator.swf' ) )
286
+ return NGGALLERY_URLPATH . 'imagerotator.swf';
287
+
288
+ // if something failed, we must return a empty string
289
+ return '';
290
+ }
291
+
292
+ /**
293
+ * ngg_import_date_time() - Read the timestamp from exif and insert it into the database
294
+ *
295
+ * @return void
296
+ */
297
+ function ngg_import_date_time() {
298
+ global $wpdb;
299
+
300
+ $imagelist = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid ORDER BY tt.pid ASC");
301
+ if ( is_array($imagelist) ) {
302
+ foreach ($imagelist as $image) {
303
+ $picture = new nggImage($image);
304
+ $meta = new nggMeta($picture->pid, true);
305
+ $date = $meta->get_date_time();
306
+ $wpdb->query("UPDATE $wpdb->nggpictures SET imagedate = '$date' WHERE pid = '$picture->pid'");
307
+ }
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Adding a new column if needed
313
+ * Example : ngg_maybe_add_column( $wpdb->nggpictures, 'imagedate', "DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER alttext");
314
+ *
315
+ * @param string $table_name Database table name.
316
+ * @param string $column_name Database column name to create.
317
+ * @param string $create_ddl SQL statement to create column
318
+ * @return bool True, when done with execution.
319
+ */
320
+ function ngg_maybe_add_column($table_name, $column_name, $create_ddl) {
321
+ global $wpdb;
322
+
323
+ foreach ($wpdb->get_col("SHOW COLUMNS FROM $table_name") as $column ) {
324
+ if ($column == $column_name)
325
+ return true;
326
+ }
327
+
328
+ //didn't find it try to create it.
329
+ $wpdb->query("ALTER TABLE $table_name ADD $column_name " . $create_ddl);
330
+
331
+ // we cannot directly tell that whether this succeeded!
332
+ foreach ($wpdb->get_col("SHOW COLUMNS FROM $table_name") as $column ) {
333
+ if ($column == $column_name)
334
+ return true;
335
+ }
336
+
337
+ echo("Could not add column $column_name in table $table_name<br />\n");
338
+ return false;
339
+ }
340
+
341
+ /**
342
+ * nggallery_upgrade_page() - This page showsup , when the database version doesn't fir to the script NGG_DBVERSION constant.
343
+ *
344
+ * @return Upgrade Message
345
+ */
346
+ function nggallery_upgrade_page() {
347
+
348
+ $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
349
+
350
+ if ( isset($_GET['upgrade']) && $_GET['upgrade'] == 'now') {
351
+ nggallery_start_upgrade($filepath);
352
+ return;
353
+ }
354
+ ?>
355
+ <div class="wrap">
356
+ <h2><?php _e('Upgrade NextGEN Gallery', 'nggallery') ;?></h2>
357
+ <p><?php _e('The script detect that you upgrade from a older version.', 'nggallery') ;?>
358
+ <?php _e('Your database tables for NextGEN Gallery is out-of-date, and must be upgraded before you can continue.', 'nggallery'); ?>
359
+ <?php _e('If you would like to downgrade later, please make first a complete backup of your database and the images.', 'nggallery') ;?></p>
360
+ <p><?php _e('The upgrade process may take a while, so please be patient.', 'nggallery'); ?></p>
361
+ <h3><a href="<?php echo $filepath;?>&amp;upgrade=now"><?php _e('Start upgrade now', 'nggallery'); ?>...</a></h3>
362
+ </div>
363
+ <?php
364
+ }
365
+
366
+ /**
367
+ * nggallery_start_upgrade() - Proceed the upgrade routine
368
+ *
369
+ * @param mixed $filepath
370
+ * @return void
371
+ */
372
+ function nggallery_start_upgrade($filepath) {
373
+ ?>
374
+ <div class="wrap">
375
+ <h2><?php _e('Upgrade NextGEN Gallery', 'nggallery') ;?></h2>
376
+ <p><?php ngg_upgrade();?></p>
377
+ <p class="finished"><?php _e('Upgrade finished...', 'nggallery') ;?></p>
378
+ <h3><a class="finished" href="<?php echo $filepath;?>"><?php _e('Continue', 'nggallery'); ?>...</a></h3>
379
+ </div>
380
+ <?php
381
+ }
382
+
383
+ /**
384
+ * Rebuild slugs for albums, galleries and images via AJAX request
385
+ *
386
+ * @sine 1.7.0
387
+ * @access internal
388
+ */
389
+ class ngg_rebuild_unique_slugs {
390
+
391
+ function start_rebuild() {
392
+ global $wpdb;
393
+
394
+ $total = array();
395
+ // get the total number of images
396
+ $total['images'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") );
397
+ $total['gallery'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery") );
398
+ $total['album'] = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum") );
399
+
400
+ $messages = array(
401
+ 'images' => __( 'Rebuild image structure : %s / %s images', 'nggallery' ),
402
+ 'gallery' => __( 'Rebuild gallery structure : %s / %s galleries', 'nggallery' ),
403
+ 'album' => __( 'Rebuild album structure : %s / %s albums', 'nggallery' ),
404
+ );
405
+
406
+ ?>
407
+ <?php
408
+
409
+ foreach ( array_keys( $messages ) as $key ) {
410
+
411
+ $message = sprintf( $messages[ $key ] ,
412
+ "<span class='ngg-count-current'>0</span>",
413
+ "<span class='ngg-count-total'>" . $total[ $key ] . "</span>"
414
+ );
415
+
416
+ echo "<div class='$key updated'><p class='ngg'>$message</p></div>";
417
+ }
418
+
419
+ $ajax_url = add_query_arg( 'action', 'ngg_rebuild_unique_slugs', admin_url( 'admin-ajax.php' ) );
420
+ ?>
421
+ <script type="text/javascript">
422
+ jQuery(document).ready(function($) {
423
+ var ajax_url = '<?php echo $ajax_url; ?>',
424
+ _action = 'images',
425
+ images = <?php echo $total['images']; ?>,
426
+ gallery = <?php echo $total['gallery']; ?>,
427
+ album = <?php echo $total['album']; ?>,
428
+ total = 0,
429
+ offset = 0,
430
+ count = 50;
431
+
432
+ var $display = $('.ngg-count-current');
433
+ $('.finished, .gallery, .album').hide();
434
+ total = images;
435
+
436
+ function call_again() {
437
+ if ( offset > total ) {
438
+ offset = 0;
439
+ // 1st run finished
440
+ if (_action == 'images') {
441
+ _action = 'gallery';
442
+ total = gallery;
443
+ $('.images, .gallery').toggle();
444
+ $display.html(offset);
445
+ call_again();
446
+ return;
447
+ }
448
+ // 2nd run finished
449
+ if (_action == 'gallery') {
450
+ _action = 'album';
451
+ total = album;
452
+ $('.gallery, .album').toggle();
453
+ $display.html(offset);
454
+ call_again();
455
+ return;
456
+ }
457
+ // 3rd run finished, exit now
458
+ if (_action == 'album') {
459
+ $('.ngg')
460
+ .html('<?php _e( 'Done.', 'nggallery' ); ?>')
461
+ .parent('div').hide();
462
+ $('.finished').show();
463
+ return;
464
+ }
465
+ }
466
+
467
+ $.post(ajax_url, {'_action': _action, 'offset': offset}, function(response) {
468
+ $display.html(offset);
469
+
470
+ offset += count;
471
+ call_again();
472
+ });
473
+ }
474
+
475
+ call_again();
476
+ });
477
+ </script>
478
+ <?php
479
+ }
480
  }
admin/upload.php CHANGED
@@ -1,49 +1,41 @@
1
- <?php
2
- /**
3
- * Accepts file uploads from swfupload.
4
- *
5
- * @package NextGEN-Gallery
6
- * @subpackage Administration
7
- */
8
- // look up for the path
9
- require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
10
-
11
- // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
12
- if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
13
- $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
14
- elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
15
- $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
16
- if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
17
- $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
18
-
19
- // don't ask me why, sometimes needed, taken from wp core
20
- unset($current_user);
21
-
22
- // admin.php require a proper login cookie
23
- require_once(ABSPATH . '/wp-admin/admin.php');
24
-
25
- header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
26
-
27
- //check for correct capability
28
- if ( !is_user_logged_in() )
29
- die('Login failure. -1');
30
-
31
- //check for correct capability
32
- if ( !current_user_can('NextGEN Upload images') )
33
- die('You do not have permission to upload files. -2');
34
-
35
- //check for correct nonce
36
- check_admin_referer('ngg_swfupload');
37
-
38
- //check for nggallery
39
- if ( !defined('NGGALLERY_ABSPATH') )
40
- die('NextGEN Gallery not available. -3');
41
-
42
- include_once (NGGALLERY_ABSPATH. 'admin/functions.php');
43
-
44
- // get the gallery
45
- $galleryID = (int) $_POST['galleryselect'];
46
-
47
- echo nggAdmin::swfupload_image($galleryID);
48
-
49
  ?>
1
+ <?php
2
+ /**
3
+ * Accepts file uploads from swfupload.
4
+ *
5
+ * @package NextGEN-Gallery
6
+ * @subpackage Administration
7
+ */
8
+
9
+ // Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
10
+ if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
11
+ $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
12
+ elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
13
+ $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
14
+ if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
15
+ $_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
16
+
17
+ header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
18
+
19
+ //check for correct capability
20
+ if ( !is_user_logged_in() )
21
+ die('Login failure. -1');
22
+
23
+ //check for correct capability
24
+ if ( !current_user_can('NextGEN Upload images') )
25
+ die('You do not have permission to upload files. -2');
26
+
27
+ //check for correct nonce
28
+ check_admin_referer('ngg_swfupload');
29
+
30
+ //check for nggallery
31
+ if ( !defined('NGGALLERY_ABSPATH') )
32
+ die('NextGEN Gallery not available. -3');
33
+
34
+ include_once (NGGALLERY_ABSPATH. 'admin/functions.php');
35
+
36
+ // get the gallery
37
+ $galleryID = (int) $_POST['galleryselect'];
38
+
39
+ echo nggAdmin::swfupload_image($galleryID);
40
+
 
 
 
 
 
 
 
 
41
  ?>
admin/wpmu.php CHANGED
@@ -1,131 +1,117 @@
1
- <?php
2
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
-
4
- function nggallery_wpmu_setup() {
5
-
6
- //to be sure
7
- if ( !is_super_admin() )
8
- die('You are not allowed to call this page.');
9
-
10
- $messagetext = '';
11
-
12
- // get the options
13
- $ngg_options = get_site_option('ngg_options');
14
-
15
- if ( isset($_POST['updateoption']) ) {
16
- check_admin_referer('ngg_wpmu_settings');
17
- // get the hidden option fields, taken from WP core
18
- if ( $_POST['page_options'] )
19
- $options = explode(',', stripslashes($_POST['page_options']));
20
- if ($options) {
21
- foreach ($options as $option) {
22
- $option = trim($option);
23
- $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
24
- // $value = sanitize_option($option, $value); // This does strip slashes on those that need it
25
- $ngg_options[$option] = $value;
26
- }
27
- }
28
-
29
- // the path should always end with a slash
30
- $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']);
31
- update_site_option('ngg_options', $ngg_options);
32
-
33
- $messagetext = __('Update successfully','nggallery');
34
- }
35
-
36
- // Show donation message only one time.
37
- if (isset ( $_GET['hideSupportInfo']) ) {
38
- $ngg_options['hideSupportInfo'] = true;
39
- update_site_option('ngg_options', $ngg_options);
40
- }
41
-
42
- if( !isset ( $ngg_options['hideSupportInfo']) || $ngg_options['hideSupportInfo'] !== true ) {
43
- ?>
44
- <div id="donator_message">
45
- <p><?php echo str_replace('%s', 'http://alexrabe.de/donation', __('Thanks for using this plugin, NextGEN Gallery is initially developed for self hosted blogs. A multisite setup is possible, but cannot currently fully supported, as it can have several special condition ( i.e. Domain mapping).<br /> If you would like to support the further development, please consider a <strong><a href="%s">donation</a></strong>! If you still need some help, please post your questions <a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10">here</a> .', 'nggallery')); ?>
46
- <span>
47
- <a href="<?php echo add_query_arg( array( 'hideSupportInfo' => 'true') ); ?>" >
48
- <small><?php _e('OK, hide this message now !', 'nggallery'); ?></small>
49
- </a>
50
- <span>
51
- </p>
52
- </div>
53
- <?php
54
- }
55
-
56
- // message windows
57
- if( !empty($messagetext) ) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
58
-
59
- ?>
60
-
61
- <div class="wrap">
62
- <h2><?php _e('Network Options','nggallery'); ?></h2>
63
- <form name="generaloptions" method="post">
64
- <?php wp_nonce_field('ngg_wpmu_settings') ?>
65
- <input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuImportFolder,wpmuStyle,wpmuRoles,wpmuCSSfile" />
66
- <table class="form-table">
67
- <tr valign="top">
68
- <th align="left"><?php _e('Gallery path','nggallery') ?></th>
69
- <td><input type="text" size="50" name="gallerypath" value="<?php echo $ngg_options['gallerypath']; ?>" /><br />
70
- <?php _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.','nggallery') ?>
71
- <?php echo str_replace('%s', '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>', __('The default setting should be %s', 'nggallery')); ?>
72
- </td>
73
- </tr>
74
- <tr>
75
- <th valign="top"><?php _e('Enable upload quota check','nggallery') ?>:</th>
76
- <td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuQuotaCheck']); ?> />
77
- <?php _e('Should work if the gallery is bellow the blog.dir','nggallery') ?>
78
- </td>
79
- </tr>
80
- <tr>
81
- <th valign="top"><?php _e('Enable zip upload option','nggallery') ?>:</th>
82
- <td><input name="wpmuZipUpload" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuZipUpload']); ?> />
83
- <?php _e('Allow users to upload zip folders.','nggallery') ?>
84
- </td>
85
- </tr>
86
- <tr>
87
- <th valign="top"><?php _e('Enable import function','nggallery') ?>:</th>
88
- <td><input name="wpmuImportFolder" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuImportFolder']); ?> />
89
- <?php _e('Allow users to import images folders from the server.','nggallery') ?>
90
- </td>
91
- </tr>
92
- <tr>
93
- <th valign="top"><?php _e('Enable style selection','nggallery') ?>:</th>
94
- <td><input name="wpmuStyle" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuStyle']); ?> />
95
- <?php _e('Allow users to choose a style for the gallery.','nggallery') ?>
96
- </td>
97
- </tr>
98
- <tr>
99
- <th valign="top"><?php _e('Enable roles/capabilities','nggallery') ?>:</th>
100
- <td><input name="wpmuRoles" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuRoles']); ?> />
101
- <?php _e('Allow users to change the roles for other blog authors.','nggallery') ?>
102
- </td>
103
- </tr>
104
- <tr>
105
- <th valign="top"><?php _e('Default style','nggallery') ?>:</th>
106
- <td>
107
- <select name="wpmuCSSfile">
108
- <?php
109
- $csslist = ngg_get_cssfiles();
110
- foreach ($csslist as $key =>$a_cssfile) {
111
- $css_name = $a_cssfile['Name'];
112
- if ($key == $ngg_options['wpmuCSSfile']) {
113
- $file_show = $key;
114
- $selected = " selected='selected'";
115
- }
116
- else $selected = '';
117
- $css_name = esc_attr($css_name);
118
- echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
119
- }
120
- ?>
121
- </select><br />
122
- <?php _e('Choose the default style for the galleries.','nggallery') ?>
123
- </td>
124
- </tr>
125
- </table>
126
- <div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?>"/></div>
127
- </form>
128
- </div>
129
-
130
- <?php
131
- }
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ function nggallery_wpmu_setup() {
5
+
6
+ //to be sure
7
+ if ( !is_super_admin() )
8
+ die('You are not allowed to call this page.');
9
+
10
+ $messagetext = '';
11
+
12
+ // get the options
13
+ $ngg_options = get_site_option('ngg_options');
14
+
15
+ if ( isset($_POST['updateoption']) ) {
16
+ check_admin_referer('ngg_wpmu_settings');
17
+ // get the hidden option fields, taken from WP core
18
+ if ( $_POST['page_options'] )
19
+ $options = explode(',', stripslashes($_POST['page_options']));
20
+ if ($options) {
21
+ foreach ($options as $option) {
22
+ $option = trim($option);
23
+ $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
24
+ // $value = sanitize_option($option, $value); // This does strip slashes on those that need it
25
+ $ngg_options[$option] = $value;
26
+ }
27
+ }
28
+
29
+ // the path should always end with a slash
30
+ $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']);
31
+ update_site_option('ngg_options', $ngg_options);
32
+
33
+ $messagetext = __('Update successfully','nggallery');
34
+ }
35
+
36
+ // Show donation message only one time.
37
+ if (isset ( $_GET['hideSupportInfo']) ) {
38
+ $ngg_options['hideSupportInfo'] = true;
39
+ update_site_option('ngg_options', $ngg_options);
40
+ }
41
+
42
+ // message windows
43
+ if( !empty($messagetext) ) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
44
+
45
+ ?>
46
+
47
+ <div class="wrap">
48
+ <h2><?php _e('Network Options','nggallery'); ?></h2>
49
+ <form name="generaloptions" method="post">
50
+ <?php wp_nonce_field('ngg_wpmu_settings') ?>
51
+ <input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuImportFolder,wpmuStyle,wpmuRoles,wpmuCSSfile" />
52
+ <table class="form-table">
53
+ <tr valign="top">
54
+ <th align="left"><?php _e('Gallery path','nggallery') ?></th>
55
+ <td><input type="text" size="50" name="gallerypath" value="<?php echo $ngg_options['gallerypath']; ?>" /><br />
56
+ <?php _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.','nggallery') ?>
57
+ <?php echo str_replace('%s', '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>', __('The default setting should be %s', 'nggallery')); ?>
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <th valign="top"><?php _e('Enable upload quota check','nggallery') ?>:</th>
62
+ <td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuQuotaCheck']); ?> />
63
+ <?php _e('Should work if the gallery is bellow the blog.dir','nggallery') ?>
64
+ </td>
65
+ </tr>
66
+ <tr>
67
+ <th valign="top"><?php _e('Enable zip upload option','nggallery') ?>:</th>
68
+ <td><input name="wpmuZipUpload" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuZipUpload']); ?> />
69
+ <?php _e('Allow users to upload zip folders.','nggallery') ?>
70
+ </td>
71
+ </tr>
72
+ <tr>
73
+ <th valign="top"><?php _e('Enable import function','nggallery') ?>:</th>
74
+ <td><input name="wpmuImportFolder" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuImportFolder']); ?> />
75
+ <?php _e('Allow users to import images folders from the server.','nggallery') ?>
76
+ </td>
77
+ </tr>
78
+ <tr>
79
+ <th valign="top"><?php _e('Enable style selection','nggallery') ?>:</th>
80
+ <td><input name="wpmuStyle" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuStyle']); ?> />
81
+ <?php _e('Allow users to choose a style for the gallery.','nggallery') ?>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <th valign="top"><?php _e('Enable roles/capabilities','nggallery') ?>:</th>
86
+ <td><input name="wpmuRoles" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuRoles']); ?> />
87
+ <?php _e('Allow users to change the roles for other blog authors.','nggallery') ?>
88
+ </td>
89
+ </tr>
90
+ <tr>
91
+ <th valign="top"><?php _e('Default style','nggallery') ?>:</th>
92
+ <td>
93
+ <select name="wpmuCSSfile">
94
+ <?php
95
+ $csslist = ngg_get_cssfiles();
96
+ foreach ($csslist as $key =>$a_cssfile) {
97
+ $css_name = $a_cssfile['Name'];
98
+ if ($key == $ngg_options['wpmuCSSfile']) {
99
+ $file_show = $key;
100
+ $selected = " selected='selected'";
101
+ }
102
+ else $selected = '';
103
+ $css_name = esc_attr($css_name);
104
+ echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
105
+ }
106
+ ?>
107
+ </select><br />
108
+ <?php _e('Choose the default style for the galleries.','nggallery') ?>
109
+ </td>
110
+ </tr>
111
+ </table>
112
+ <div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?>"/></div>
113
+ </form>
114
+ </div>
115
+
116
+ <?php
117
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
changelog.txt CHANGED
@@ -1,710 +1,718 @@
1
- NextGEN Gallery
2
- by Alex Rabe & NextGEN DEV Team
3
-
4
- = V1.9.3 - 26.02.2012 =
5
- * Bugfix : Ensure to set the slug for "all" albums
6
- * Bugfix : Updated german translation ( THX to Roger Hunziker )
7
- * Bugfix : Ensure error checking on IPTC array (THX to Kristian Edlund)
8
- * Bugfix : Handle IE8 cached images better in slideshow
9
- * Bugfix : Show album preview image if selected (THX to Kristian Edlund)
10
-
11
- = V1.9.2 - 17.01.2012 =
12
- * NEW : Added more XMLRPC commands (THX to Vladimir Vinogradsky)
13
- * Changed : Rework Post-thumbnail function (THX to Kristian Edlund)
14
- * Bugfix : Check first for valid images on unzip (only Mac OS zip-files)
15
- * Bugfix : Increase z-index for twenty eleven theme
16
- * Bugfix : Support non latin chars in tagcloud
17
- * Bugfix : Allow other tinymce intance
18
- * Bugfix : Better support for WPML translation
19
-
20
- = V1.9.1 - 10.12.2011 =
21
- * Bugfix : Security hardness for untrusted filenames/meta data (THX to Brian St. Pierre)
22
- * Bugfix : Fixed security vulnerability (TXH to Jon Cave)
23
- * Bugfix : Load piclens script via other function
24
- * Bugfix : IE7 script fix for add gallery
25
- * Bugfix : IE7/IE8 width set correctly for edit album autocomplete field
26
-
27
- = V1.9.0 - 27.11.2011 =
28
- * NEW : Keep images transparency for PNG and GIF format
29
- * NEW : Switch to Plupload, support now HTML5 Upload (only with WordPress 3.3)
30
- * NEW : Added client side resize feature (only with WordPress 3.3)
31
- * NEW : Support for gallery templates in album shortcodes [ album id=x template="name" gallery="templatename" ]
32
- * NEW : Added new hook ngg_delete_picture
33
- * Changed : Updated to jQuery Cycle Version 2.9995
34
- * Changed : Always cache the single pictures, remove option
35
- * Bugfix : Couldn't use bulk operation for search results
36
- * Bugfix : Bugfix for Edit thumbnails under IE 8 + 9
37
- * Bugfix : Allow empty altext in ngg.editImage
38
- * Bugfix : Various PHP notice fixes
39
- * Bugfix : Resize fix for Shutter effect and mobile Browser
40
- * Bugfix : FTP Import missing slug field into database
41
- * Bugfix : Check also EXIF field "DateTimeOriginal" for timestamp
42
-
43
- = V1.8.4 - 26.10.2011 =
44
- * Bugfix : Fixed security vulnerability (TXH to Alain Schneider)
45
-
46
- = V1.8.3 - 07.08.2011 =
47
- * Changed : Support for simple custom permalink structures (i.e. /%category%/%postname%/)
48
- * Bugfix : Sub-Albums in Albums didn't create the correct link
49
- * Bugfix : AJAX Pagination didn't work anymore
50
- * Bugfix : Adding index.php to home_url()
51
- * Bugfix : Preview picture lost on backend gallery page 2 or higher
52
-
53
- = V1.8.2 - 12.07.2011 =
54
- * Bugfix : Set pagination variables for search result, otherwise update failed
55
- * Bugfix : Update failed for paged galleries since WordPress 3.2
56
-
57
- = V1.8.1 - 18.06.2011 =
58
- * Bugfix : Special case for pagination, instead of showing page-1, we show the clean url
59
- * Bugfix : Various PHP notice fixes
60
- * Bugfix : Typo in rewrite rules
61
- * Bugfix : Flush rewrite rules during upgrade later
62
-
63
- = V1.8.0 - 12.06.2011 =
64
- * NEW : Full rework of permalink url structure
65
- * NEW : Adding Google Sitemaps for Images (require WordPress SEO plugin by YOAST )
66
- * NEW : Support for WPML ( WordPress Multilingual Plugin )
67
- * NEW : Adding support for arrow key in shutter effect (THX to Flyvans)
68
- * NEW : Adding sort operation for galleries overview page
69
- * Changed : Updated pagination to new WP3.1 style
70
- * Bugfix : Create unique slug in a better way
71
- * Bugfix : Rework screen options filter for gallery and image table
72
- * Bugfix : Empty values in XMLRPC update calls are ignored
73
- * Bugfix : Create gallery failed when safe-mode on
74
- * Bugfix : Permalink didn't work in combination with album & imagebrowser
75
-
76
- = V1.7.4 - 15.02.2011 =
77
- * Bugfix : Disallow direct call of ajax file to avoid path disclosure (THX to High-Tech Bridge SA)
78
- * Bugfix : Rework jQuery Cycle slideshow for IE compat reason (THX to Justin Dickenson)
79
- * Bugfix : Resize only larger images in slideshow
80
- * Bugfix : Improved image format detection in gd.thumbnail class (THX to Kupar.b)
81
-
82
- = V1.7.3 - 20.01.2011 =
83
- * NEW : Introduce plugin health check for conflicts with other plugins/themes
84
- * NEW : Adding new XMLRPC method ngg.deleteImage
85
- * NEW : Adding new XMLRPC method ngg.editImage
86
- * Changed : Rework register script for autocomplete feature
87
- * Bugfix : Bugfix for Multisite setup and flash upload
88
- * Bugfix : WP3.1 compat issue, show site admin page only on Multisite installation
89
-
90
- = V1.7.2 - 13.12.2010 =
91
- * Bugfix : Adding images to database require slug
92
-
93
- = V1.7.1 - 13.12.2010 =
94
- * Changed : Disable upgrade for PHP4 user
95
- * Changed : Disable colorpicker for option page
96
- * Bugfix : Compat fix for upgrade
97
-
98
- = V1.7.0 - 11.12.2010 =
99
- * NEW : Publish a new post direct from the gallery admin page
100
- * NEW : Added filter hook 'ngg_get_image_metadata' to add more exif/iptc information
101
- * NEW : Adding Autocomplete field to TinyMCE Popup and Album page
102
- * NEW : More methods for XMLRPC interface
103
- * Changed : New hooks for gallery table (THX to Alexander Schneider)
104
- * Changed : Introduce jQuery dialog as new UI element
105
- * Changed : Call TinyMCE window via admin-ajax
106
- * Bugfix : Better support for SSL blogs
107
- * Bugfix : Install/Upgrade failed when table prefix contain captial letters
108
- * Bugfix : Fix validation issues in Media-RSS
109
- * Bugfix : Empty tags in XMP Meta causes PHP error
110
- * Bugfix : Rework load mechanism for slideshow
111
- * Bugfix : Copy meta data when image is copied
112
- * Bugfix : Icon Support for Ozh' Admin Drop Down Menu
113
- * Bugfix : Use correct sort order in slideshow
114
-
115
- = V1.6.2 - 19.09.2010 =
116
- * NEW : Added constant NGG_SKIP_LOAD_SCRIPTS to avoid script load
117
- * Bugfix : Load Tags library with core files
118
- * Bugfix : Slideshow script failed in IE7, load script now in header
119
- * Bugfix : Load slideshow widget always
120
- * Changed : New admin notice for database upgrade
121
- * Changed : Rework crop feature for featured images
122
- * Changed : Use site_url() instead get_option ('siteurl'), required for SSL support
123
-
124
- = V1.6.1 - 08.09.2010 =
125
- * Bugfix : Script load of swfobject.js failed
126
- * Bugfix : Show sideshow also with 1 or 2 images
127
- * Bugfix : Rework null byte check in zip upload
128
-
129
- = V1.6.0 - 07.09.2010 =
130
- * NEW : Wordpress 3.0 Network (Multi-Site) support
131
- * NEW : Integrate jQuery Cycle as NON-Flash slideshow
132
- * NEW : Adding jQuery File Tree for import folder (THX to Sergey Pasyuk )
133
- * NEW : Added action hook 'ngg_show_imagebrowser_first' on custom request
134
- * NEW : Added filter hook 'ngg_slideshow_size' to resize sildeshow for mobile browser plugins
135
- * Changed : Reorder tabs for upload
136
- * Changed : New menu icon and screen icon (THX to Ben Dunkle)
137
- * Changed : Load frontend libs always
138
- * Changed : Rework of overview page
139
- * Bugfix : Security bugfix for Zip-Upload (THX to Dominic Szablewski)
140
- * Bugfix : Allow JPG, PNG, GIF extension
141
- * Bugfix : New German translation (THX to Martin Kramarz)
142
- * Bugfix : Copy/Move also backup file
143
- * Bugfix : Calculate correct ratio for fix thumbnail size (THX to Alekz Keck)
144
-
145
- = V1.5.5 - 14.06.2010 =
146
- * Bugfix : Compat issue for post thumbnails with WP2.9
147
- * NEW : Adding more hooks for custom fields plugin
148
-
149
- = V1.5.4 - 14.06.2010 =
150
- * Bugfix : No resize of smaller images
151
- * Bugfix : Compat issues for Post Thumbnails under WP3.0
152
- * Bugfix : Esc_URL in Media RSS
153
-
154
- = V1.5.3 - 11.04.2010 =
155
- * New : Adding pagination to footer
156
- * Changed : Prepare new filter to replace slideshow
157
- * Bugfix : Remove non-breaking space from navigation
158
- * Bugfix : Pagination of galleries
159
- * Bugfix : Fixed brackets position for old shortcode query
160
- * Bugfix : Slideshow option 'Show next image on click" has wrong default value
161
-
162
- = V1.5.2 - 25.03.2010 =
163
- * Bugfix : XSS security vulnerability (THX to Core Security Advisories Team , Pedro Varangot)
164
- * Bugfix : Missing $wpdb in shortcodes.php
165
-
166
- = V1.5.1 - 23.03.2010 =
167
- * Bugfix : PHP4 compat issue for Add gallery & options page
168
- * Bugfix : Gallery widget can now have a empty title
169
- * Bugfix : Adding correct stripslash for gallery title
170
-
171
- = V1.5.0 - 18.03.2010 =
172
- * NEW : Support for Post thumbnail feature
173
- * NEW : Backup and Recover function for images (THX to Simone Fumagalli)
174
- * NEW : Resize images after upload (THX to Simone Fumagalli)
175
- * NEW : Added a JSON class for fetching galleries in a RESTful way (see xml/json.php)
176
- * NEW : Adding various new capabilities for user roles
177
- * NEW : Auto downloader for translation file
178
- * Changed : Rename query var from slideshow to callback for compat reason with other plugin
179
- * Changed : Convert widget function to new WP structure
180
- * Changed : Include lookup for tags into the backend search
181
- * Changed : Restructure addgallery and settings page to enable custom tabs
182
- * Bugfix : Select album preview from gallery preview pics instead random list
183
- * Bugfix : Keep fix dimension in edit thumbnail operation
184
- * Bugfix : Import meta data didn't work correct for existing images
185
- * Bugfix : Fix onload bug for Chrome 4 in Shutter script
186
- * Bugfix : Remove various PHP notices for a better world
187
- * Removed : Canonical link is now part of Wordpress 2.9
188
-
189
- = V1.4.3 - 16.11.2009 =
190
- * Bugfix : Urlencode XML file path for sildeshow
191
-
192
- = V1.4.2 - 16.11.2009 =
193
- * Changed : Load sildeshow XML not longer via relative path
194
- * Bugfix : No imagebrowser in carousel mode
195
- * Bugfix : JS Effect navigation based on wrong array structure
196
- * Bugfix : Remove whitespaces from meta import
197
- * Bugfix : Capability check for upgrade notice
198
- * Removed : Hide "more settings" for now, causes problems with IE and jQuery UI tabs
199
-
200
- = V1.4.1 - 10.11.2009 =
201
- * Bugfix : Capabilites could not be saved
202
- * Bugfix : Ajax pagination option not saved
203
- * Bugfix : echo nggSlideshowWidget() for compat reason
204
-
205
- = V1.4.0 - 08.11.2009 =
206
- * NEW : Automatic rotate images during upload or via manage gallery page (THX to Simone Fumagalli)
207
- * NEW : Include Bulkupdate for gallery overview, require PHP 5.2
208
- * NEW : XMLRPC support with 4 new methods : see xmlrpc.php for more information
209
- * NEW : Recent and random images can be taken from a specific gallery using the id=x parameter in the shortcode (THX to Prollius)
210
- * NEW : Recent images can be recent by exif date (instead of database id) by using the mode=recentdate parameter in the shortcode (THX to Prollius)
211
- * NEW : Introduce the WP_Object_cache and meta_data
212
- * NEW : Various new hooks and filters
213
- * Added : Better support for role manager plugin (THX to Mattias Buelens)
214
- * Added : New option to add hidden images. Needed to show all images in a modal window (Thickbox, Lightbox et.)
215
- * Added : New link parameter for the singlepic shortcode : [singlepic id=x w=x h=x link="http://google.com"]
216
- * Added : New template gallery-carousel
217
- * Added : New id parameter for recent and random shortcodes : [random max="7" template="filename" id="2"] takes only pictures from the gallery with id=2
218
- * Added : New mode parameter for recent shortcode : [recent max="7" template="filename" id="3" mode="date" /] where mode can be one of (id, date, sort). Recent pictures are delivered by addition to database (id), exif date (date) or user sort order (sort).
219
- * Added : Enable/Disable Ajax navigation via settings
220
- * Added : New filter hook 'ngg_render_template' to render templates with a other plugin
221
- * Changed : Added option to link an album with a page id
222
- * Changed : Support templates for child themes, use STYLESHEETPATH instead TEMPLATEPATH (THX to Prollius)
223
- * Changed : Rework of Media RSS Widget
224
- * Bugfix : Check capability to create a new page
225
- * Bugfix : Fix double call of filter name , changed to ngg_picturelist_object (THX to Prollius)
226
- * Bugfix : Check for a deleted gallery in a album
227
-
228
- = V1.3.6 - 20.09.2009 =
229
- * Changed : Just change the feed link
230
-
231
- = V1.3.5 - 17.07.2009 =
232
- * Bugfix : Fixed XSS issue for Page title
233
-
234
- = V1.3.4 - 07.07.2009 =
235
- * Added : New filter ngg_gallery_object and ngg_image_object
236
- * Bugfix : Fix double rendering of a gallery if two album shortcodes are used
237
- * Bugfix : Fix for custom field ngg_gal_sort
238
- * Bugfix : Changed capability check for upload
239
- * Bugfix : Check for correct version OR memory limit
240
-
241
- = V1.3.3 - 11.06.2009 =
242
- * Changed : Load Thickbox images via wp_footer()
243
- * Bugfix : Widget setting couldnot be saved
244
-
245
- = V1.3.2 - 10.06.2009 =
246
- * Changed : Resize maximum to 1280 x 1280 with nggshow (THX to onezero)
247
- * Bugfix : Bugfix for Multifile upload
248
- * Bugfix : Bugfix for sortorder under jQuery 1.3
249
- * Bugfix : Workaround for more albums per page, need more rework
250
- * Bugfix : AJAX reload didn't work if slideshow is shown by default
251
- * Bugfix : Redirect links didn't work if permalinks are deactivates
252
- * Bugfix : Add new gallery in manage-overview didn't use defaultpath
253
-
254
- = V1.3.1 - 07.06.2009 =
255
- * Bugfix : Fixed ZIP upload, wrong variable used
256
- * Bugfix : Check for array before foreach in album missing
257
-
258
- = V1.3.0 - 07.06.2009 =
259
- * NEW : Subalbum support
260
- * NEW : Search for images in the admin tab
261
- * NEW : Add new gallery also in manage tab
262
- * NEW : AJAX support for Imagebrowser and gallery navigation (THX to Anty)
263
- * NEW : Added zip upload via URL (THX to Juan Jose Galvez)
264
- * Added : jQuery Multiple File Upload Plugin v1.44
265
- * Added : SWFUpload V2.2.0
266
- * Changed : Remove extension for Alttext during first import
267
- * Changed : Meta tag added via wp_head hook (THX to Viper)
268
- * Bugfix : Correct various PHP notice messages
269
- * Bugfix : Typo fix in custom fields for ngg_gal_ImageBrowser
270
- * Bugfix : Avoid upload of images in gallery without correct capability
271
-
272
- = V1.2.1 - 22.03.2009 =
273
- * NEW : Support for IE8 Web Slices in widgets
274
- * NEW : Add filter ngg_image_object
275
- * Changed : Descending order in add gallery menu
276
- * Bugfix : Exclude option didnT work for multi pages
277
- * Bugfix : Check for correct capability in manage gallery
278
-
279
- = V1.2.0 - 09.03.2009 =
280
- * NEW : Support for image tag cloud with shortcode [tagcloud]
281
- * NEW : Adding shortcode [recent max="7" template="filename" /] & [random max="7" template="filename" /] to show the most recent/random pictures (THX to Bernhard)
282
- * NEW : Crop thumbnails manually (THX to Simone Fumagalli)
283
- * NEW : Support for i18n with polyglot or qtrans plugin (THX to Boris Glumpler)
284
- * NEW : Canonical meta link support
285
- * Added : SWFUpload V2.2.0 B5
286
- * Added : New memory limit check in upload screen
287
- * Bugfix : Language typo fixes
288
- * Bugfix : Admin Pagination fix
289
- * Bugfix : Typo fix in widgets
290
- * Bugfix : Init column script after document is ready
291
- * Bugfix : htmlspecialchars() instead htmlentities() for links in the a href title description
292
- * Bugfix : Upgrade routine didn't add sortorder to correct table (THX to Uwe)
293
- * Bugfix : Correct shotcode in media upload tab
294
-
295
- = V1.1.0 - 26.01.2009 =
296
- * NEW : Pagination for album page via custom fields ('ngg_paged_Galleries')
297
- * NEW : Support for fixed number of columns inside the gallery
298
- * NEW : Added pagination for galleries and images in admin section
299
- * NEW : New action hook after image is added to database, called 'ngg_added_new_image'
300
- * NEW : New template for caption below images, called via [nggallery id=x template=caption]
301
- * Added : SWFUpload V2.2.0 B4
302
- * Changed : Rework of Manage image tables
303
- * Changed : Move imagerotator.swf to wp-content/uploads
304
- * Changed : Added a URL field to setup the path to the Imagerotator
305
- * Changed : Add additional parameter to gallery object
306
- * Changed : Load donators list external
307
- * Bugfix : Style fixes for tables in IE7
308
- * Bugfix : All albums code couldn't use the slideshow, query is empty for 0
309
- * Bugfix : Htmlentities() for links in the a href title description
310
- * Bugfix : Clean up mode for singlepic
311
- * Bugfix : Typo in widget settings
312
-
313
- = V1.0.2 - 19.12.2008 =
314
- * Added : Option to enable/disable the MediaRSS Feed
315
- * Added : For flash under FF3/WIN we should use outline: none;
316
- * Added : Use sort order also for Media RSS
317
- * Changed : Descending order for TinyMCE Editor
318
- * Changed : Added screencolor flashvar as bgcolor for the flash slideshow
319
- * Changed : Remove link to gallery in sidebar widget
320
- * Bugfix : Check for empty gallery title and show name instead
321
- * Bugfix : Album id=all / Album id=0 didn't show content
322
- * Bugfix : Check for a empty description and alttext
323
- * Bugfix : Remove HTML tags from slideshow
324
- * Bugfix : Load SWFobject always when the imagerotator exist
325
- * Bugfix : Zip-Upload in existing gallery failed
326
- * Bugifx : Typo in functions.php (THX to David Horat)
327
-
328
- = V1.0.1 - 11.12.2008 =
329
- * Bugfix : Change upgrade routine, import_date_time could cause a memory problem
330
- * Bugfix : Help pages will not show up in non-english enviroment
331
- * Bugfix : Show gallery name if title is empty
332
-
333
- = V1.0.0 - 11.12.2008 =
334
- * NEW : Adding some rewrite rules for the Blog title for a better SEO (Will be continued...)
335
- * NEW : Added ImageMagick support (currently a bit experimental) (THX to Frederic de Ranter)
336
- * NEW : Automatic unistall via register_uninstall_hook()
337
- * NEW : Added a presort option to sort easier the images
338
- * NEW : Lookup for a nggallery.css in the theme folder
339
- * NEW : Added Date/Time field to database and import it from EXIF, new sort option
340
- * NEW : Multi Widgets to show links to Media RSS feeds (THX to Vincent Prat)
341
- * NEW : PicLens support for galleries (THX to Vincent Prat)
342
- * NEW : Copy/Move images between galleries (THX to Vincent Prat)
343
- * NEW : Media RSS feeds (either for galleries, albums or global) (THX to Vincent Prat)
344
- * NEW : Image tag management (THX to Vincent Prat)
345
- * NEW : Convert all shortcodes to WP shortcodes API
346
- * NEW : AJAX based thumbnail generator
347
- * NEW : Create output via template files, more flexible and support for multiple templates
348
- * NEW : Extended role system. Each gallery has now a author
349
- * NEW : [thumb id="4,5,12,..."] shortcode. You can now insert thumbnails for one or more images (that are not necessarly inside the same gallery).
350
- * Changed : Add swfupload 2.2.0. Support for Adobe Flash 10 upload
351
- * Changed : Update all Admin pages for Wordpress 2.7 Admin UI
352
- * Changed : New icon for TinyMCE and WP2.7 Menue from http://www.pinvoke.com/
353
- * Changed : Move update message to admin.php
354
- * Changed : Widgets are now core and doesn't need to be activate, rework as Multi Widgets
355
- * Changed : Improved the gallery management page.
356
- * Changed : Rename the filter 'ngg_create_gallery_thumbcode' to 'ngg_get_thumbcode'.
357
- * Changed : Convert tags to WP-Taxonomy tables, no more need for ngg_tags, ngg_pic2tags
358
- * Changed : Arrange manage fields in a new way
359
- * Changed : Support now SSL
360
- * Changed : Use JQuery UI instead of interface lib
361
- * Changed : Updated to swfobject 2.1
362
- * Changed : Rework of database queries and new central nggdb class
363
- * Bugfix : Changed CSS for singlepic padding to margin
364
- * Bugfix : Check for zero in Exif Focal Length
365
- * Bugfix : Round instead inval for square thumbnails
366
- * Removed : Do not longer check for myGallery folders
367
- * Removed : Use now PclZip from WP Core
368
- * Removed : Wordpress 2.1 - 2.3 files deleted
369
-
370
- = V0.99 - 27.09.2008 =
371
- * Changed : Included swfobject version 2.1
372
- * Bugfix : Recognize the zip better
373
- * Bugfix : Limit the length of the title in the media-upload
374
- * Bugfix : Round instead inval for square thumbnails
375
-
376
- = V0.98 - 15.07.2008 =
377
- * Bugfix : Removed all whitespaces at EOF
378
-
379
- = V0.97 - 10.07.2008 =
380
- * Changed : Get new path contstant from WP2.6
381
- * Changed : Minor updates for WP2.6
382
- * Changed : Added new filters (THX to Vincent Prat)
383
- * Removed : Revert singlepic wrapper, breaks validation
384
-
385
- = V0.96 - 18.05.2008 =
386
- * Changed : Use postbox for gallery settings
387
- * Added : New filter function to add custom columns
388
- * Bugfix : Fixed width for Thickbox in Manage gallery
389
- * Bugfix : fixed width for media upload select box
390
- * Bugfix : Remove <p> tag in singlepic regex
391
- * Bugfix : Correct format of shutter speed
392
- * Bugfix : Album name in Short code not useable
393
-
394
- = V0.95 - 25.04.2008 =
395
- * Bugfix : Correction in media-upload to fit with Wordpress 2.5.1
396
- * Bugfix : Attribute_escape all objects in media-upload
397
- * Bugfix : Correct sortorder for albums
398
- * Bugfix : Typo correction (THX to Momo-I)
399
-
400
- = V0.94 - 20.04.2008 =
401
- * Added : New filter option ngg_create_gallery_link
402
- * Changed : Reduce amount of DB queries in albums (Big THX to Alexandr Kindras)
403
- * Changed : Revert wpautop priority change. Doesn't good for other plugins
404
-
405
- = V0.93 - 12.04.2008 =
406
- * Added : Select Full-Size or Singlepic in Media Upload
407
- * Added : Check for minimum 8 MB Memory
408
- * Changed : Priority from wpautop must be before gallery
409
- * Bugfix : Added Screencolor to Widgets
410
- * Bugfix : Clean CSS class in setup.php
411
- * Bugfix : Change PHP short tag (Thx to Archedition)
412
- * Bugfix : Remove tab.png from CSS (Thx to Frisco)
413
- * Bugfix : Remove newline and encode quotes in Media-Upload (THX to Trip Mellinger)
414
-
415
- = V0.92 - 30.03.2008 =
416
- * Changed : Higher priority for filter in WP2.5 final
417
- * Changed : Do not increase memory_limit with ini_set
418
- * Added : Read EXIF field ImageDescription
419
-
420
- = V0.91 - 24.03.2008 =
421
- * Changed : Resample mode back to 3
422
- * Changed : Add DIV "ngg-singlepic-wrapper" for SingelPic (THX to Travel-Junkie)
423
- * Changed : Increase Tweakfactor for Memory Check
424
- * Bugfix : Use admin.css only on NextGEN pages (THX tp Oliver)
425
- * Bugfix : Updates widgets (V1.21) for ImageRotator 3.15
426
- * Bugfix : Change order of rewrite rules for WP 2.5
427
- * Bugfix : Include Dashboard CSS also for page "nextgen-gallery"
428
-
429
- = V0.90 - 18.03.2008 =
430
- * NEW : Sort order for images
431
- * NEW : Updated style for Wp 2.5
432
- * NEW : Media upload tab integration for WP 2.5
433
- * Added : Change wp shortcode filter
434
- * Added : TinyMCE V3 Button for WordPress 2.5
435
- * Added : Singlepic center class
436
- * Changed : New default parameter for ImageRotator 3.15
437
- * Changed : By default enable metadata import
438
- * Changed : Moved disable/enable flash setting to add gallery
439
- * Changed : wpdb->escape gallerytag in nggfunctions
440
- * Changed : Sort files after scan folder
441
- * Changed : Check for filename during upload
442
- * Changed : Remove jQuery plugin for navigation
443
- * Changed : Remove myGallery import
444
- * Changed : Resample mode default set to 5, causes problems at PHP 4.4.8 /PHP 5.2.4
445
- * Bugfix : nggextractXML missing stripslashes
446
- * Bugfix : P tags not closed in manage.php
447
- * Bugfix : Remove " from singlepic class
448
- * Bugfix : Rewrite rule for ImageBrowser added
449
-
450
- = V0.83 - 14.02.2008 =
451
- * Changed : New Interfaces.js from WP Core 2.5, for sortable bug under IE7
452
- * Changed : Update to jQuery V1.2.2, deregister older version from WP
453
- * Changed : Add ini_set 128MB for memory-limit
454
- * Bugfix : SWFUpload Cookie Post_Params are overwritten , no upload possible
455
- * Bugfix : WPMU options are not saved after installation
456
- * Bugfix : Remove Flush rewrite rules during install
457
-
458
- = V0.82 - 09.02.2008 =
459
- * Bugfix : add_filter (searchnggallerytags) not proper included for some other plugins
460
-
461
- = V0.81 - 04.02.2008 =
462
- * Changed : Use stristr first to reduce CPU cycles (THX to Alakhnor)
463
- * Changed : Flush Rewrites rules after option update
464
- * Changed : Rework for folder check under Safe-Mode
465
- * Bugfix : Check for array in get_option() (THX to Alessandro)
466
- * Bugfix : Add Cookie to SWFUpload, show Error code included
467
- * Bugfix : galShowOrder = Sildeshow at first didn't work
468
- * Bugfix : Remove reference from ngg_getOnlyImages
469
-
470
- = V0.80 - 02.02.2008 =
471
- * NEW : SWFUpload integrated : Show upload progress and select multiple files in the file browser dialog.
472
- * NEW : Progress bar for resize, watermark and thumbnail operation
473
- * NEW : Import Meta data from images
474
- * NEW : Show Meta data information
475
- * NEW : Cache option for SinglePic
476
- * NEW : Permalink support
477
- * NEW : Custom fields support - Change the settings for each post/page
478
- * Changed : Up to 10 Widgets, exclude galleries from random/recent images.
479
- * Changed : Refactor permission check for Safe-Mode Check and mkdir/chmod
480
- * Changed : Admin CSS in new folder/file for better structure
481
- * Changed : Clean up folder structure
482
- * Changed : Clean up code in manage.php, functions.php
483
- * Changed : Moved several functions into nggAdmin Class (functions.php)
484
- * Changed : Update to jQuery V1.1.4 (v1.2.1 causes problems with interface.js)
485
- * Changed : Hide used galleries in album admin page
486
- * Changed : Remove float in singlepic code and added class ngg-left , ngg-right (THX to Nathan Sylvain)
487
- * Changed : Edit style setting (added new class .desc , THX to Sebastian)
488
- * Changed : Check for galleryfolder instead name (THX to Luke Poland)
489
- * Changed : Delete images per default
490
- * Changed : Change CSS (ngg-album-compact) , remove width & height setting from code
491
- * Bugfix : Fixed static front page problem
492
- * Bugfix : Missing stripslashes & html_entity_decode
493
- * Bugfix : Change Album CSS (THX to Thomas-DK)
494
- * Bugfix : Watermark for GIF not correct supported
495
- * Bugfix : Missing wp_nonce at setup page
496
- * Bugfix : Add DIV in Slideshow link (for Safari & Opera)
497
- * Added : Screencolor flashvar for JW Image Rotator 3.13 or higher
498
- * Added : Set WP-CHARSET / COLLATE during installation
499
- * Added : Updated to Pclzip.lib.php v2.6
500
- * Added : CSS ID field for gallery & images
501
- * WPMU : New site admin page (wpmu.php)
502
- * WPMU : Integrated quota check
503
- * WPMU : No update check
504
- * WPMU : Remove edit style (THX to Kristin)
505
- * WPMU : Remove uninstall button
506
- * WPMU : Remove server settings
507
- * WPMU : Gallery path set to blog.dir
508
- * Added : Support for WPMU
509
-
510
- = V0.74 - 01.12.2007 =
511
- * NEW : Added meta reader class, first step to integrated meta data import
512
-
513
- = V0.73 - 20.10.2007 =
514
- * Added : Support for Shutter Reloaded
515
- * Update to jQuery Tabs 2.7.4
516
- * Changed : Remove $_SERVER['REQUEST_URI'] for IIS compatibility
517
- * Bugfix : Option Sildeshow didn't jump to overview
518
-
519
- = V0.72 - 13.09.2007 =
520
- * Added : Missing overflow:hidden in ngg-album.css
521
- * Added : New experimental stylesheet hovereffect.css
522
- * Changed : Better check for memory limit in zip-files
523
- * Bugfix : Missing stripslashes for alttext (THX to Lawrence)
524
- * Bugfix : Navigation didn't highlight page 1 (THX to Brot)
525
- * Bugfix : Albums automatic minimize if more than 4 galleries
526
- * Bugfix : Missing check_admin_referer in style (THX again to Christopher)
527
-
528
- = V0.71 - 07.09.2007 =
529
- * Added : Add defer="defer" to Slideshow to avoid IE crash (THX to Simbo)
530
- * Bugfix : Bugfix for slideshow to show all pictures
531
- * Bugfix : Wrong check_admin_referer in albums (THX to Christopher)
532
- * Bugfix : No exclude check in counter and widgets (THX to Christopher)
533
- * Bugfix : Check for existing role (THX to Lost in Network)
534
- * Bugfix : Label in roles are wrong (THX to Joern)
535
-
536
- = V0.70 - 06.09.2007 =
537
- * NEW : Add role manager page and capabilities
538
- * NEW : Show gallery with [tags=list of tags]
539
- * NEW : Show album with [albumtags=list of tags]
540
- * NEW : Tag system for all images
541
- * NEW : Option for append related images
542
- * NEW : Option to show description below thumbnail
543
- * NEW : Option to show ImageBrowser instead JS effect
544
- * Added : Add Full size link to thickbox
545
- * Added : Check for page/postid in tag processing
546
- * Added : Sildeshow widget can now contain all images
547
- * Added : Minimize/Maximize option for albums
548
- * Added : Deregister jQuery V1.1.2 for WP2.2 (to use V1.1.3.1)
549
- * Added : Integrate wp_nonce_field at all admin pages
550
- * Changed : Update to Thickbox 3.1 + mods for NextGEN gallery
551
- * Changed : Moved "clear:both" into class "ngg-clear" (THX to Gero)
552
- * Changed : Switched from jQuery Interface to jQuery Tabs from Klaus Hartl
553
- * Remove : Remove option for singlepic link
554
- * Remove : Remove options for imagebrowser
555
- * Bugfix : Most Recent image in Widget are wrong
556
- * Bugfix : More XHTML valid , htmlspecialchars() after add_query_arg()
557
- * Bugfix : Sanitize file name before upload
558
- * Bugfix : Sanitize folder name (THX to Tom Fowler)
559
- * Bugfix : Show title/alt in jQuery plugin (THX to Gregory Green)
560
- * Bugfix : i18n support for Gallery tab
561
- * Bugfix : Reduce memory-needs for plugin
562
- * Bugfix : Typo/spelling correction
563
- * Bugfix : Removed myGallery author from contribute list
564
-
565
- = V0.64 - 31.07.2007 =
566
- * Bugfix : Remove arrows in image browser text
567
- * Bugfix : Include nggadmintab.php with dirname
568
- * Bugfix : Zip-Upload under Mac > look for basename
569
-
570
- = V0.63 - 10.07.2007 =
571
- * NEW : You can now upload a zip file into a existing gallery
572
- * Added : Remove subfolder in Zip-files
573
- * Added : Show required memory for thumbnail creation
574
- * Added : Updated to jQuery.multifile 1.22
575
- * Added : Install-Upgrade for WordPress 2.3
576
- * Bugfix : Supress unlink error message for thumbs
577
- * Bugfix : Support upload of zip files from MAC
578
- * Bugfix : Add Stripslash for image description
579
- * Bugfix : Use for Singlepic not rel="Gallery name"
580
- * Bugfix : Moved RSS/Snoopy includes into function
581
-
582
- = V0.62 - 06.07.2007 =
583
- * NEW : Import for myGallery
584
- * Added : Updated to jQuery 1.1.3.1
585
- * Bugfix : Check for memory_limit setting, otherwise pass the test
586
- * Bugfix : Thumbcode not insert for nggDisplayRandomImages and nggDisplayRecentImages
587
-
588
- = V0.61 - 29.06.2007 =
589
- * Added : Forgot the file jquery.nextgen.pack.js and jquery.nextgen.js
590
-
591
- = V0.60 - 27.06.2007 =
592
- * NEW : Select a image from the Upload Tab
593
- * NEW : Tag [imagebrowser=id] for a Inline Gallery Browser
594
- * NEW : Show gallery without Subpages
595
- * NEW : Manage gallery : Function "Add a new page"
596
- * NEW : Manage gallery : Show/Hide thumbnails
597
- * Added : Slideshow option : Watermark / Background music
598
- * Added : Check for memory limit
599
- * Added : Show actual memory usage in overview
600
- * Added : Include function check in widget
601
- * Added : Latest Sidebar widget from KeViN
602
- * Added : Check for capability during installation
603
- * Changed : Remove P Tag around gallery tags ( THX to the work from John Godley )
604
- * Bugfix : Delete picture, check for pid
605
- * Bugfix : admin/settings.php line #172: typos corrected (this=these,maxium=maximum). (THX to Helene D.)
606
- * Bugfix : admin/settings.php line #311: missing </td> added. (THX to Helene D.)
607
-
608
- = V0.52 - 31.05.2007 =
609
- * Changed : Create better thubmnails in square mode (THX to Kees de Bruin)
610
- * Changed : Again , fixed ratio create better thumbnails (Also for widescreen photos)
611
- * Removed : Option "Resize image before cropping" removed and included in Create square thumbnail
612
- * Bugfix : Scan folder for new picture didn't set exclude = 0
613
- * Bugfix : If no option is checked in thumbnails, resize failed (THK to Joern Kretzschmar)
614
-
615
- = V0.51 - 28.05.2007 =
616
- * Bugfix : Thumbnail permission not set correct
617
- * Bugfix : Folder permission check wrong
618
- * Bugfix : Remove echo in album (THX to Lazy)
619
-
620
- = V0.50 - 28.05.2007 =
621
- * NEW : Select multiple files for upload (THX to Diego A., http://www.fyneworks.com)
622
- * NEW : Sidebar widget contain now Slideshow, recent images and random images
623
- * Added : New Option for Imagerotator 3.8 (Slow zoom effect)
624
- * Added : Option for CDATA wrapper (not working proper)
625
- * Added : Option for Thickbox Loading Image
626
- * Added : CSS file for dKret2 (THK to Joern)
627
- * Added : Better file permission check
628
- * Changed : Fixed ratio create better thumbnails in portrait mode
629
- * Changed : All jQuery scripts are now in "No Conflict" mode
630
- * Changed : Script loading now via wp_enqueue_script
631
- * Changed : Add constant values for folder/file permission
632
- * Changed : Use description in <A href title>
633
- * Bugfix : Remove wrong DIV tag in slideshow
634
- * Bugfix : Tag [Slideshow=id,width,height] didn't work proper
635
- * Bugfix : Name conflict in Album script (serialize) (THX to Die-Andis)
636
- * Bugfix : Changed check for CSS activation
637
- * Bugfix : Changed check for safe-mode (Don't ask)
638
-
639
- = V0.43 - 20.05.2007 =
640
- * Changed : Rename Thumbnail class to avoid php name collision
641
- * Bugfix : Missing translation flag in setup
642
- * Bugfix : Changed check for safe-mode
643
- * Bugfix : Changed check for Zip-File
644
-
645
- = V0.42 - 17.05.2007 =
646
- * Bugfix : Float function for singlepic not integrated, sorry !
647
- * Bugfix : Remove clear:both in widget
648
-
649
- = V0.41 - 17.05.2007 =
650
- * NEW : Sidebar widget from KeViN
651
- * Update : Better album management for more galleries
652
- * Update : Thickbox v3 integrated
653
- * Added : Float selection for singlepic
654
- * Added : CSS class for widget
655
- * Added : CSS file for K2 theme
656
- * Added : German translation (THX to Lazy)
657
- * Added : Better check for safe-mode
658
- * Added : CSS Class for single-pic : class="ngg-singlepic"
659
- * Added : Option to resize image before cropping it (Setting reset of prior versions needed! Setup -> Reset Settings)
660
- * Changed : Image quality by default 85% (THX to ArizonaGroovejet)
661
- * Bugfix : Update wrong file when select other style
662
- * Bugfix : Fixed Permalink in album (THX to Helene D.)
663
- * Bugfix : Scan folder in empty gallery
664
- * Bugfix : Swfobjects only added with Thickbox effect
665
- * Bugfix : Umlauts are now handled correctly
666
-
667
- = V0.40 - 29.04.2007 =
668
- * NEW : TinyMCE Button integration
669
- * Removed : CSS Style : remove width/height in album
670
-
671
- = V0.39 - 28.04.2007 =
672
- * Added : Set ORDER BY for gallery
673
- * Bugfix : check now for Exclude != 1
674
- * Bugfix : DB Query in function wrong
675
- * Bugfix : DB exlude = DEFAULT '0'
676
- * Bugfix : Scan folder in empty gallery
677
-
678
- = V0.38 - 28.04.2007 =
679
- * Bugfix : One time more remove get_settings :-)
680
- * Bugfix : $_GET in Manage gallery
681
- * Bugfix : exclude option
682
-
683
- = V0.37 - 28.04.2007 =
684
- * Bugfix : $_GET in Manage gallery
685
- * Bugfix : update DB installation routine
686
-
687
- = V0.36 - 26.04.2007 =
688
- * Bugfix : Stupid PHP beginner failure in album management
689
-
690
- = V0.35 - 26.04.2007 =
691
- * Rework : Folder name can be flexible
692
- * New option : Fullsize pic for Singlepic mode
693
- * New option : Select show order
694
- * Added : Check for WP2.1
695
- * Added : Check for permission for default folder
696
- * Bugfix : Remove get_settings
697
- * Bugfix : Correction for Safe-Mode ON
698
- * Bugfix : Set Default '0' for table album.sortorder
699
- * Bugfix : Update sort order
700
-
701
- = V0.34 - 24.04.2007 =
702
- * Added : Add fix ration setting
703
- * Added : Add language file file
704
- * Bugfix : Change link in Album to get_bloginfo('wpurl')
705
- * Bugfix : Album CSS file not loaded
706
-
707
- = V0.33 - 23.04.2007 =
708
- * NEW : Overview Page
709
- * NEW : Core function
710
- * NEW : Slideshow
 
 
 
 
 
 
 
 
1
+ NextGEN Gallery
2
+ by Photocrati Media
3
+
4
+ = V1.9.5 - 07.18.2012 =
5
+ * Changed: Branding changes following Photocrati acquisition (removed donation messages and updated links)
6
+ * Secured: Use WordPress-bundled JavaScript libraries for swfobject and swfupload instead of bundling our own
7
+ * Bugfix: Adjusted thickbox effect styling to ensure that the lightbox is always displayed in the foreground
8
+ * Bugfix: Fixed compatibility issues with Contact Form 7 and other plugins by following WordPress Plugin conventions
9
+ * Bugfix: Fixed network-wide activation in WordPress 3.4
10
+ * Bugfix: Plugin is no longer dependent on it's folder name
11
+
12
+ = V1.9.3 - 26.02.2012 =
13
+ * Bugfix : Ensure to set the slug for "all" albums
14
+ * Bugfix : Updated german translation ( THX to Roger Hunziker )
15
+ * Bugfix : Ensure error checking on IPTC array (THX to Kristian Edlund)
16
+ * Bugfix : Handle IE8 cached images better in slideshow
17
+ * Bugfix : Show album preview image if selected (THX to Kristian Edlund)
18
+
19
+ = V1.9.2 - 17.01.2012 =
20
+ * NEW : Added more XMLRPC commands (THX to Vladimir Vinogradsky)
21
+ * Changed : Rework Post-thumbnail function (THX to Kristian Edlund)
22
+ * Bugfix : Check first for valid images on unzip (only Mac OS zip-files)
23
+ * Bugfix : Increase z-index for twenty eleven theme
24
+ * Bugfix : Support non latin chars in tagcloud
25
+ * Bugfix : Allow other tinymce intance
26
+ * Bugfix : Better support for WPML translation
27
+
28
+ = V1.9.1 - 10.12.2011 =
29
+ * Bugfix : Security hardness for untrusted filenames/meta data (THX to Brian St. Pierre)
30
+ * Bugfix : Fixed security vulnerability (TXH to Jon Cave)
31
+ * Bugfix : Load piclens script via other function
32
+ * Bugfix : IE7 script fix for add gallery
33
+ * Bugfix : IE7/IE8 width set correctly for edit album autocomplete field
34
+
35
+ = V1.9.0 - 27.11.2011 =
36
+ * NEW : Keep images transparency for PNG and GIF format
37
+ * NEW : Switch to Plupload, support now HTML5 Upload (only with WordPress 3.3)
38
+ * NEW : Added client side resize feature (only with WordPress 3.3)
39
+ * NEW : Support for gallery templates in album shortcodes [ album id=x template="name" gallery="templatename" ]
40
+ * NEW : Added new hook ngg_delete_picture
41
+ * Changed : Updated to jQuery Cycle Version 2.9995
42
+ * Changed : Always cache the single pictures, remove option
43
+ * Bugfix : Couldn't use bulk operation for search results
44
+ * Bugfix : Bugfix for Edit thumbnails under IE 8 + 9
45
+ * Bugfix : Allow empty altext in ngg.editImage
46
+ * Bugfix : Various PHP notice fixes
47
+ * Bugfix : Resize fix for Shutter effect and mobile Browser
48
+ * Bugfix : FTP Import missing slug field into database
49
+ * Bugfix : Check also EXIF field "DateTimeOriginal" for timestamp
50
+
51
+ = V1.8.4 - 26.10.2011 =
52
+ * Bugfix : Fixed security vulnerability (TXH to Alain Schneider)
53
+
54
+ = V1.8.3 - 07.08.2011 =
55
+ * Changed : Support for simple custom permalink structures (i.e. /%category%/%postname%/)
56
+ * Bugfix : Sub-Albums in Albums didn't create the correct link
57
+ * Bugfix : AJAX Pagination didn't work anymore
58
+ * Bugfix : Adding index.php to home_url()
59
+ * Bugfix : Preview picture lost on backend gallery page 2 or higher
60
+
61
+ = V1.8.2 - 12.07.2011 =
62
+ * Bugfix : Set pagination variables for search result, otherwise update failed
63
+ * Bugfix : Update failed for paged galleries since WordPress 3.2
64
+
65
+ = V1.8.1 - 18.06.2011 =
66
+ * Bugfix : Special case for pagination, instead of showing page-1, we show the clean url
67
+ * Bugfix : Various PHP notice fixes
68
+ * Bugfix : Typo in rewrite rules
69
+ * Bugfix : Flush rewrite rules during upgrade later
70
+
71
+ = V1.8.0 - 12.06.2011 =
72
+ * NEW : Full rework of permalink url structure
73
+ * NEW : Adding Google Sitemaps for Images (require WordPress SEO plugin by YOAST )
74
+ * NEW : Support for WPML ( WordPress Multilingual Plugin )
75
+ * NEW : Adding support for arrow key in shutter effect (THX to Flyvans)
76
+ * NEW : Adding sort operation for galleries overview page
77
+ * Changed : Updated pagination to new WP3.1 style
78
+ * Bugfix : Create unique slug in a better way
79
+ * Bugfix : Rework screen options filter for gallery and image table
80
+ * Bugfix : Empty values in XMLRPC update calls are ignored
81
+ * Bugfix : Create gallery failed when safe-mode on
82
+ * Bugfix : Permalink didn't work in combination with album & imagebrowser
83
+
84
+ = V1.7.4 - 15.02.2011 =
85
+ * Bugfix : Disallow direct call of ajax file to avoid path disclosure (THX to High-Tech Bridge SA)
86
+ * Bugfix : Rework jQuery Cycle slideshow for IE compat reason (THX to Justin Dickenson)
87
+ * Bugfix : Resize only larger images in slideshow
88
+ * Bugfix : Improved image format detection in gd.thumbnail class (THX to Kupar.b)
89
+
90
+ = V1.7.3 - 20.01.2011 =
91
+ * NEW : Introduce plugin health check for conflicts with other plugins/themes
92
+ * NEW : Adding new XMLRPC method ngg.deleteImage
93
+ * NEW : Adding new XMLRPC method ngg.editImage
94
+ * Changed : Rework register script for autocomplete feature
95
+ * Bugfix : Bugfix for Multisite setup and flash upload
96
+ * Bugfix : WP3.1 compat issue, show site admin page only on Multisite installation
97
+
98
+ = V1.7.2 - 13.12.2010 =
99
+ * Bugfix : Adding images to database require slug
100
+
101
+ = V1.7.1 - 13.12.2010 =
102
+ * Changed : Disable upgrade for PHP4 user
103
+ * Changed : Disable colorpicker for option page
104
+ * Bugfix : Compat fix for upgrade
105
+
106
+ = V1.7.0 - 11.12.2010 =
107
+ * NEW : Publish a new post direct from the gallery admin page
108
+ * NEW : Added filter hook 'ngg_get_image_metadata' to add more exif/iptc information
109
+ * NEW : Adding Autocomplete field to TinyMCE Popup and Album page
110
+ * NEW : More methods for XMLRPC interface
111
+ * Changed : New hooks for gallery table (THX to Alexander Schneider)
112
+ * Changed : Introduce jQuery dialog as new UI element
113
+ * Changed : Call TinyMCE window via admin-ajax
114
+ * Bugfix : Better support for SSL blogs
115
+ * Bugfix : Install/Upgrade failed when table prefix contain captial letters
116
+ * Bugfix : Fix validation issues in Media-RSS
117
+ * Bugfix : Empty tags in XMP Meta causes PHP error
118
+ * Bugfix : Rework load mechanism for slideshow
119
+ * Bugfix : Copy meta data when image is copied
120
+ * Bugfix : Icon Support for Ozh' Admin Drop Down Menu
121
+ * Bugfix : Use correct sort order in slideshow
122
+
123
+ = V1.6.2 - 19.09.2010 =
124
+ * NEW : Added constant NGG_SKIP_LOAD_SCRIPTS to avoid script load
125
+ * Bugfix : Load Tags library with core files
126
+ * Bugfix : Slideshow script failed in IE7, load script now in header
127
+ * Bugfix : Load slideshow widget always
128
+ * Changed : New admin notice for database upgrade
129
+ * Changed : Rework crop feature for featured images
130
+ * Changed : Use site_url() instead get_option ('siteurl'), required for SSL support
131
+
132
+ = V1.6.1 - 08.09.2010 =
133
+ * Bugfix : Script load of swfobject.js failed
134
+ * Bugfix : Show sideshow also with 1 or 2 images
135
+ * Bugfix : Rework null byte check in zip upload
136
+
137
+ = V1.6.0 - 07.09.2010 =
138
+ * NEW : Wordpress 3.0 Network (Multi-Site) support
139
+ * NEW : Integrate jQuery Cycle as NON-Flash slideshow
140
+ * NEW : Adding jQuery File Tree for import folder (THX to Sergey Pasyuk )
141
+ * NEW : Added action hook 'ngg_show_imagebrowser_first' on custom request
142
+ * NEW : Added filter hook 'ngg_slideshow_size' to resize sildeshow for mobile browser plugins
143
+ * Changed : Reorder tabs for upload
144
+ * Changed : New menu icon and screen icon (THX to Ben Dunkle)
145
+ * Changed : Load frontend libs always
146
+ * Changed : Rework of overview page
147
+ * Bugfix : Security bugfix for Zip-Upload (THX to Dominic Szablewski)
148
+ * Bugfix : Allow JPG, PNG, GIF extension
149
+ * Bugfix : New German translation (THX to Martin Kramarz)
150
+ * Bugfix : Copy/Move also backup file
151
+ * Bugfix : Calculate correct ratio for fix thumbnail size (THX to Alekz Keck)
152
+
153
+ = V1.5.5 - 14.06.2010 =
154
+ * Bugfix : Compat issue for post thumbnails with WP2.9
155
+ * NEW : Adding more hooks for custom fields plugin
156
+
157
+ = V1.5.4 - 14.06.2010 =
158
+ * Bugfix : No resize of smaller images
159
+ * Bugfix : Compat issues for Post Thumbnails under WP3.0
160
+ * Bugfix : Esc_URL in Media RSS
161
+
162
+ = V1.5.3 - 11.04.2010 =
163
+ * New : Adding pagination to footer
164
+ * Changed : Prepare new filter to replace slideshow
165
+ * Bugfix : Remove non-breaking space from navigation
166
+ * Bugfix : Pagination of galleries
167
+ * Bugfix : Fixed brackets position for old shortcode query
168
+ * Bugfix : Slideshow option 'Show next image on click" has wrong default value
169
+
170
+ = V1.5.2 - 25.03.2010 =
171
+ * Bugfix : XSS security vulnerability (THX to Core Security Advisories Team , Pedro Varangot)
172
+ * Bugfix : Missing $wpdb in shortcodes.php
173
+
174
+ = V1.5.1 - 23.03.2010 =
175
+ * Bugfix : PHP4 compat issue for Add gallery & options page
176
+ * Bugfix : Gallery widget can now have a empty title
177
+ * Bugfix : Adding correct stripslash for gallery title
178
+
179
+ = V1.5.0 - 18.03.2010 =
180
+ * NEW : Support for Post thumbnail feature
181
+ * NEW : Backup and Recover function for images (THX to Simone Fumagalli)
182
+ * NEW : Resize images after upload (THX to Simone Fumagalli)
183
+ * NEW : Added a JSON class for fetching galleries in a RESTful way (see xml/json.php)
184
+ * NEW : Adding various new capabilities for user roles
185
+ * NEW : Auto downloader for translation file
186
+ * Changed : Rename query var from slideshow to callback for compat reason with other plugin
187
+ * Changed : Convert widget function to new WP structure
188
+ * Changed : Include lookup for tags into the backend search
189
+ * Changed : Restructure addgallery and settings page to enable custom tabs
190
+ * Bugfix : Select album preview from gallery preview pics instead random list
191
+ * Bugfix : Keep fix dimension in edit thumbnail operation
192
+ * Bugfix : Import meta data didn't work correct for existing images
193
+ * Bugfix : Fix onload bug for Chrome 4 in Shutter script
194
+ * Bugfix : Remove various PHP notices for a better world
195
+ * Removed : Canonical link is now part of Wordpress 2.9
196
+
197
+ = V1.4.3 - 16.11.2009 =
198
+ * Bugfix : Urlencode XML file path for sildeshow
199
+
200
+ = V1.4.2 - 16.11.2009 =
201
+ * Changed : Load sildeshow XML not longer via relative path
202
+ * Bugfix : No imagebrowser in carousel mode
203
+ * Bugfix : JS Effect navigation based on wrong array structure
204
+ * Bugfix : Remove whitespaces from meta import
205
+ * Bugfix : Capability check for upgrade notice
206
+ * Removed : Hide "more settings" for now, causes problems with IE and jQuery UI tabs
207
+
208
+ = V1.4.1 - 10.11.2009 =
209
+ * Bugfix : Capabilites could not be saved
210
+ * Bugfix : Ajax pagination option not saved
211
+ * Bugfix : echo nggSlideshowWidget() for compat reason
212
+
213
+ = V1.4.0 - 08.11.2009 =
214
+ * NEW : Automatic rotate images during upload or via manage gallery page (THX to Simone Fumagalli)
215
+ * NEW : Include Bulkupdate for gallery overview, require PHP 5.2
216
+ * NEW : XMLRPC support with 4 new methods : see xmlrpc.php for more information
217
+ * NEW : Recent and random images can be taken from a specific gallery using the id=x parameter in the shortcode (THX to Prollius)
218
+ * NEW : Recent images can be recent by exif date (instead of database id) by using the mode=recentdate parameter in the shortcode (THX to Prollius)
219
+ * NEW : Introduce the WP_Object_cache and meta_data
220
+ * NEW : Various new hooks and filters
221
+ * Added : Better support for role manager plugin (THX to Mattias Buelens)
222
+ * Added : New option to add hidden images. Needed to show all images in a modal window (Thickbox, Lightbox et.)
223
+ * Added : New link parameter for the singlepic shortcode : [singlepic id=x w=x h=x link="http://google.com"]
224
+ * Added : New template gallery-carousel
225
+ * Added : New id parameter for recent and random shortcodes : [random max="7" template="filename" id="2"] takes only pictures from the gallery with id=2
226
+ * Added : New mode parameter for recent shortcode : [recent max="7" template="filename" id="3" mode="date" /] where mode can be one of (id, date, sort). Recent pictures are delivered by addition to database (id), exif date (date) or user sort order (sort).
227
+ * Added : Enable/Disable Ajax navigation via settings
228
+ * Added : New filter hook 'ngg_render_template' to render templates with a other plugin
229
+ * Changed : Added option to link an album with a page id
230
+ * Changed : Support templates for child themes, use STYLESHEETPATH instead TEMPLATEPATH (THX to Prollius)
231
+ * Changed : Rework of Media RSS Widget
232
+ * Bugfix : Check capability to create a new page
233
+ * Bugfix : Fix double call of filter name , changed to ngg_picturelist_object (THX to Prollius)
234
+ * Bugfix : Check for a deleted gallery in a album
235
+
236
+ = V1.3.6 - 20.09.2009 =
237
+ * Changed : Just change the feed link
238
+
239
+ = V1.3.5 - 17.07.2009 =
240
+ * Bugfix : Fixed XSS issue for Page title
241
+
242
+ = V1.3.4 - 07.07.2009 =
243
+ * Added : New filter ngg_gallery_object and ngg_image_object
244
+ * Bugfix : Fix double rendering of a gallery if two album shortcodes are used
245
+ * Bugfix : Fix for custom field ngg_gal_sort
246
+ * Bugfix : Changed capability check for upload
247
+ * Bugfix : Check for correct version OR memory limit
248
+
249
+ = V1.3.3 - 11.06.2009 =
250
+ * Changed : Load Thickbox images via wp_footer()
251
+ * Bugfix : Widget setting couldnot be saved
252
+
253
+ = V1.3.2 - 10.06.2009 =
254
+ * Changed : Resize maximum to 1280 x 1280 with nggshow (THX to onezero)
255
+ * Bugfix : Bugfix for Multifile upload
256
+ * Bugfix : Bugfix for sortorder under jQuery 1.3
257
+ * Bugfix : Workaround for more albums per page, need more rework
258
+ * Bugfix : AJAX reload didn't work if slideshow is shown by default
259
+ * Bugfix : Redirect links didn't work if permalinks are deactivates
260
+ * Bugfix : Add new gallery in manage-overview didn't use defaultpath
261
+
262
+ = V1.3.1 - 07.06.2009 =
263
+ * Bugfix : Fixed ZIP upload, wrong variable used
264
+ * Bugfix : Check for array before foreach in album missing
265
+
266
+ = V1.3.0 - 07.06.2009 =
267
+ * NEW : Subalbum support
268
+ * NEW : Search for images in the admin tab
269
+ * NEW : Add new gallery also in manage tab
270
+ * NEW : AJAX support for Imagebrowser and gallery navigation (THX to Anty)
271
+ * NEW : Added zip upload via URL (THX to Juan Jose Galvez)
272
+ * Added : jQuery Multiple File Upload Plugin v1.44
273
+ * Added : SWFUpload V2.2.0
274
+ * Changed : Remove extension for Alttext during first import
275
+ * Changed : Meta tag added via wp_head hook (THX to Viper)
276
+ * Bugfix : Correct various PHP notice messages
277
+ * Bugfix : Typo fix in custom fields for ngg_gal_ImageBrowser
278
+ * Bugfix : Avoid upload of images in gallery without correct capability
279
+
280
+ = V1.2.1 - 22.03.2009 =
281
+ * NEW : Support for IE8 Web Slices in widgets
282
+ * NEW : Add filter ngg_image_object
283
+ * Changed : Descending order in add gallery menu
284
+ * Bugfix : Exclude option didnT work for multi pages
285
+ * Bugfix : Check for correct capability in manage gallery
286
+
287
+ = V1.2.0 - 09.03.2009 =
288
+ * NEW : Support for image tag cloud with shortcode [tagcloud]
289
+ * NEW : Adding shortcode [recent max="7" template="filename" /] & [random max="7" template="filename" /] to show the most recent/random pictures (THX to Bernhard)
290
+ * NEW : Crop thumbnails manually (THX to Simone Fumagalli)
291
+ * NEW : Support for i18n with polyglot or qtrans plugin (THX to Boris Glumpler)
292
+ * NEW : Canonical meta link support
293
+ * Added : SWFUpload V2.2.0 B5
294
+ * Added : New memory limit check in upload screen
295
+ * Bugfix : Language typo fixes
296
+ * Bugfix : Admin Pagination fix
297
+ * Bugfix : Typo fix in widgets
298
+ * Bugfix : Init column script after document is ready
299
+ * Bugfix : htmlspecialchars() instead htmlentities() for links in the a href title description
300
+ * Bugfix : Upgrade routine didn't add sortorder to correct table (THX to Uwe)
301
+ * Bugfix : Correct shotcode in media upload tab
302
+
303
+ = V1.1.0 - 26.01.2009 =
304
+ * NEW : Pagination for album page via custom fields ('ngg_paged_Galleries')
305
+ * NEW : Support for fixed number of columns inside the gallery
306
+ * NEW : Added pagination for galleries and images in admin section
307
+ * NEW : New action hook after image is added to database, called 'ngg_added_new_image'
308
+ * NEW : New template for caption below images, called via [nggallery id=x template=caption]
309
+ * Added : SWFUpload V2.2.0 B4
310
+ * Changed : Rework of Manage image tables
311
+ * Changed : Move imagerotator.swf to wp-content/uploads
312
+ * Changed : Added a URL field to setup the path to the Imagerotator
313
+ * Changed : Add additional parameter to gallery object
314
+ * Changed : Load donators list external
315
+ * Bugfix : Style fixes for tables in IE7
316
+ * Bugfix : All albums code couldn't use the slideshow, query is empty for 0
317
+ * Bugfix : Htmlentities() for links in the a href title description
318
+ * Bugfix : Clean up mode for singlepic
319
+ * Bugfix : Typo in widget settings
320
+
321
+ = V1.0.2 - 19.12.2008 =
322
+ * Added : Option to enable/disable the MediaRSS Feed
323
+ * Added : For flash under FF3/WIN we should use outline: none;
324
+ * Added : Use sort order also for Media RSS
325
+ * Changed : Descending order for TinyMCE Editor
326
+ * Changed : Added screencolor flashvar as bgcolor for the flash slideshow
327
+ * Changed : Remove link to gallery in sidebar widget
328
+ * Bugfix : Check for empty gallery title and show name instead
329
+ * Bugfix : Album id=all / Album id=0 didn't show content
330
+ * Bugfix : Check for a empty description and alttext
331
+ * Bugfix : Remove HTML tags from slideshow
332
+ * Bugfix : Load SWFobject always when the imagerotator exist
333
+ * Bugfix : Zip-Upload in existing gallery failed
334
+ * Bugifx : Typo in functions.php (THX to David Horat)
335
+
336
+ = V1.0.1 - 11.12.2008 =
337
+ * Bugfix : Change upgrade routine, import_date_time could cause a memory problem
338
+ * Bugfix : Help pages will not show up in non-english enviroment
339
+ * Bugfix : Show gallery name if title is empty
340
+
341
+ = V1.0.0 - 11.12.2008 =
342
+ * NEW : Adding some rewrite rules for the Blog title for a better SEO (Will be continued...)
343
+ * NEW : Added ImageMagick support (currently a bit experimental) (THX to Frederic de Ranter)
344
+ * NEW : Automatic unistall via register_uninstall_hook()
345
+ * NEW : Added a presort option to sort easier the images
346
+ * NEW : Lookup for a nggallery.css in the theme folder
347
+ * NEW : Added Date/Time field to database and import it from EXIF, new sort option
348
+ * NEW : Multi Widgets to show links to Media RSS feeds (THX to Vincent Prat)
349
+ * NEW : PicLens support for galleries (THX to Vincent Prat)
350
+ * NEW : Copy/Move images between galleries (THX to Vincent Prat)
351
+ * NEW : Media RSS feeds (either for galleries, albums or global) (THX to Vincent Prat)
352
+ * NEW : Image tag management (THX to Vincent Prat)
353
+ * NEW : Convert all shortcodes to WP shortcodes API
354
+ * NEW : AJAX based thumbnail generator
355
+ * NEW : Create output via template files, more flexible and support for multiple templates
356
+ * NEW : Extended role system. Each gallery has now a author
357
+ * NEW : [thumb id="4,5,12,..."] shortcode. You can now insert thumbnails for one or more images (that are not necessarly inside the same gallery).
358
+ * Changed : Add swfupload 2.2.0. Support for Adobe Flash 10 upload
359
+ * Changed : Update all Admin pages for Wordpress 2.7 Admin UI
360
+ * Changed : New icon for TinyMCE and WP2.7 Menue from http://www.pinvoke.com/
361
+ * Changed : Move update message to admin.php
362
+ * Changed : Widgets are now core and doesn't need to be activate, rework as Multi Widgets
363
+ * Changed : Improved the gallery management page.
364
+ * Changed : Rename the filter 'ngg_create_gallery_thumbcode' to 'ngg_get_thumbcode'.
365
+ * Changed : Convert tags to WP-Taxonomy tables, no more need for ngg_tags, ngg_pic2tags
366
+ * Changed : Arrange manage fields in a new way
367
+ * Changed : Support now SSL
368
+ * Changed : Use JQuery UI instead of interface lib
369
+ * Changed : Updated to swfobject 2.1
370
+ * Changed : Rework of database queries and new central nggdb class
371
+ * Bugfix : Changed CSS for singlepic padding to margin
372
+ * Bugfix : Check for zero in Exif Focal Length
373
+ * Bugfix : Round instead inval for square thumbnails
374
+ * Removed : Do not longer check for myGallery folders
375
+ * Removed : Use now PclZip from WP Core
376
+ * Removed : Wordpress 2.1 - 2.3 files deleted
377
+
378
+ = V0.99 - 27.09.2008 =
379
+ * Changed : Included swfobject version 2.1
380
+ * Bugfix : Recognize the zip better
381
+ * Bugfix : Limit the length of the title in the media-upload
382
+ * Bugfix : Round instead inval for square thumbnails
383
+
384
+ = V0.98 - 15.07.2008 =
385
+ * Bugfix : Removed all whitespaces at EOF
386
+
387
+ = V0.97 - 10.07.2008 =
388
+ * Changed : Get new path contstant from WP2.6
389
+ * Changed : Minor updates for WP2.6
390
+ * Changed : Added new filters (THX to Vincent Prat)
391
+ * Removed : Revert singlepic wrapper, breaks validation
392
+
393
+ = V0.96 - 18.05.2008 =
394
+ * Changed : Use postbox for gallery settings
395
+ * Added : New filter function to add custom columns
396
+ * Bugfix : Fixed width for Thickbox in Manage gallery
397
+ * Bugfix : fixed width for media upload select box
398
+ * Bugfix : Remove <p> tag in singlepic regex
399
+ * Bugfix : Correct format of shutter speed
400
+ * Bugfix : Album name in Short code not useable
401
+
402
+ = V0.95 - 25.04.2008 =
403
+ * Bugfix : Correction in media-upload to fit with Wordpress 2.5.1
404
+ * Bugfix : Attribute_escape all objects in media-upload
405
+ * Bugfix : Correct sortorder for albums
406
+ * Bugfix : Typo correction (THX to Momo-I)
407
+
408
+ = V0.94 - 20.04.2008 =
409
+ * Added : New filter option ngg_create_gallery_link
410
+ * Changed : Reduce amount of DB queries in albums (Big THX to Alexandr Kindras)
411
+ * Changed : Revert wpautop priority change. Doesn't good for other plugins
412
+
413
+ = V0.93 - 12.04.2008 =
414
+ * Added : Select Full-Size or Singlepic in Media Upload
415
+ * Added : Check for minimum 8 MB Memory
416
+ * Changed : Priority from wpautop must be before gallery
417
+ * Bugfix : Added Screencolor to Widgets
418
+ * Bugfix : Clean CSS class in setup.php
419
+ * Bugfix : Change PHP short tag (Thx to Archedition)
420
+ * Bugfix : Remove tab.png from CSS (Thx to Frisco)
421
+ * Bugfix : Remove newline and encode quotes in Media-Upload (THX to Trip Mellinger)
422
+
423
+ = V0.92 - 30.03.2008 =
424
+ * Changed : Higher priority for filter in WP2.5 final
425
+ * Changed : Do not increase memory_limit with ini_set
426
+ * Added : Read EXIF field ImageDescription
427
+
428
+ = V0.91 - 24.03.2008 =
429
+ * Changed : Resample mode back to 3
430
+ * Changed : Add DIV "ngg-singlepic-wrapper" for SingelPic (THX to Travel-Junkie)
431
+ * Changed : Increase Tweakfactor for Memory Check
432
+ * Bugfix : Use admin.css only on NextGEN pages (THX tp Oliver)
433
+ * Bugfix : Updates widgets (V1.21) for ImageRotator 3.15
434
+ * Bugfix : Change order of rewrite rules for WP 2.5
435
+ * Bugfix : Include Dashboard CSS also for page "nextgen-gallery"
436
+
437
+ = V0.90 - 18.03.2008 =
438
+ * NEW : Sort order for images
439
+ * NEW : Updated style for Wp 2.5
440
+ * NEW : Media upload tab integration for WP 2.5
441
+ * Added : Change wp shortcode filter
442
+ * Added : TinyMCE V3 Button for WordPress 2.5
443
+ * Added : Singlepic center class
444
+ * Changed : New default parameter for ImageRotator 3.15
445
+ * Changed : By default enable metadata import
446
+ * Changed : Moved disable/enable flash setting to add gallery
447
+ * Changed : wpdb->escape gallerytag in nggfunctions
448
+ * Changed : Sort files after scan folder
449
+ * Changed : Check for filename during upload
450
+ * Changed : Remove jQuery plugin for navigation
451
+ * Changed : Remove myGallery import
452
+ * Changed : Resample mode default set to 5, causes problems at PHP 4.4.8 /PHP 5.2.4
453
+ * Bugfix : nggextractXML missing stripslashes
454
+ * Bugfix : P tags not closed in manage.php
455
+ * Bugfix : Remove " from singlepic class
456
+ * Bugfix : Rewrite rule for ImageBrowser added
457
+
458
+ = V0.83 - 14.02.2008 =
459
+ * Changed : New Interfaces.js from WP Core 2.5, for sortable bug under IE7
460
+ * Changed : Update to jQuery V1.2.2, deregister older version from WP
461
+ * Changed : Add ini_set 128MB for memory-limit
462
+ * Bugfix : SWFUpload Cookie Post_Params are overwritten , no upload possible
463
+ * Bugfix : WPMU options are not saved after installation
464
+ * Bugfix : Remove Flush rewrite rules during install
465
+
466
+ = V0.82 - 09.02.2008 =
467
+ * Bugfix : add_filter (searchnggallerytags) not proper included for some other plugins
468
+
469
+ = V0.81 - 04.02.2008 =
470
+ * Changed : Use stristr first to reduce CPU cycles (THX to Alakhnor)
471
+ * Changed : Flush Rewrites rules after option update
472
+ * Changed : Rework for folder check under Safe-Mode
473
+ * Bugfix : Check for array in get_option() (THX to Alessandro)
474
+ * Bugfix : Add Cookie to SWFUpload, show Error code included
475
+ * Bugfix : galShowOrder = Sildeshow at first didn't work
476
+ * Bugfix : Remove reference from ngg_getOnlyImages
477
+
478
+ = V0.80 - 02.02.2008 =
479
+ * NEW : SWFUpload integrated : Show upload progress and select multiple files in the file browser dialog.
480
+ * NEW : Progress bar for resize, watermark and thumbnail operation
481
+ * NEW : Import Meta data from images
482
+ * NEW : Show Meta data information
483
+ * NEW : Cache option for SinglePic
484
+ * NEW : Permalink support
485
+ * NEW : Custom fields support - Change the settings for each post/page
486
+ * Changed : Up to 10 Widgets, exclude galleries from random/recent images.
487
+ * Changed : Refactor permission check for Safe-Mode Check and mkdir/chmod
488
+ * Changed : Admin CSS in new folder/file for better structure
489
+ * Changed : Clean up folder structure
490
+ * Changed : Clean up code in manage.php, functions.php
491
+ * Changed : Moved several functions into nggAdmin Class (functions.php)
492
+ * Changed : Update to jQuery V1.1.4 (v1.2.1 causes problems with interface.js)
493
+ * Changed : Hide used galleries in album admin page
494
+ * Changed : Remove float in singlepic code and added class ngg-left , ngg-right (THX to Nathan Sylvain)
495
+ * Changed : Edit style setting (added new class .desc , THX to Sebastian)
496
+ * Changed : Check for galleryfolder instead name (THX to Luke Poland)
497
+ * Changed : Delete images per default
498
+ * Changed : Change CSS (ngg-album-compact) , remove width & height setting from code
499
+ * Bugfix : Fixed static front page problem
500
+ * Bugfix : Missing stripslashes & html_entity_decode
501
+ * Bugfix : Change Album CSS (THX to Thomas-DK)
502
+ * Bugfix : Watermark for GIF not correct supported
503
+ * Bugfix : Missing wp_nonce at setup page
504
+ * Bugfix : Add DIV in Slideshow link (for Safari & Opera)
505
+ * Added : Screencolor flashvar for JW Image Rotator 3.13 or higher
506
+ * Added : Set WP-CHARSET / COLLATE during installation
507
+ * Added : Updated to Pclzip.lib.php v2.6
508
+ * Added : CSS ID field for gallery & images
509
+ * WPMU : New site admin page (wpmu.php)
510
+ * WPMU : Integrated quota check
511
+ * WPMU : No update check
512
+ * WPMU : Remove edit style (THX to Kristin)
513
+ * WPMU : Remove uninstall button
514
+ * WPMU : Remove server settings
515
+ * WPMU : Gallery path set to blog.dir
516
+ * Added : Support for WPMU
517
+
518
+ = V0.74 - 01.12.2007 =
519
+ * NEW : Added meta reader class, first step to integrated meta data import
520
+
521
+ = V0.73 - 20.10.2007 =
522
+ * Added : Support for Shutter Reloaded
523
+ * Update to jQuery Tabs 2.7.4
524
+ * Changed : Remove $_SERVER['REQUEST_URI'] for IIS compatibility
525
+ * Bugfix : Option Sildeshow didn't jump to overview
526
+
527
+ = V0.72 - 13.09.2007 =
528
+ * Added : Missing overflow:hidden in ngg-album.css
529
+ * Added : New experimental stylesheet hovereffect.css
530
+ * Changed : Better check for memory limit in zip-files
531
+ * Bugfix : Missing stripslashes for alttext (THX to Lawrence)
532
+ * Bugfix : Navigation didn't highlight page 1 (THX to Brot)
533
+ * Bugfix : Albums automatic minimize if more than 4 galleries
534
+ * Bugfix : Missing check_admin_referer in style (THX again to Christopher)
535
+
536
+ = V0.71 - 07.09.2007 =
537
+ * Added : Add defer="defer" to Slideshow to avoid IE crash (THX to Simbo)
538
+ * Bugfix : Bugfix for slideshow to show all pictures
539
+ * Bugfix : Wrong check_admin_referer in albums (THX to Christopher)
540
+ * Bugfix : No exclude check in counter and widgets (THX to Christopher)
541
+ * Bugfix : Check for existing role (THX to Lost in Network)
542
+ * Bugfix : Label in roles are wrong (THX to Joern)
543
+
544
+ = V0.70 - 06.09.2007 =
545
+ * NEW : Add role manager page and capabilities
546
+ * NEW : Show gallery with [tags=list of tags]
547
+ * NEW : Show album with [albumtags=list of tags]
548
+ * NEW : Tag system for all images
549
+ * NEW : Option for append related images
550
+ * NEW : Option to show description below thumbnail
551
+ * NEW : Option to show ImageBrowser instead JS effect
552
+ * Added : Add Full size link to thickbox
553
+ * Added : Check for page/postid in tag processing
554
+ * Added : Sildeshow widget can now contain all images
555
+ * Added : Minimize/Maximize option for albums
556
+ * Added : Deregister jQuery V1.1.2 for WP2.2 (to use V1.1.3.1)
557
+ * Added : Integrate wp_nonce_field at all admin pages
558
+ * Changed : Update to Thickbox 3.1 + mods for NextGEN gallery
559
+ * Changed : Moved "clear:both" into class "ngg-clear" (THX to Gero)
560
+ * Changed : Switched from jQuery Interface to jQuery Tabs from Klaus Hartl
561
+ * Remove : Remove option for singlepic link
562
+ * Remove : Remove options for imagebrowser
563
+ * Bugfix : Most Recent image in Widget are wrong
564
+ * Bugfix : More XHTML valid , htmlspecialchars() after add_query_arg()
565
+ * Bugfix : Sanitize file name before upload
566
+ * Bugfix : Sanitize folder name (THX to Tom Fowler)
567
+ * Bugfix : Show title/alt in jQuery plugin (THX to Gregory Green)
568
+ * Bugfix : i18n support for Gallery tab
569
+ * Bugfix : Reduce memory-needs for plugin
570
+ * Bugfix : Typo/spelling correction
571
+ * Bugfix : Removed myGallery author from contribute list
572
+
573
+ = V0.64 - 31.07.2007 =
574
+ * Bugfix : Remove arrows in image browser text
575
+ * Bugfix : Include nggadmintab.php with dirname
576
+ * Bugfix : Zip-Upload under Mac > look for basename
577
+
578
+ = V0.63 - 10.07.2007 =
579
+ * NEW : You can now upload a zip file into a existing gallery
580
+ * Added : Remove subfolder in Zip-files
581
+ * Added : Show required memory for thumbnail creation
582
+ * Added : Updated to jQuery.multifile 1.22
583
+ * Added : Install-Upgrade for WordPress 2.3
584
+ * Bugfix : Supress unlink error message for thumbs
585
+ * Bugfix : Support upload of zip files from MAC
586
+ * Bugfix : Add Stripslash for image description
587
+ * Bugfix : Use for Singlepic not rel="Gallery name"
588
+ * Bugfix : Moved RSS/Snoopy includes into function
589
+
590
+ = V0.62 - 06.07.2007 =
591
+ * NEW : Import for myGallery
592
+ * Added : Updated to jQuery 1.1.3.1
593
+ * Bugfix : Check for memory_limit setting, otherwise pass the test
594
+ * Bugfix : Thumbcode not insert for nggDisplayRandomImages and nggDisplayRecentImages
595
+
596
+ = V0.61 - 29.06.2007 =
597
+ * Added : Forgot the file jquery.nextgen.pack.js and jquery.nextgen.js
598
+
599
+ = V0.60 - 27.06.2007 =
600
+ * NEW : Select a image from the Upload Tab
601
+ * NEW : Tag [imagebrowser=id] for a Inline Gallery Browser
602
+ * NEW : Show gallery without Subpages
603
+ * NEW : Manage gallery : Function "Add a new page"
604
+ * NEW : Manage gallery : Show/Hide thumbnails
605
+ * Added : Slideshow option : Watermark / Background music
606
+ * Added : Check for memory limit
607
+ * Added : Show actual memory usage in overview
608
+ * Added : Include function check in widget
609
+ * Added : Latest Sidebar widget from KeViN
610
+ * Added : Check for capability during installation
611
+ * Changed : Remove P Tag around gallery tags ( THX to the work from John Godley )
612
+ * Bugfix : Delete picture, check for pid
613
+ * Bugfix : admin/settings.php line #172: typos corrected (this=these,maxium=maximum). (THX to Helene D.)
614
+ * Bugfix : admin/settings.php line #311: missing </td> added. (THX to Helene D.)
615
+
616
+ = V0.52 - 31.05.2007 =
617
+ * Changed : Create better thubmnails in square mode (THX to Kees de Bruin)
618
+ * Changed : Again , fixed ratio create better thumbnails (Also for widescreen photos)
619
+ * Removed : Option "Resize image before cropping" removed and included in Create square thumbnail
620
+ * Bugfix : Scan folder for new picture didn't set exclude = 0
621
+ * Bugfix : If no option is checked in thumbnails, resize failed (THK to Joern Kretzschmar)
622
+
623
+ = V0.51 - 28.05.2007 =
624
+ * Bugfix : Thumbnail permission not set correct
625
+ * Bugfix : Folder permission check wrong
626
+ * Bugfix : Remove echo in album (THX to Lazy)
627
+
628
+ = V0.50 - 28.05.2007 =
629
+ * NEW : Select multiple files for upload (THX to Diego A., http://www.fyneworks.com)
630
+ * NEW : Sidebar widget contain now Slideshow, recent images and random images
631
+ * Added : New Option for Imagerotator 3.8 (Slow zoom effect)
632
+ * Added : Option for CDATA wrapper (not working proper)
633
+ * Added : Option for Thickbox Loading Image
634
+ * Added : CSS file for dKret2 (THK to Joern)
635
+ * Added : Better file permission check
636
+ * Changed : Fixed ratio create better thumbnails in portrait mode
637
+ * Changed : All jQuery scripts are now in "No Conflict" mode
638
+ * Changed : Script loading now via wp_enqueue_script
639
+ * Changed : Add constant values for folder/file permission
640
+ * Changed : Use description in <A href title>
641
+ * Bugfix : Remove wrong DIV tag in slideshow
642
+ * Bugfix : Tag [Slideshow=id,width,height] didn't work proper
643
+ * Bugfix : Name conflict in Album script (serialize) (THX to Die-Andis)
644
+ * Bugfix : Changed check for CSS activation
645
+ * Bugfix : Changed check for safe-mode (Don't ask)
646
+
647
+ = V0.43 - 20.05.2007 =
648
+ * Changed : Rename Thumbnail class to avoid php name collision
649
+ * Bugfix : Missing translation flag in setup
650
+ * Bugfix : Changed check for safe-mode
651
+ * Bugfix : Changed check for Zip-File
652
+
653
+ = V0.42 - 17.05.2007 =
654
+ * Bugfix : Float function for singlepic not integrated, sorry !
655
+ * Bugfix : Remove clear:both in widget
656
+
657
+ = V0.41 - 17.05.2007 =
658
+ * NEW : Sidebar widget from KeViN
659
+ * Update : Better album management for more galleries
660
+ * Update : Thickbox v3 integrated
661
+ * Added : Float selection for singlepic
662
+ * Added : CSS class for widget
663
+ * Added : CSS file for K2 theme
664
+ * Added : German translation (THX to Lazy)
665
+ * Added : Better check for safe-mode
666
+ * Added : CSS Class for single-pic : class="ngg-singlepic"
667
+ * Added : Option to resize image before cropping it (Setting reset of prior versions needed! Setup -> Reset Settings)
668
+ * Changed : Image quality by default 85% (THX to ArizonaGroovejet)
669
+ * Bugfix : Update wrong file when select other style
670
+ * Bugfix : Fixed Permalink in album (THX to Helene D.)
671
+ * Bugfix : Scan folder in empty gallery
672
+ * Bugfix : Swfobjects only added with Thickbox effect
673
+ * Bugfix : Umlauts are now handled correctly
674
+
675
+ = V0.40 - 29.04.2007 =
676
+ * NEW : TinyMCE Button integration
677
+ * Removed : CSS Style : remove width/height in album
678
+
679
+ = V0.39 - 28.04.2007 =
680
+ * Added : Set ORDER BY for gallery
681
+ * Bugfix : check now for Exclude != 1
682
+ * Bugfix : DB Query in function wrong
683
+ * Bugfix : DB exlude = DEFAULT '0'
684
+ * Bugfix : Scan folder in empty gallery
685
+
686
+ = V0.38 - 28.04.2007 =
687
+ * Bugfix : One time more remove get_settings :-)
688
+ * Bugfix : $_GET in Manage gallery
689
+ * Bugfix : exclude option
690
+
691
+ = V0.37 - 28.04.2007 =
692
+ * Bugfix : $_GET in Manage gallery
693
+ * Bugfix : update DB installation routine
694
+
695
+ = V0.36 - 26.04.2007 =
696
+ * Bugfix : Stupid PHP beginner failure in album management
697
+
698
+ = V0.35 - 26.04.2007 =
699
+ * Rework : Folder name can be flexible
700
+ * New option : Fullsize pic for Singlepic mode
701
+ * New option : Select show order
702
+ * Added : Check for WP2.1
703
+ * Added : Check for permission for default folder
704
+ * Bugfix : Remove get_settings
705
+ * Bugfix : Correction for Safe-Mode ON
706
+ * Bugfix : Set Default '0' for table album.sortorder
707
+ * Bugfix : Update sort order
708
+
709
+ = V0.34 - 24.04.2007 =
710
+ * Added : Add fix ration setting
711
+ * Added : Add language file file
712
+ * Bugfix : Change link in Album to get_bloginfo('wpurl')
713
+ * Bugfix : Album CSS file not loaded
714
+
715
+ = V0.33 - 23.04.2007 =
716
+ * NEW : Overview Page
717
+ * NEW : Core function
718
+ * NEW : Slideshow
css/Black_Minimalism.css CHANGED
@@ -1,375 +1,375 @@
1
- /*
2
- CSS Name: Black Minimalism Theme
3
- Description: For Black Minimalism Theme
4
- Author: Alex Rabe
5
- Version: 1.60
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin-top: 10px;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- /*height: 130px;*/
24
- overflow:hidden;
25
- padding: 5px;
26
- margin-bottom: 5px;
27
- border: 1px solid #cccccc;
28
- }
29
-
30
- .ngg-albumtitle {
31
- text-align: left;
32
- font-weight: bold;
33
- margin:0px;
34
- padding:0px;
35
- font-size: 1.4em;
36
- margin-bottom: 10px;
37
- }
38
-
39
- .ngg-thumbnail {
40
- float: left;
41
- margin: 0pt !important;
42
- margin-right: 12px !important;
43
- }
44
-
45
- .ngg-thumbnail img {
46
- background-color:#FFFFFF;
47
- border:1px solid #A9A9A9;
48
- margin:4px 0px 4px 5px;
49
- padding:4px;
50
- position:relative;
51
- }
52
-
53
- .ngg-thumbnail img:hover {
54
- background-color: #A9A9A9;
55
- }
56
-
57
- .ngg-description {
58
- text-align: left;
59
- }
60
-
61
- /* ----------- Album Styles Compact -------------*/
62
-
63
- .ngg-album-compact {
64
- float:left;
65
- height:180px;
66
- padding-right:6px !important;
67
- margin:0px !important;
68
- text-align:left;
69
- width:120px;
70
- }
71
-
72
- .ngg-album-compactbox {
73
- background:transparent url(albumset.gif) no-repeat scroll 0%;
74
- height:86px;
75
- margin:0pt 0pt 6px !important;
76
- padding:12px 0pt 0pt 7px !important;
77
- width:120px;
78
- }
79
-
80
-
81
- .ngg-album-compactbox .Thumb {
82
- border:1px solid #000000;
83
- margin:0px !important;
84
- padding:0px !important;
85
- width:91px;
86
- height:68px;
87
- }
88
-
89
- .ngg-album-compact h4 {
90
- font-size:15px;
91
- font-weight:bold;
92
- margin-bottom:0px;
93
- margin-top:0px;
94
- width:110px;
95
- }
96
-
97
- .ngg-album-compact p {
98
- font-size:11px;
99
- margin-top:2px;
100
- }
101
-
102
- /* ----------- Gallery style -------------*/
103
-
104
- .ngg-galleryoverview {
105
- overflow: hidden;
106
- margin-top: 10px;
107
- width: 100%;
108
- clear:both;
109
- display:block !important;
110
- }
111
-
112
- .ngg-gallery-thumbnail-box {
113
- float: left;
114
- width: 20%;
115
- }
116
-
117
- .ngg-gallery-thumbnail {
118
- float: left;
119
- background: url(shadowAlpha.png) no-repeat bottom right !important;
120
- background: url(shadow.gif) no-repeat bottom right;
121
- margin: 10px 0 0 10px !important;
122
- }
123
-
124
- .ngg-gallery-thumbnail img {
125
- margin: -6px 6px 6px -6px;
126
- background-color:#FFFFFF;
127
- border:1px solid #A9A9A9;
128
- display:block;
129
- padding:4px;
130
- position:relative;
131
- }
132
-
133
- .ngg-gallery-thumbnail img:hover {
134
- background-color: #A9A9A9;
135
- }
136
-
137
- .ngg-gallery-thumbnail span {
138
- /* Images description */
139
- font-size:90%;
140
- padding-left:5px;
141
- display:block;
142
- }
143
-
144
- .ngg-clear {
145
- clear: both;
146
- }
147
-
148
- /* ----------- Gallery navigation -------------*/
149
-
150
- .ngg-navigation {
151
- font-size:0.9em !important;
152
- clear:both !important;
153
- display:block !important;
154
- padding-top:15px;
155
- text-align:center;
156
- }
157
-
158
- .ngg-navigation span {
159
- font-weight:bold;
160
- margin:0pt 6px;
161
- }
162
-
163
- .ngg-navigation a.page-numbers,
164
- .ngg-navigation a.next,
165
- .ngg-navigation a.prev,
166
- .ngg-navigation span.page-numbers,
167
- .ngg-navigation span.next,
168
- .ngg-navigation span.prev {
169
- border:1px solid #660000;
170
- margin-right:3px;
171
- padding:3px 7px;
172
- }
173
-
174
- .ngg-navigation a.page-numbers:hover,
175
- .ngg-navigation a.next:hover,
176
- .ngg-navigation a.prev:hover,
177
- .ngg-navigation span.page-numbers:hover,
178
- .ngg-navigation span.next:hover,
179
- .ngg-navigation span.prev:hover {
180
- background-color: #660000;
181
- color: #FFFFFF;
182
- text-decoration: none;
183
- }
184
-
185
- /* ----------- Image browser style -------------*/
186
-
187
- .ngg-imagebrowser {
188
-
189
- }
190
-
191
- .ngg-imagebrowser h3 {
192
- text-align:center;
193
- }
194
-
195
- .ngg-imagebrowser img {
196
- border:1px solid #A9A9A9;
197
- margin-top: 10px;
198
- margin-bottom: 10px;
199
- width: 100%;
200
- display:block !important;
201
- padding:5px;
202
- }
203
-
204
- .ngg-imagebrowser-nav {
205
- padding:5px;
206
- margin-left:10px;
207
- }
208
-
209
- .ngg-imagebrowser-nav .back {
210
- float:left;
211
- border:1px solid #DDDDDD;
212
- margin-right:3px;
213
- padding:3px 7px;
214
- }
215
-
216
- .ngg-imagebrowser-nav .next {
217
- float:right;
218
- border:1px solid #DDDDDD;
219
- margin-right:3px;
220
- padding:3px 7px;
221
- }
222
-
223
- .ngg-imagebrowser-nav .counter {
224
- text-align:center;
225
- font-size:0.9em !important;
226
- }
227
-
228
- .exif-data {
229
- margin-left: auto !important;
230
- margin-right: auto !important;
231
- }
232
-
233
- /* ----------- Slideshow -------------*/
234
- .slideshow {
235
- margin-left: auto;
236
- margin-right: auto;
237
- text-align:center;
238
- outline: none;
239
- }
240
-
241
- .slideshowlink {
242
-
243
- }
244
-
245
- /* ----------- JS Slideshow -------------*/
246
- .ngg-slideshow {
247
- overflow:hidden;
248
- position: relative;
249
- }
250
-
251
- .ngg-slideshow * {
252
- vertical-align:middle;
253
- }
254
-
255
- /* See also : http://www.brunildo.org/test/img_center.html */
256
- .ngg-slideshow-loader{
257
- display: table-cell;
258
- text-align: center;
259
- vertical-align:middle;
260
- }
261
-
262
- .ngg-slideshow-loader img{
263
- background: none !important;
264
- border: 0 none !important;
265
- margin:auto !important;
266
- }
267
-
268
- /* ----------- Single picture -------------*/
269
- .ngg-singlepic {
270
- display:block;
271
- padding:4px;
272
- }
273
-
274
- .ngg-left {
275
- float: left;
276
- margin-right:10px;
277
- }
278
-
279
- .ngg-right {
280
- float: right;
281
- margin-left:10px;
282
- }
283
-
284
- .ngg-center {
285
- margin-left: auto !important;
286
- margin-right: auto !important;
287
- }
288
-
289
- /* ----------- Sidebar widget -------------*/
290
- .ngg-widget,
291
- .ngg-widget-slideshow {
292
- overflow: hidden;
293
- margin:0pt;
294
- padding:5px 0px 0px 0pt;
295
- }
296
-
297
- .ngg-widget img {
298
- border:2px solid #A9A9A9;
299
- margin:0pt 2px 2px 0px;
300
- padding:1px;
301
- }
302
-
303
- /* ----------- Related images -------------*/
304
- .ngg-related-gallery {
305
- background:#F9F9F9;
306
- border:1px solid #E0E0E0;
307
- overflow:hidden;
308
- margin-bottom:1em;
309
- margin-top:1em;
310
- padding:5px;
311
- }
312
- .ngg-related-gallery img {
313
- border: 1px solid #DDDDDD;
314
- float: left;
315
- margin: 0pt 2px;
316
- padding: 2px;
317
- height: 50px;
318
- width: 50px;
319
- }
320
-
321
- .ngg-related-gallery img:hover {
322
- border: 1px solid #000000;
323
- }
324
-
325
- /* ----------- Gallery list -------------*/
326
-
327
- .ngg-galleryoverview ul li:before {
328
- content: '' !important;
329
- }
330
-
331
- .ngg-gallery-list {
332
- list-style-type:none;
333
- padding: 0px !important;
334
- text-indent:0px !important;
335
- }
336
-
337
- .ngg-galleryoverview div.pic img{
338
- width: 100%;
339
- }
340
-
341
- .ngg-gallery-list li {
342
- float:left;
343
- margin:0 2px 0px 2px !important;
344
- overflow:hidden;
345
- }
346
-
347
- .ngg-gallery-list li a {
348
- border:1px solid #CCCCCC;
349
- display:block;
350
- padding:2px;
351
- }
352
-
353
- .ngg-gallery-list li.selected a{
354
- -moz-background-clip:border;
355
- -moz-background-inline-policy:continuous;
356
- -moz-background-origin:padding;
357
- background:#000000 none repeat scroll 0 0;
358
- }
359
-
360
- .ngg-gallery-list li img {
361
- height:40px;
362
- width:40px;
363
- }
364
-
365
- li.ngg-next, li.ngg-prev {
366
- height:40px;
367
- width:40px;
368
- font-size:3.5em;
369
- }
370
-
371
- li.ngg-next a, li.ngg-prev a {
372
- padding-top: 10px;
373
- border: none;
374
- text-decoration: none;
375
  }
1
+ /*
2
+ CSS Name: Black Minimalism Theme
3
+ Description: For Black Minimalism Theme
4
+ Author: Alex Rabe
5
+ Version: 1.60
6
+
7
+ This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
+ styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
+ it's only a template design
10
+
11
+ */
12
+
13
+ /* ----------- Album Styles Extend -------------*/
14
+
15
+ .ngg-albumoverview {
16
+ margin-top: 10px;
17
+ width: 100%;
18
+ clear:both;
19
+ display:block !important;
20
+ }
21
+
22
+ .ngg-album {
23
+ /*height: 130px;*/
24
+ overflow:hidden;
25
+ padding: 5px;
26
+ margin-bottom: 5px;
27
+ border: 1px solid #cccccc;
28
+ }
29
+
30
+ .ngg-albumtitle {
31
+ text-align: left;
32
+ font-weight: bold;
33
+ margin:0px;
34
+ padding:0px;
35
+ font-size: 1.4em;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ .ngg-thumbnail {
40
+ float: left;
41
+ margin: 0pt !important;
42
+ margin-right: 12px !important;
43
+ }
44
+
45
+ .ngg-thumbnail img {
46
+ background-color:#FFFFFF;
47
+ border:1px solid #A9A9A9;
48
+ margin:4px 0px 4px 5px;
49
+ padding:4px;
50
+ position:relative;
51
+ }
52
+
53
+ .ngg-thumbnail img:hover {
54
+ background-color: #A9A9A9;
55
+ }
56
+
57
+ .ngg-description {
58
+ text-align: left;
59
+ }
60
+
61
+ /* ----------- Album Styles Compact -------------*/
62
+
63
+ .ngg-album-compact {
64
+ float:left;
65
+ height:180px;
66
+ padding-right:6px !important;
67
+ margin:0px !important;
68
+ text-align:left;
69
+ width:120px;
70
+ }
71
+
72
+ .ngg-album-compactbox {
73
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
74
+ height:86px;
75
+ margin:0pt 0pt 6px !important;
76
+ padding:12px 0pt 0pt 7px !important;
77
+ width:120px;
78
+ }
79
+
80
+
81
+ .ngg-album-compactbox .Thumb {
82
+ border:1px solid #000000;
83
+ margin:0px !important;
84
+ padding:0px !important;
85
+ width:91px;
86
+ height:68px;
87
+ }
88
+
89
+ .ngg-album-compact h4 {
90
+ font-size:15px;
91
+ font-weight:bold;
92
+ margin-bottom:0px;
93
+ margin-top:0px;
94
+ width:110px;
95
+ }
96
+
97
+ .ngg-album-compact p {
98
+ font-size:11px;
99
+ margin-top:2px;
100
+ }
101
+
102
+ /* ----------- Gallery style -------------*/
103
+
104
+ .ngg-galleryoverview {
105
+ overflow: hidden;
106
+ margin-top: 10px;
107
+ width: 100%;
108
+ clear:both;
109
+ display:block !important;
110
+ }
111
+
112
+ .ngg-gallery-thumbnail-box {
113
+ float: left;
114
+ width: 20%;
115
+ }
116
+
117
+ .ngg-gallery-thumbnail {
118
+ float: left;
119
+ background: url(shadowAlpha.png) no-repeat bottom right !important;
120
+ background: url(shadow.gif) no-repeat bottom right;
121
+ margin: 10px 0 0 10px !important;
122
+ }
123
+
124
+ .ngg-gallery-thumbnail img {
125
+ margin: -6px 6px 6px -6px;
126
+ background-color:#FFFFFF;
127
+ border:1px solid #A9A9A9;
128
+ display:block;
129
+ padding:4px;
130
+ position:relative;
131
+ }
132
+
133
+ .ngg-gallery-thumbnail img:hover {
134
+ background-color: #A9A9A9;
135
+ }
136
+
137
+ .ngg-gallery-thumbnail span {
138
+ /* Images description */
139
+ font-size:90%;
140
+ padding-left:5px;
141
+ display:block;
142
+ }
143
+
144
+ .ngg-clear {
145
+ clear: both;
146
+ }
147
+
148
+ /* ----------- Gallery navigation -------------*/
149
+
150
+ .ngg-navigation {
151
+ font-size:0.9em !important;
152
+ clear:both !important;
153
+ display:block !important;
154
+ padding-top:15px;
155
+ text-align:center;
156
+ }
157
+
158
+ .ngg-navigation span {
159
+ font-weight:bold;
160
+ margin:0pt 6px;
161
+ }
162
+
163
+ .ngg-navigation a.page-numbers,
164
+ .ngg-navigation a.next,
165
+ .ngg-navigation a.prev,
166
+ .ngg-navigation span.page-numbers,
167
+ .ngg-navigation span.next,
168
+ .ngg-navigation span.prev {
169
+ border:1px solid #660000;
170
+ margin-right:3px;
171
+ padding:3px 7px;
172
+ }
173
+
174
+ .ngg-navigation a.page-numbers:hover,
175
+ .ngg-navigation a.next:hover,
176
+ .ngg-navigation a.prev:hover,
177
+ .ngg-navigation span.page-numbers:hover,
178
+ .ngg-navigation span.next:hover,
179
+ .ngg-navigation span.prev:hover {
180
+ background-color: #660000;
181
+ color: #FFFFFF;
182
+ text-decoration: none;
183
+ }
184
+
185
+ /* ----------- Image browser style -------------*/
186
+
187
+ .ngg-imagebrowser {
188
+
189
+ }
190
+
191
+ .ngg-imagebrowser h3 {
192
+ text-align:center;
193
+ }
194
+
195
+ .ngg-imagebrowser img {
196
+ border:1px solid #A9A9A9;
197
+ margin-top: 10px;
198
+ margin-bottom: 10px;
199
+ width: 100%;
200
+ display:block !important;
201
+ padding:5px;
202
+ }
203
+
204
+ .ngg-imagebrowser-nav {
205
+ padding:5px;
206
+ margin-left:10px;
207
+ }
208
+
209
+ .ngg-imagebrowser-nav .back {
210
+ float:left;
211
+ border:1px solid #DDDDDD;
212
+ margin-right:3px;
213
+ padding:3px 7px;
214
+ }
215
+
216
+ .ngg-imagebrowser-nav .next {
217
+ float:right;
218
+ border:1px solid #DDDDDD;
219
+ margin-right:3px;
220
+ padding:3px 7px;
221
+ }
222
+
223
+ .ngg-imagebrowser-nav .counter {
224
+ text-align:center;
225
+ font-size:0.9em !important;
226
+ }
227
+
228
+ .exif-data {
229
+ margin-left: auto !important;
230
+ margin-right: auto !important;
231
+ }
232
+
233
+ /* ----------- Slideshow -------------*/
234
+ .slideshow {
235
+ margin-left: auto;
236
+ margin-right: auto;
237
+ text-align:center;
238
+ outline: none;
239
+ }
240
+
241
+ .slideshowlink {
242
+
243
+ }
244
+
245
+ /* ----------- JS Slideshow -------------*/
246
+ .ngg-slideshow {
247
+ overflow:hidden;
248
+ position: relative;
249
+ }
250
+
251
+ .ngg-slideshow * {
252
+ vertical-align:middle;
253
+ }
254
+
255
+ /* See also : http://www.brunildo.org/test/img_center.html */
256
+ .ngg-slideshow-loader{
257
+ display: table-cell;
258
+ text-align: center;
259
+ vertical-align:middle;
260
+ }
261
+
262
+ .ngg-slideshow-loader img{
263
+ background: none !important;
264
+ border: 0 none !important;
265
+ margin:auto !important;
266
+ }
267
+
268
+ /* ----------- Single picture -------------*/
269
+ .ngg-singlepic {
270
+ display:block;
271
+ padding:4px;
272
+ }
273
+
274
+ .ngg-left {
275
+ float: left;
276
+ margin-right:10px;
277
+ }
278
+
279
+ .ngg-right {
280
+ float: right;
281
+ margin-left:10px;
282
+ }
283
+
284
+ .ngg-center {
285
+ margin-left: auto !important;
286
+ margin-right: auto !important;
287
+ }
288
+
289
+ /* ----------- Sidebar widget -------------*/
290
+ .ngg-widget,
291
+ .ngg-widget-slideshow {
292
+ overflow: hidden;
293
+ margin:0pt;
294
+ padding:5px 0px 0px 0pt;
295
+ }
296
+
297
+ .ngg-widget img {
298
+ border:2px solid #A9A9A9;
299
+ margin:0pt 2px 2px 0px;
300
+ padding:1px;
301
+ }
302
+
303
+ /* ----------- Related images -------------*/
304
+ .ngg-related-gallery {
305
+ background:#F9F9F9;
306
+ border:1px solid #E0E0E0;
307
+ overflow:hidden;
308
+ margin-bottom:1em;
309
+ margin-top:1em;
310
+ padding:5px;
311
+ }
312
+ .ngg-related-gallery img {
313
+ border: 1px solid #DDDDDD;
314
+ float: left;
315
+ margin: 0pt 2px;
316
+ padding: 2px;
317
+ height: 50px;
318
+ width: 50px;
319
+ }
320
+
321
+ .ngg-related-gallery img:hover {
322
+ border: 1px solid #000000;
323
+ }
324
+
325
+ /* ----------- Gallery list -------------*/
326
+
327
+ .ngg-galleryoverview ul li:before {
328
+ content: '' !important;
329
+ }
330
+
331
+ .ngg-gallery-list {
332
+ list-style-type:none;
333
+ padding: 0px !important;
334
+ text-indent:0px !important;
335
+ }
336
+
337
+ .ngg-galleryoverview div.pic img{
338
+ width: 100%;
339
+ }
340
+
341
+ .ngg-gallery-list li {
342
+ float:left;
343
+ margin:0 2px 0px 2px !important;
344
+ overflow:hidden;
345
+ }
346
+
347
+ .ngg-gallery-list li a {
348
+ border:1px solid #CCCCCC;
349
+ display:block;
350
+ padding:2px;
351
+ }
352
+
353
+ .ngg-gallery-list li.selected a{
354
+ -moz-background-clip:border;
355
+ -moz-background-inline-policy:continuous;
356
+ -moz-background-origin:padding;
357
+ background:#000000 none repeat scroll 0 0;
358
+ }
359
+
360
+ .ngg-gallery-list li img {
361
+ height:40px;
362
+ width:40px;
363
+ }
364
+
365
+ li.ngg-next, li.ngg-prev {
366
+ height:40px;
367
+ width:40px;
368
+ font-size:3.5em;
369
+ }
370
+
371
+ li.ngg-next a, li.ngg-prev a {
372
+ padding-top: 10px;
373
+ border: none;
374
+ text-decoration: none;
375
  }
css/hovereffect.css CHANGED
@@ -1,425 +1,425 @@
1
- /*
2
- CSS Name: Hovereffect Styles
3
- Description: Hover Stylesheet based on the idea of Hoverbox from http://host.sonspring.com/hoverbox/
4
- Author: Alex Rabe - Orginal by Nathan Smith
5
- Version: 1.60
6
-
7
- This is a template stylesheet which doesn't support description below the thumbnails. It's a experimental version.
8
-
9
- */
10
-
11
- /* ----------- Album Styles Extend -------------*/
12
-
13
- .ngg-albumoverview {
14
- margin-top: 10px;
15
- width: 100%;
16
- clear:both;
17
- display:block !important;
18
- }
19
-
20
- .ngg-album {
21
- overflow: hidden;
22
- padding: 5px;
23
- margin-bottom: 5px;
24
- }
25
-
26
- .ngg-albumtitle {
27
- border-bottom:1px dashed #AAAAAA;
28
- text-align: left;
29
- font-weight: bold;
30
- margin:0px;
31
- padding-bottom: 3px;
32
- font-size: 1.4em;
33
- margin-bottom: 10px;
34
- }
35
-
36
- .ngg-thumbnail {
37
- float: left;
38
- margin-right: 12px;
39
- background:#EEEEEE none repeat scroll 0% 50%;
40
- border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
41
- border-style:solid;
42
- border-width:1px;
43
- color:inherit;
44
- margin-right: 5px;
45
- padding:5px;
46
- }
47
-
48
- .ngg-thumbnail img {
49
- filter: alpha(opacity=100);
50
- -moz-opacity: .99;
51
- opacity: .99;
52
- background:#FFFFFF none repeat scroll 0%;
53
- border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
54
- border-style:solid;
55
- border-width:1px;
56
- color:inherit;
57
- padding:2px;
58
- vertical-align:top;
59
- }
60
-
61
- .ngg-thumbnail img:hover {
62
- filter: alpha(opacity=90);
63
- -moz-opacity: .9;
64
- opacity: .9;
65
- border-color:#000000;
66
- }
67
-
68
- .ngg-description {
69
- text-align: left;
70
- }
71
-
72
- /* ----------- Album Styles Compact -------------*/
73
-
74
- .ngg-album-compact {
75
- float:left;
76
- height:180px;
77
- padding-right:6px !important;
78
- margin:0px !important;
79
- text-align:left;
80
- width:120px;
81
- }
82
-
83
- .ngg-album-compactbox {
84
- background:transparent url(albumset.gif) no-repeat scroll 0%;
85
- height:86px;
86
- margin:0pt 0pt 6px !important;
87
- padding:12px 0pt 0pt 7px !important;
88
- width:120px;
89
- }
90
-
91
-
92
- .ngg-album-compactbox .Thumb {
93
- border:1px solid #000000;
94
- margin:0px !important;
95
- padding:0px !important;
96
- width:91px;
97
- height:68px;
98
- }
99
-
100
- .ngg-album-compact h4 {
101
- font-size:15px;
102
- font-weight:bold;
103
- margin-bottom:0px;
104
- margin-top:0px;
105
- width:110px;
106
- }
107
-
108
- .ngg-album-compact p {
109
- font-size:11px;
110
- margin-top:2px;
111
- }
112
-
113
- /* ----------- Gallery style -------------*/
114
-
115
- .ngg-galleryoverview {
116
- overflow: hidden;
117
- margin-top: 10px;
118
- width: 100%;
119
- clear:both;
120
- display:block !important;
121
- }
122
-
123
- .ngg-gallery-thumbnail-box {
124
- float: left;
125
- background:#EEEEEE none repeat scroll 0% 50%;
126
- border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
127
- border-style:solid;
128
- border-width:1px;
129
- color:inherit;
130
- display:inline;
131
- margin:3px;
132
- padding:5px;
133
- position:relative;
134
- }
135
-
136
- .ngg-gallery-thumbnail {
137
- float: left;
138
- }
139
-
140
- .ngg-gallery-thumbnail img {
141
- filter: alpha(opacity=100);
142
- -moz-opacity: .99;
143
- opacity: .99;
144
- background:#FFFFFF none repeat scroll 0%;
145
- border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
146
- border-style:solid;
147
- border-width:1px;
148
- color:inherit;
149
- padding:2px;
150
- vertical-align:top;
151
- }
152
-
153
- .ngg-gallery-thumbnail img:hover {
154
- filter: alpha(opacity=90);
155
- -moz-opacity: .9;
156
- opacity: .9;
157
- border-color:#000000;
158
- }
159
-
160
- .ngg-gallery-thumbnail span {
161
- /* Images description */
162
- font-size:90%;
163
- padding-left:5px;
164
- display:block;
165
- }
166
-
167
- .ngg-clear {
168
- clear: both;
169
- }
170
-
171
- /* ----------- Gallery navigation -------------*/
172
-
173
- .ngg-navigation {
174
- font-size:0.9em !important;
175
- clear:both !important;
176
- display:block !important;
177
- padding-top:15px;
178
- text-align:center;
179
-
180
- }
181
-
182
- .ngg-navigation span {
183
- font-weight:bold;
184
- margin:0pt 6px;
185
- }
186
-
187
- .ngg-navigation a.page-numbers,
188
- .ngg-navigation a.next,
189
- .ngg-navigation a.prev,
190
- .ngg-navigation span.page-numbers,
191
- .ngg-navigation span.next,
192
- .ngg-navigation span.prev {
193
- border:1px solid #DDDDDD;
194
- margin-right:3px;
195
- padding:3px 7px;
196
- }
197
-
198
- .ngg-navigation a.page-numbers:hover,
199
- .ngg-navigation a.next:hover,
200
- .ngg-navigation a.prev:hover,
201
- .ngg-navigation span.page-numbers:hover,
202
- .ngg-navigation span.next:hover,
203
- .ngg-navigation span.prev:hover {
204
- background-color: #0066CC;
205
- color: #FFFFFF !important;
206
- text-decoration: none !important;
207
- }
208
-
209
- /* ----------- Image browser style -------------*/
210
-
211
- .ngg-imagebrowser {
212
-
213
- }
214
-
215
- .ngg-imagebrowser h3 {
216
- text-align:center;
217
- padding-bottom:10px;
218
- }
219
-
220
- .ngg-imagebrowser .pic {
221
- background:#EEEEEE none repeat scroll 0% 50%;
222
- border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
223
- border-style:solid;
224
- border-width:1px;
225
- color:inherit;
226
- display:block;
227
- padding:10px;
228
- }
229
-
230
- .ngg-imagebrowser img {
231
- width: 100%;
232
- margin: -3px;
233
- background:#FFFFFF none repeat scroll 0%;
234
- border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
235
- border-style:solid;
236
- border-width:1px;
237
- color:inherit;
238
- padding:2px;
239
- vertical-align:top;
240
- }
241
-
242
- .ngg-imagebrowser-nav {
243
- padding:10px;
244
- margin-left:10px;
245
-
246
- }
247
-
248
- .ngg-imagebrowser-nav .back {
249
- float:left;
250
- border:1px solid #DDDDDD;
251
- margin-right:3px;
252
- padding:3px 7px;
253
- }
254
-
255
- .ngg-imagebrowser-nav .next {
256
- float:right;
257
- border:1px solid #DDDDDD;
258
- margin-right:3px;
259
- padding:3px 7px;
260
- }
261
-
262
- .ngg-imagebrowser-nav .back:hover,
263
- .ngg-imagebrowser-nav .next:hover {
264
- border:1px solid #000000;
265
- }
266
-
267
- .ngg-imagebrowser-nav .back a:hover,
268
- .ngg-imagebrowser-nav .next a:hover {
269
- text-decoration: none !important;
270
- }
271
-
272
- .ngg-imagebrowser-nav .counter {
273
- text-align:center;
274
- font-size:0.9em !important;
275
- }
276
-
277
- .exif-data {
278
- margin-left: auto !important;
279
- margin-right: auto !important;
280
- }
281
-
282
- /* ----------- Slideshow -------------*/
283
- .slideshow {
284
- margin-left: auto;
285
- margin-right: auto;
286
- text-align:center;
287
- outline: none;
288
- }
289
-
290
- .slideshowlink {
291
-
292
- }
293
-
294
- /* ----------- JS Slideshow -------------*/
295
- .ngg-slideshow {
296
- overflow:hidden;
297
- position: relative;
298
- }
299
-
300
- .ngg-slideshow * {
301
- vertical-align:middle;
302
- }
303
-
304
- /* See also : http://www.brunildo.org/test/img_center.html */
305
- .ngg-slideshow-loader{
306
- display: table-cell;
307
- text-align: center;
308
- vertical-align:middle;
309
- }
310
-
311
- .ngg-slideshow-loader img{
312
- background: none !important;
313
- border: 0 none !important;
314
- margin:auto !important;
315
- }
316
-
317
- /* ----------- Single picture -------------*/
318
- .ngg-singlepic {
319
- background-color:#FFFFFF;
320
- display:block;
321
- padding:4px;
322
- }
323
-
324
- .ngg-left {
325
- float: left;
326
- margin-right:10px;
327
- }
328
-
329
- .ngg-right {
330
- float: right;
331
- margin-left:10px;
332
- }
333
-
334
- .ngg-center {
335
- margin-left: auto !important;
336
- margin-right: auto !important;
337
- }
338
-
339
- /* ----------- Sidebar widget -------------*/
340
- .ngg-widget,
341
- .ngg-widget-slideshow {
342
- overflow: hidden;
343
- margin:0pt;
344
- padding:5px 0px 0px 0pt;
345
- }
346
-
347
- .ngg-widget img {
348
- border:2px solid #A9A9A9;
349
- margin:0pt 2px 2px 0px;
350
- padding:1px;
351
- }
352
-
353
- /* ----------- Related images -------------*/
354
- .ngg-related-gallery {
355
- background:#F9F9F9;
356
- border:1px solid #E0E0E0;
357
- overflow:hidden;
358
- margin-bottom:1em;
359
- margin-top:1em;
360
- padding:5px;
361
- }
362
- .ngg-related-gallery img {
363
- border: 1px solid #DDDDDD;
364
- float: left;
365
- margin: 0pt 3px;
366
- padding: 2px;
367
- height: 50px;
368
- width: 50px;
369
- }
370
-
371
- .ngg-related-gallery img:hover {
372
- border: 1px solid #000000;
373
- }
374
-
375
- /* ----------- Gallery list -------------*/
376
-
377
- .ngg-galleryoverview ul li:before {
378
- content: '' !important;
379
- }
380
-
381
- .ngg-gallery-list {
382
- list-style-type:none;
383
- padding: 0px !important;
384
- text-indent:0px !important;
385
- }
386
-
387
- .ngg-galleryoverview div.pic img{
388
- width: 100%;
389
- }
390
-
391
- .ngg-gallery-list li {
392
- float:left;
393
- margin:0 2px 0px 2px !important;
394
- overflow:hidden;
395
- }
396
-
397
- .ngg-gallery-list li a {
398
- border:1px solid #CCCCCC;
399
- display:block;
400
- padding:2px;
401
- }
402
-
403
- .ngg-gallery-list li.selected a{
404
- -moz-background-clip:border;
405
- -moz-background-inline-policy:continuous;
406
- -moz-background-origin:padding;
407
- background:#000000 none repeat scroll 0 0;
408
- }
409
-
410
- .ngg-gallery-list li img {
411
- height:40px;
412
- width:40px;
413
- }
414
-
415
- li.ngg-next, li.ngg-prev {
416
- height:40px;
417
- width:40px;
418
- font-size:3.5em;
419
- }
420
-
421
- li.ngg-next a, li.ngg-prev a {
422
- padding-top: 10px;
423
- border: none;
424
- text-decoration: none;
425
  }
1
+ /*
2
+ CSS Name: Hovereffect Styles
3
+ Description: Hover Stylesheet based on the idea of Hoverbox from http://host.sonspring.com/hoverbox/
4
+ Author: Alex Rabe - Orginal by Nathan Smith
5
+ Version: 1.60
6
+
7
+ This is a template stylesheet which doesn't support description below the thumbnails. It's a experimental version.
8
+
9
+ */
10
+
11
+ /* ----------- Album Styles Extend -------------*/
12
+
13
+ .ngg-albumoverview {
14
+ margin-top: 10px;
15
+ width: 100%;
16
+ clear:both;
17
+ display:block !important;
18
+ }
19
+
20
+ .ngg-album {
21
+ overflow: hidden;
22
+ padding: 5px;
23
+ margin-bottom: 5px;
24
+ }
25
+
26
+ .ngg-albumtitle {
27
+ border-bottom:1px dashed #AAAAAA;
28
+ text-align: left;
29
+ font-weight: bold;
30
+ margin:0px;
31
+ padding-bottom: 3px;
32
+ font-size: 1.4em;
33
+ margin-bottom: 10px;
34
+ }
35
+
36
+ .ngg-thumbnail {
37
+ float: left;
38
+ margin-right: 12px;
39
+ background:#EEEEEE none repeat scroll 0% 50%;
40
+ border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
41
+ border-style:solid;
42
+ border-width:1px;
43
+ color:inherit;
44
+ margin-right: 5px;
45
+ padding:5px;
46
+ }
47
+
48
+ .ngg-thumbnail img {
49
+ filter: alpha(opacity=100);
50
+ -moz-opacity: .99;
51
+ opacity: .99;
52
+ background:#FFFFFF none repeat scroll 0%;
53
+ border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
54
+ border-style:solid;
55
+ border-width:1px;
56
+ color:inherit;
57
+ padding:2px;
58
+ vertical-align:top;
59
+ }
60
+
61
+ .ngg-thumbnail img:hover {
62
+ filter: alpha(opacity=90);
63
+ -moz-opacity: .9;
64
+ opacity: .9;
65
+ border-color:#000000;
66
+ }
67
+
68
+ .ngg-description {
69
+ text-align: left;
70
+ }
71
+
72
+ /* ----------- Album Styles Compact -------------*/
73
+
74
+ .ngg-album-compact {
75
+ float:left;
76
+ height:180px;
77
+ padding-right:6px !important;
78
+ margin:0px !important;
79
+ text-align:left;
80
+ width:120px;
81
+ }
82
+
83
+ .ngg-album-compactbox {
84
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
85
+ height:86px;
86
+ margin:0pt 0pt 6px !important;
87
+ padding:12px 0pt 0pt 7px !important;
88
+ width:120px;
89
+ }
90
+
91
+
92
+ .ngg-album-compactbox .Thumb {
93
+ border:1px solid #000000;
94
+ margin:0px !important;
95
+ padding:0px !important;
96
+ width:91px;
97
+ height:68px;
98
+ }
99
+
100
+ .ngg-album-compact h4 {
101
+ font-size:15px;
102
+ font-weight:bold;
103
+ margin-bottom:0px;
104
+ margin-top:0px;
105
+ width:110px;
106
+ }
107
+
108
+ .ngg-album-compact p {
109
+ font-size:11px;
110
+ margin-top:2px;
111
+ }
112
+
113
+ /* ----------- Gallery style -------------*/
114
+
115
+ .ngg-galleryoverview {
116
+ overflow: hidden;
117
+ margin-top: 10px;
118
+ width: 100%;
119
+ clear:both;
120
+ display:block !important;
121
+ }
122
+
123
+ .ngg-gallery-thumbnail-box {
124
+ float: left;
125
+ background:#EEEEEE none repeat scroll 0% 50%;
126
+ border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
127
+ border-style:solid;
128
+ border-width:1px;
129
+ color:inherit;
130
+ display:inline;
131
+ margin:3px;
132
+ padding:5px;
133
+ position:relative;
134
+ }
135
+
136
+ .ngg-gallery-thumbnail {
137
+ float: left;
138
+ }
139
+
140
+ .ngg-gallery-thumbnail img {
141
+ filter: alpha(opacity=100);
142
+ -moz-opacity: .99;
143
+ opacity: .99;
144
+ background:#FFFFFF none repeat scroll 0%;
145
+ border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
146
+ border-style:solid;
147
+ border-width:1px;
148
+ color:inherit;
149
+ padding:2px;
150
+ vertical-align:top;
151
+ }
152
+
153
+ .ngg-gallery-thumbnail img:hover {
154
+ filter: alpha(opacity=90);
155
+ -moz-opacity: .9;
156
+ opacity: .9;
157
+ border-color:#000000;
158
+ }
159
+
160
+ .ngg-gallery-thumbnail span {
161
+ /* Images description */
162
+ font-size:90%;
163
+ padding-left:5px;
164
+ display:block;
165
+ }
166
+
167
+ .ngg-clear {
168
+ clear: both;
169
+ }
170
+
171
+ /* ----------- Gallery navigation -------------*/
172
+
173
+ .ngg-navigation {
174
+ font-size:0.9em !important;
175
+ clear:both !important;
176
+ display:block !important;
177
+ padding-top:15px;
178
+ text-align:center;
179
+
180
+ }
181
+
182
+ .ngg-navigation span {
183
+ font-weight:bold;
184
+ margin:0pt 6px;
185
+ }
186
+
187
+ .ngg-navigation a.page-numbers,
188
+ .ngg-navigation a.next,
189
+ .ngg-navigation a.prev,
190
+ .ngg-navigation span.page-numbers,
191
+ .ngg-navigation span.next,
192
+ .ngg-navigation span.prev {
193
+ border:1px solid #DDDDDD;
194
+ margin-right:3px;
195
+ padding:3px 7px;
196
+ }
197
+
198
+ .ngg-navigation a.page-numbers:hover,
199
+ .ngg-navigation a.next:hover,
200
+ .ngg-navigation a.prev:hover,
201
+ .ngg-navigation span.page-numbers:hover,
202
+ .ngg-navigation span.next:hover,
203
+ .ngg-navigation span.prev:hover {
204
+ background-color: #0066CC;
205
+ color: #FFFFFF !important;
206
+ text-decoration: none !important;
207
+ }
208
+
209
+ /* ----------- Image browser style -------------*/
210
+
211
+ .ngg-imagebrowser {
212
+
213
+ }
214
+
215
+ .ngg-imagebrowser h3 {
216
+ text-align:center;
217
+ padding-bottom:10px;
218
+ }
219
+
220
+ .ngg-imagebrowser .pic {
221
+ background:#EEEEEE none repeat scroll 0% 50%;
222
+ border-color:#DDDDDD rgb(187, 187, 187) rgb(170, 170, 170) rgb(204, 204, 204);
223
+ border-style:solid;
224
+ border-width:1px;
225
+ color:inherit;
226
+ display:block;
227
+ padding:10px;
228
+ }
229
+
230
+ .ngg-imagebrowser img {
231
+ width: 100%;
232
+ margin: -3px;
233
+ background:#FFFFFF none repeat scroll 0%;
234
+ border-color:#AAAAAA rgb(204, 204, 204) rgb(221, 221, 221) rgb(187, 187, 187);
235
+ border-style:solid;
236
+ border-width:1px;
237
+ color:inherit;
238
+ padding:2px;
239
+ vertical-align:top;
240
+ }
241
+
242
+ .ngg-imagebrowser-nav {
243
+ padding:10px;
244
+ margin-left:10px;
245
+
246
+ }
247
+
248
+ .ngg-imagebrowser-nav .back {
249
+ float:left;
250
+ border:1px solid #DDDDDD;
251
+ margin-right:3px;
252
+ padding:3px 7px;
253
+ }
254
+
255
+ .ngg-imagebrowser-nav .next {
256
+ float:right;
257
+ border:1px solid #DDDDDD;
258
+ margin-right:3px;
259
+ padding:3px 7px;
260
+ }
261
+
262
+ .ngg-imagebrowser-nav .back:hover,
263
+ .ngg-imagebrowser-nav .next:hover {
264
+ border:1px solid #000000;
265
+ }
266
+
267
+ .ngg-imagebrowser-nav .back a:hover,
268
+ .ngg-imagebrowser-nav .next a:hover {
269
+ text-decoration: none !important;
270
+ }
271
+
272
+ .ngg-imagebrowser-nav .counter {
273
+ text-align:center;
274
+ font-size:0.9em !important;
275
+ }
276
+
277
+ .exif-data {
278
+ margin-left: auto !important;
279
+ margin-right: auto !important;
280
+ }
281
+
282
+ /* ----------- Slideshow -------------*/
283
+ .slideshow {
284
+ margin-left: auto;
285
+ margin-right: auto;
286
+ text-align:center;
287
+ outline: none;
288
+ }
289
+
290
+ .slideshowlink {
291
+
292
+ }
293
+
294
+ /* ----------- JS Slideshow -------------*/
295
+ .ngg-slideshow {
296
+ overflow:hidden;
297
+ position: relative;
298
+ }
299
+
300
+ .ngg-slideshow * {
301
+ vertical-align:middle;
302
+ }
303
+
304
+ /* See also : http://www.brunildo.org/test/img_center.html */
305
+ .ngg-slideshow-loader{
306
+ display: table-cell;
307
+ text-align: center;
308
+ vertical-align:middle;
309
+ }
310
+
311
+ .ngg-slideshow-loader img{
312
+ background: none !important;
313
+ border: 0 none !important;
314
+ margin:auto !important;
315
+ }
316
+
317
+ /* ----------- Single picture -------------*/
318
+ .ngg-singlepic {
319
+ background-color:#FFFFFF;
320
+ display:block;
321
+ padding:4px;
322
+ }
323
+
324
+ .ngg-left {
325
+ float: left;
326
+ margin-right:10px;
327
+ }
328
+
329
+ .ngg-right {
330
+ float: right;
331
+ margin-left:10px;
332
+ }
333
+
334
+ .ngg-center {
335
+ margin-left: auto !important;
336
+ margin-right: auto !important;
337
+ }
338
+
339
+ /* ----------- Sidebar widget -------------*/
340
+ .ngg-widget,
341
+ .ngg-widget-slideshow {
342
+ overflow: hidden;
343
+ margin:0pt;
344
+ padding:5px 0px 0px 0pt;
345
+ }
346
+
347
+ .ngg-widget img {
348
+ border:2px solid #A9A9A9;
349
+ margin:0pt 2px 2px 0px;
350
+ padding:1px;
351
+ }
352
+
353
+ /* ----------- Related images -------------*/
354
+ .ngg-related-gallery {
355
+ background:#F9F9F9;
356
+ border:1px solid #E0E0E0;
357
+ overflow:hidden;
358
+ margin-bottom:1em;
359
+ margin-top:1em;
360
+ padding:5px;
361
+ }
362
+ .ngg-related-gallery img {
363
+ border: 1px solid #DDDDDD;
364
+ float: left;
365
+ margin: 0pt 3px;
366
+ padding: 2px;
367
+ height: 50px;
368
+ width: 50px;
369
+ }
370
+
371
+ .ngg-related-gallery img:hover {
372
+ border: 1px solid #000000;
373
+ }
374
+
375
+ /* ----------- Gallery list -------------*/
376
+
377
+ .ngg-galleryoverview ul li:before {
378
+ content: '' !important;
379
+ }
380
+
381
+ .ngg-gallery-list {
382
+ list-style-type:none;
383
+ padding: 0px !important;
384
+ text-indent:0px !important;
385
+ }
386
+
387
+ .ngg-galleryoverview div.pic img{
388
+ width: 100%;
389
+ }
390
+
391
+ .ngg-gallery-list li {
392
+ float:left;
393
+ margin:0 2px 0px 2px !important;
394
+ overflow:hidden;
395
+ }
396
+
397
+ .ngg-gallery-list li a {
398
+ border:1px solid #CCCCCC;
399
+ display:block;
400
+ padding:2px;
401
+ }
402
+
403
+ .ngg-gallery-list li.selected a{
404
+ -moz-background-clip:border;
405
+ -moz-background-inline-policy:continuous;
406
+ -moz-background-origin:padding;
407
+ background:#000000 none repeat scroll 0 0;
408
+ }
409
+
410
+ .ngg-gallery-list li img {
411
+ height:40px;
412
+ width:40px;
413
+ }
414
+
415
+ li.ngg-next, li.ngg-prev {
416
+ height:40px;
417
+ width:40px;
418
+ font-size:3.5em;
419
+ }
420
+
421
+ li.ngg-next a, li.ngg-prev a {
422
+ padding-top: 10px;
423
+ border: none;
424
+ text-decoration: none;
425
  }
css/ngg_dkret3.css CHANGED
@@ -1,318 +1,318 @@
1
- /*
2
- CSS Name: dkret3 Theme
3
- Description: NextGEN dkret3 style with a shadow effect
4
- Author: Jörn Kretzschmar (based on Alex Rabes Default Style)
5
- Version: 1.3
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with the theme dkret3. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin-top: 10px;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- height: 100%;
24
- padding: 5px;
25
- margin-bottom: 5px;
26
- border: 1px solid #cccccc;
27
- overflow:hidden;
28
- }
29
-
30
- .ngg-albumtitle {
31
- text-align: left;
32
- font-weight: bold;
33
- margin:0px;
34
- padding:0px;
35
- font-size: 1.4em;
36
- margin-bottom: 10px;
37
- }
38
-
39
- .ngg-thumbnail {
40
- float: left;
41
- margin-right: 12px;
42
- }
43
-
44
- .ngg-thumbnail img {
45
- background-color:#FFFFFF;
46
- border:1px solid #A9A9A9;
47
- margin:4px 0px 4px 5px;
48
- padding:4px;
49
- position:relative;
50
- }
51
-
52
- .ngg-thumbnail img:hover {
53
- background-color: #A9A9A9;
54
- }
55
-
56
- .ngg-description {
57
- text-align: left;
58
- }
59
-
60
- /* ----------- Album Styles Compact -------------*/
61
-
62
- .ngg-album-compact {
63
- float:left;
64
- height:180px;
65
- padding-right:6px !important;
66
- margin:0px !important;
67
- text-align:left;
68
- width:120px;
69
- }
70
-
71
- .ngg-album-compactbox {
72
- background:transparent url(albumset.gif) no-repeat scroll 0%;
73
- height:86px;
74
- margin:0pt 0pt 6px !important;
75
- padding:12px 0pt 0pt 7px !important;
76
- width:120px;
77
- }
78
-
79
-
80
- .ngg-album-compactbox .Thumb {
81
- border:1px solid #000000;
82
- margin:0px !important;
83
- padding:0px !important;
84
- width:91px;
85
- height:68px;
86
- }
87
-
88
- .ngg-album-compact h4 {
89
- font-size:15px;
90
- font-weight:bold;
91
- margin-bottom:0px;
92
- margin-top:0px;
93
- width:110px;
94
- }
95
-
96
- .ngg-album-compact p {
97
- font-size:11px;
98
- margin-top:2px;
99
- }
100
-
101
- /* ----------- Gallery style -------------*/
102
-
103
- .ngg-galleryoverview {
104
- margin-top: 10px;
105
- width: 100%;
106
- clear:both;
107
- display:block !important;
108
- }
109
-
110
- .ngg-gallery-thumbnail-box {
111
- float: left;
112
- }
113
-
114
- .ngg-gallery-thumbnail {
115
- float: left;
116
- background: url(shadowAlpha.png) no-repeat bottom right !important;
117
- background: url(shadow.gif) no-repeat bottom right;
118
- margin: 10px 0 0 10px !important;
119
- }
120
-
121
- .ngg-gallery-thumbnail img {
122
- margin: -6px 6px 6px -6px;
123
- background-color:#FFFFFF;
124
- border:1px solid #A9A9A9;
125
- display:block;
126
- padding:4px;
127
- position:relative;
128
- }
129
-
130
- .ngg-gallery-thumbnail img:hover {
131
- background-color: #A9A9A9;
132
- }
133
-
134
- .ngg-gallery-thumbnail span {
135
- display:none;
136
- }
137
-
138
- .ngg-clear {
139
- clear: both;
140
- }
141
-
142
- /* ----------- Gallery navigation -------------*/
143
-
144
- .ngg-navigation {
145
- font-size:0.9em !important;
146
- clear:both !important;
147
- display:block !important;
148
- padding-top:15px;
149
- text-align:center;
150
- }
151
-
152
- .ngg-navigation span {
153
- font-weight:bold;
154
- margin:0pt 6px;
155
- }
156
-
157
- .ngg-navigation a.page-numbers,
158
- .ngg-navigation a.next,
159
- .ngg-navigation a.prev,
160
- .ngg-navigation span.page-numbers,
161
- .ngg-navigation span.next,
162
- .ngg-navigation span.prev {
163
- border:1px solid #DDDDDD;
164
- margin-right:3px;
165
- padding:3px 7px;
166
- }
167
-
168
- .ngg-navigation a.page-numbers:hover,
169
- .ngg-navigation a.next:hover,
170
- .ngg-navigation a.prev:hover,
171
- .ngg-navigation span.page-numbers:hover,
172
- .ngg-navigation span.next:hover,
173
- .ngg-navigation span.prev:hover {
174
- background-color: #0066CC;
175
- color: #FFFFFF !important;
176
- text-decoration: none !important;
177
- }
178
-
179
- /* ----------- Image browser style -------------*/
180
-
181
- .ngg-imagebrowser {
182
-
183
- }
184
-
185
- .ngg-imagebrowser h3 {
186
- text-align:center;
187
- }
188
-
189
- .ngg-imagebrowser img {
190
- border:1px solid #A9A9A9;
191
- margin-top: 10px;
192
- margin-bottom: 10px;
193
- width: 100%;
194
- display:block !important;
195
- padding:5px;
196
- }
197
-
198
- .ngg-imagebrowser-nav {
199
- padding:5px;
200
- margin-left:10px;
201
- }
202
-
203
- .ngg-imagebrowser-nav .back {
204
- float:left;
205
- border:1px solid #DDDDDD;
206
- margin-right:3px;
207
- padding:3px 7px;
208
- }
209
-
210
- .ngg-imagebrowser-nav .next {
211
- float:right;
212
- border:1px solid #DDDDDD;
213
- margin-right:3px;
214
- padding:3px 7px;
215
- }
216
-
217
- .ngg-imagebrowser-nav .counter {
218
- text-align:center;
219
- font-size:0.9em !important;
220
- }
221
-
222
- .exif-data {
223
- margin-left: auto !important;
224
- margin-right: auto !important;
225
- }
226
-
227
- /* ----------- Slideshow -------------*/
228
- .slideshow {
229
- margin-left: auto;
230
- margin-right: auto;
231
- text-align:center;
232
- outline: none;
233
- }
234
-
235
- .slideshowlink {
236
-
237
- }
238
-
239
- /* ----------- JS Slideshow -------------*/
240
- .ngg-slideshow {
241
- overflow:hidden;
242
- position: relative;
243
- }
244
-
245
- .ngg-slideshow * {
246
- vertical-align:middle;
247
- }
248
-
249
- /* See also : http://www.brunildo.org/test/img_center.html */
250
- .ngg-slideshow-loader{
251
- display: table-cell;
252
- text-align: center;
253
- vertical-align:middle;
254
- }
255
-
256
- .ngg-slideshow-loader img{
257
- background: none !important;
258
- border: 0 none !important;
259
- margin:auto !important;
260
- }
261
-
262
- /* ----------- Single picture -------------*/
263
- .ngg-singlepic {
264
- background-color:#FFFFFF;
265
- display:block;
266
- padding:4px;
267
- }
268
-
269
- .ngg-left {
270
- float: left;
271
- }
272
-
273
- .ngg-right {
274
- float: right;
275
- }
276
-
277
- .ngg-center {
278
- margin-left: auto;
279
- margin-right: auto;
280
- }
281
-
282
- /* ----------- Sidebar widget -------------*/
283
-
284
- .ngg-widget,
285
- .ngg-widget-slideshow {
286
- overflow: hidden;
287
- margin:0pt;
288
- padding:5px 0px 0px 0pt;
289
- text-align: center;
290
- }
291
-
292
- .ngg-widget img {
293
- border:2px solid #A9A9A9;
294
- margin:0pt 2px 2px 0px;
295
- padding:1px;
296
- }
297
-
298
- /* ----------- Related images -------------*/
299
- .ngg-related-gallery {
300
- background:#F9F9F9;
301
- border:1px solid #E0E0E0;
302
- overflow:hidden;
303
- margin-bottom:1em;
304
- margin-top:1em;
305
- padding:5px;
306
- }
307
- .ngg-related-gallery img {
308
- border: 1px solid #DDDDDD;
309
- float: left;
310
- margin: 0pt 3px;
311
- padding: 2px;
312
- height: 50px;
313
- width: 50px;
314
- }
315
-
316
- .ngg-related-gallery img:hover {
317
- border: 1px solid #000000;
318
- }
1
+ /*
2
+ CSS Name: dkret3 Theme
3
+ Description: NextGEN dkret3 style with a shadow effect
4
+ Author: Jörn Kretzschmar (based on Alex Rabes Default Style)
5
+ Version: 1.3
6
+
7
+ This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
+ styles with the theme dkret3. Modify it when your theme struggle with it,
9
+ it's only a template design
10
+
11
+ */
12
+
13
+ /* ----------- Album Styles Extend -------------*/
14
+
15
+ .ngg-albumoverview {
16
+ margin-top: 10px;
17
+ width: 100%;
18
+ clear:both;
19
+ display:block !important;
20
+ }
21
+
22
+ .ngg-album {
23
+ height: 100%;
24
+ padding: 5px;
25
+ margin-bottom: 5px;
26
+ border: 1px solid #cccccc;
27
+ overflow:hidden;
28
+ }
29
+
30
+ .ngg-albumtitle {
31
+ text-align: left;
32
+ font-weight: bold;
33
+ margin:0px;
34
+ padding:0px;
35
+ font-size: 1.4em;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ .ngg-thumbnail {
40
+ float: left;
41
+ margin-right: 12px;
42
+ }
43
+
44
+ .ngg-thumbnail img {
45
+ background-color:#FFFFFF;
46
+ border:1px solid #A9A9A9;
47
+ margin:4px 0px 4px 5px;
48
+ padding:4px;
49
+ position:relative;
50
+ }
51
+
52
+ .ngg-thumbnail img:hover {
53
+ background-color: #A9A9A9;
54
+ }
55
+
56
+ .ngg-description {
57
+ text-align: left;
58
+ }
59
+
60
+ /* ----------- Album Styles Compact -------------*/
61
+
62
+ .ngg-album-compact {
63
+ float:left;
64
+ height:180px;
65
+ padding-right:6px !important;
66
+ margin:0px !important;
67
+ text-align:left;
68
+ width:120px;
69
+ }
70
+
71
+ .ngg-album-compactbox {
72
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
73
+ height:86px;
74
+ margin:0pt 0pt 6px !important;
75
+ padding:12px 0pt 0pt 7px !important;
76
+ width:120px;
77
+ }
78
+
79
+
80
+ .ngg-album-compactbox .Thumb {
81
+ border:1px solid #000000;
82
+ margin:0px !important;
83
+ padding:0px !important;
84
+ width:91px;
85
+ height:68px;
86
+ }
87
+
88
+ .ngg-album-compact h4 {
89
+ font-size:15px;
90
+ font-weight:bold;
91
+ margin-bottom:0px;
92
+ margin-top:0px;
93
+ width:110px;
94
+ }
95
+
96
+ .ngg-album-compact p {
97
+ font-size:11px;
98
+ margin-top:2px;
99
+ }
100
+
101
+ /* ----------- Gallery style -------------*/
102
+
103
+ .ngg-galleryoverview {
104
+ margin-top: 10px;
105
+ width: 100%;
106
+ clear:both;
107
+ display:block !important;
108
+ }
109
+
110
+ .ngg-gallery-thumbnail-box {
111
+ float: left;
112
+ }
113
+
114
+ .ngg-gallery-thumbnail {
115
+ float: left;
116
+ background: url(shadowAlpha.png) no-repeat bottom right !important;
117
+ background: url(shadow.gif) no-repeat bottom right;
118
+ margin: 10px 0 0 10px !important;
119
+ }
120
+
121
+ .ngg-gallery-thumbnail img {
122
+ margin: -6px 6px 6px -6px;
123
+ background-color:#FFFFFF;
124
+ border:1px solid #A9A9A9;
125
+ display:block;
126
+ padding:4px;
127
+ position:relative;
128
+ }
129
+
130
+ .ngg-gallery-thumbnail img:hover {
131
+ background-color: #A9A9A9;
132
+ }
133
+
134
+ .ngg-gallery-thumbnail span {
135
+ display:none;
136
+ }
137
+
138
+ .ngg-clear {
139
+ clear: both;
140
+ }
141
+
142
+ /* ----------- Gallery navigation -------------*/
143
+
144
+ .ngg-navigation {
145
+ font-size:0.9em !important;
146
+ clear:both !important;
147
+ display:block !important;
148
+ padding-top:15px;
149
+ text-align:center;
150
+ }
151
+
152
+ .ngg-navigation span {
153
+ font-weight:bold;
154
+ margin:0pt 6px;
155
+ }
156
+
157
+ .ngg-navigation a.page-numbers,
158
+ .ngg-navigation a.next,
159
+ .ngg-navigation a.prev,
160
+ .ngg-navigation span.page-numbers,
161
+ .ngg-navigation span.next,
162
+ .ngg-navigation span.prev {
163
+ border:1px solid #DDDDDD;
164
+ margin-right:3px;
165
+ padding:3px 7px;
166
+ }
167
+
168
+ .ngg-navigation a.page-numbers:hover,
169
+ .ngg-navigation a.next:hover,
170
+ .ngg-navigation a.prev:hover,
171
+ .ngg-navigation span.page-numbers:hover,
172
+ .ngg-navigation span.next:hover,
173
+ .ngg-navigation span.prev:hover {
174
+ background-color: #0066CC;
175
+ color: #FFFFFF !important;
176
+ text-decoration: none !important;
177
+ }
178
+
179
+ /* ----------- Image browser style -------------*/
180
+
181
+ .ngg-imagebrowser {
182
+
183
+ }
184
+
185
+ .ngg-imagebrowser h3 {
186
+ text-align:center;
187
+ }
188
+
189
+ .ngg-imagebrowser img {
190
+ border:1px solid #A9A9A9;
191
+ margin-top: 10px;
192
+ margin-bottom: 10px;
193
+ width: 100%;
194
+ display:block !important;
195
+ padding:5px;
196
+ }
197
+
198
+ .ngg-imagebrowser-nav {
199
+ padding:5px;
200
+ margin-left:10px;
201
+ }
202
+
203
+ .ngg-imagebrowser-nav .back {
204
+ float:left;
205
+ border:1px solid #DDDDDD;
206
+ margin-right:3px;
207
+ padding:3px 7px;
208
+ }
209
+
210
+ .ngg-imagebrowser-nav .next {
211
+ float:right;
212
+ border:1px solid #DDDDDD;
213
+ margin-right:3px;
214
+ padding:3px 7px;
215
+ }
216
+
217
+ .ngg-imagebrowser-nav .counter {
218
+ text-align:center;
219
+ font-size:0.9em !important;
220
+ }
221
+
222
+ .exif-data {
223
+ margin-left: auto !important;
224
+ margin-right: auto !important;
225
+ }
226
+
227
+ /* ----------- Slideshow -------------*/
228
+ .slideshow {
229
+ margin-left: auto;
230
+ margin-right: auto;
231
+ text-align:center;
232
+ outline: none;
233
+ }
234
+
235
+ .slideshowlink {
236
+
237
+ }
238
+
239
+ /* ----------- JS Slideshow -------------*/
240
+ .ngg-slideshow {
241
+ overflow:hidden;
242
+ position: relative;
243
+ }
244
+
245
+ .ngg-slideshow * {
246
+ vertical-align:middle;
247
+ }
248
+
249
+ /* See also : http://www.brunildo.org/test/img_center.html */
250
+ .ngg-slideshow-loader{
251
+ display: table-cell;
252
+ text-align: center;
253
+ vertical-align:middle;
254
+ }
255
+
256
+ .ngg-slideshow-loader img{
257
+ background: none !important;
258
+ border: 0 none !important;
259
+ margin:auto !important;
260
+ }
261
+
262
+ /* ----------- Single picture -------------*/
263
+ .ngg-singlepic {
264
+ background-color:#FFFFFF;
265
+ display:block;
266
+ padding:4px;
267
+ }
268
+
269
+ .ngg-left {
270
+ float: left;
271
+ }
272
+
273
+ .ngg-right {
274
+ float: right;
275
+ }
276
+
277
+ .ngg-center {
278
+ margin-left: auto;
279
+ margin-right: auto;
280
+ }
281
+
282
+ /* ----------- Sidebar widget -------------*/
283
+
284
+ .ngg-widget,
285
+ .ngg-widget-slideshow {
286
+ overflow: hidden;
287
+ margin:0pt;
288
+ padding:5px 0px 0px 0pt;
289
+ text-align: center;
290
+ }
291
+
292
+ .ngg-widget img {
293
+ border:2px solid #A9A9A9;
294
+ margin:0pt 2px 2px 0px;
295
+ padding:1px;
296
+ }
297
+
298
+ /* ----------- Related images -------------*/
299
+ .ngg-related-gallery {
300
+ background:#F9F9F9;
301
+ border:1px solid #E0E0E0;
302
+ overflow:hidden;
303
+ margin-bottom:1em;
304
+ margin-top:1em;
305
+ padding:5px;
306
+ }
307
+ .ngg-related-gallery img {
308
+ border: 1px solid #DDDDDD;
309
+ float: left;
310
+ margin: 0pt 3px;
311
+ padding: 2px;
312
+ height: 50px;
313
+ width: 50px;
314
+ }
315
+
316
+ .ngg-related-gallery img:hover {
317
+ border: 1px solid #000000;
318
+ }
css/ngg_k2.css CHANGED
@@ -1,330 +1,330 @@
1
- /*
2
- CSS Name: K2 Theme
3
- Description: NextGEN Style for K2 Theme
4
- Author: Alex Rabe
5
- Version: 1.60
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin: 10px 0px 0px 0px !important;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- /*height: 130px;*/
24
- overflow:hidden;
25
- margin: 0px 0px 5px !important;
26
- padding: 5px;
27
- border: 1px solid #cccccc;
28
- }
29
-
30
- .ngg-albumtitle {
31
- text-align: left;
32
- font-weight: bold;
33
- padding:0px;
34
- font-size: 1.4em;
35
- margin: 0px 0px 10px 0px !important;
36
- }
37
-
38
- .ngg-albumcontent {
39
- margin: 0px !important;
40
- }
41
-
42
- .ngg-thumbnail {
43
- margin:0px 12px 0px 0px !important;
44
- float: left;
45
- }
46
-
47
- .ngg-thumbnail img {
48
- background-color:#FFFFFF;
49
- border:1px solid #A9A9A9;
50
- margin:4px 0px 4px 5px !important;
51
- padding:4px;
52
- position:relative;
53
- }
54
-
55
- .ngg-thumbnail img:hover {
56
- background-color: #A9A9A9;
57
- }
58
-
59
- .ngg-description {
60
- text-align: left;
61
- }
62
-
63
- /* ----------- Album Styles Compact -------------*/
64
-
65
- .ngg-album-compact {
66
- float:left;
67
- height:180px;
68
- padding-right:6px !important;
69
- margin:0px !important;
70
- text-align:left;
71
- width:120px;
72
- }
73
-
74
- .ngg-album-compactbox {
75
- background:transparent url(albumset.gif) no-repeat scroll 0%;
76
- height:86px;
77
- margin:0pt 0pt 6px !important;
78
- padding:12px 0pt 0pt 7px !important;
79
- width:120px;
80
- }
81
-
82
- .ngg-album-link {
83
- margin:0px !important;
84
- }
85
-
86
- .ngg-album-compactbox .Thumb {
87
- border:1px solid #000000;
88
- margin:0px !important;
89
- padding:0px !important;
90
- width:91px;
91
- height:68px;
92
- }
93
-
94
- .ngg-album-compact h4 {
95
- font-size:15px;
96
- font-weight:bold;
97
- margin-bottom:0px !important;
98
- margin-top:0px !important;
99
- width:110px;
100
- padding:0px !important;
101
- }
102
-
103
- .ngg-album-compact p {
104
- font-size:11px;
105
- margin-top:2px;
106
- }
107
-
108
- /* ----------- Gallery style -------------*/
109
-
110
- .ngg-galleryoverview {
111
- margin-top: 10px;
112
- width: 100%;
113
- clear:both;
114
- display:block !important;
115
- }
116
-
117
- .ngg-gallery-thumbnail-box {
118
- margin:0px !important;
119
- float: left;
120
- }
121
-
122
- .ngg-gallery-thumbnail {
123
- float: left;
124
- background: url(shadowAlpha.png) no-repeat bottom right !important;
125
- background: url(shadow.gif) no-repeat bottom right;
126
- margin: 10px 0 0 10px !important;
127
- }
128
-
129
- .ngg-gallery-thumbnail img {
130
- margin: -6px 6px 6px -6px !important;
131
- background-color:#FFFFFF;
132
- border:1px solid #A9A9A9;
133
- display:block;
134
- padding:4px;
135
- position:relative;
136
- }
137
-
138
- .ngg-gallery-thumbnail img:hover {
139
- background-color: #A9A9A9;
140
- }
141
-
142
- .ngg-gallery-thumbnail span {
143
- /* Images description */
144
- font-size:90%;
145
- padding-left:5px;
146
- display:block;
147
- }
148
-
149
- .ngg-clear {
150
- clear: both;
151
- }
152
-
153
- /* ----------- Gallery navigation -------------*/
154
-
155
- .ngg-navigation {
156
- font-size:0.9em !important;
157
- clear:both !important;
158
- display:block !important;
159
- padding-top:15px;
160
- text-align:center;
161
- }
162
-
163
- .ngg-navigation span {
164
- font-weight:bold;
165
- margin:0pt 6px;
166
- }
167
-
168
- .ngg-navigation a.page-numbers,
169
- .ngg-navigation a.next,
170
- .ngg-navigation a.prev,
171
- .ngg-navigation span.page-numbers,
172
- .ngg-navigation span.next,
173
- .ngg-navigation span.prev {
174
- border:1px solid #DDDDDD;
175
- margin-right:3px;
176
- padding:3px 7px;
177
- }
178
-
179
- .ngg-navigation a.page-numbers:hover,
180
- .ngg-navigation a.next:hover,
181
- .ngg-navigation a.prev:hover,
182
- .ngg-navigation span.page-numbers:hover,
183
- .ngg-navigation span.next:hover,
184
- .ngg-navigation span.prev:hover {
185
- background-color: #0066CC;
186
- color: #FFFFFF;
187
- text-decoration: none;
188
- }
189
-
190
- /* ----------- Image browser style -------------*/
191
-
192
- .ngg-imagebrowser {
193
-
194
- }
195
-
196
- .ngg-imagebrowser h3 {
197
- text-align:center;
198
- }
199
-
200
- .ngg-imagebrowser img {
201
- border:1px solid #A9A9A9;
202
- margin-top: 10px;
203
- margin-bottom: 10px;
204
- width: 100%;
205
- display:block !important;
206
- padding:5px;
207
- }
208
-
209
- .ngg-imagebrowser-nav {
210
- padding:5px;
211
- margin-left:10px;
212
- }
213
-
214
- .ngg-imagebrowser-nav .back {
215
- float:left;
216
- border:1px solid #DDDDDD;
217
- margin-right:3px;
218
- padding:3px 7px;
219
- }
220
-
221
- .ngg-imagebrowser-nav .next {
222
- float:right;
223
- border:1px solid #DDDDDD;
224
- margin-right:3px;
225
- padding:3px 7px;
226
- }
227
-
228
- .ngg-imagebrowser-nav .counter {
229
- text-align:center;
230
- font-size:0.9em !important;
231
- }
232
-
233
- .exif-data {
234
- margin-left: auto !important;
235
- margin-right: auto !important;
236
- }
237
-
238
- /* ----------- Slideshow -------------*/
239
- .slideshow {
240
- margin-left: auto;
241
- margin-right: auto;
242
- text-align:center;
243
- outline: none;
244
- }
245
-
246
- .slideshowlink {
247
-
248
- }
249
-
250
- /* ----------- JS Slideshow -------------*/
251
- .ngg-slideshow {
252
- overflow:hidden;
253
- position: relative;
254
- }
255
-
256
- .ngg-slideshow * {
257
- vertical-align:middle;
258
- }
259
-
260
- /* See also : http://www.brunildo.org/test/img_center.html */
261
- .ngg-slideshow-loader{
262
- display: table-cell;
263
- text-align: center;
264
- vertical-align:middle;
265
- }
266
-
267
- .ngg-slideshow-loader img{
268
- background: none !important;
269
- border: 0 none !important;
270
- margin:auto !important;
271
- }
272
-
273
- /* ----------- Single picture -------------*/
274
- .ngg-singlepic {
275
- background-color:#FFFFFF;
276
- display:block;
277
- padding:4px;
278
- }
279
-
280
- .ngg-left {
281
- float: left;
282
- margin-right:10px;
283
- }
284
-
285
- .ngg-right {
286
- float: right;
287
- margin-left:10px;
288
- }
289
-
290
- .ngg-center {
291
- margin-left: auto !important;
292
- margin-right: auto !important;
293
- }
294
-
295
- /* ----------- Sidebar widget -------------*/
296
- .ngg-widget,
297
- .ngg-widget-slideshow {
298
- overflow: hidden;
299
- margin:0pt;
300
- padding:5px 0px 0px 0pt;
301
- text-align:left;
302
- }
303
-
304
- .ngg-widget img {
305
- border:2px solid #A9A9A9;
306
- margin:0pt 2px 2px 0px;
307
- padding:1px;
308
- }
309
-
310
- /* ----------- Related images -------------*/
311
- .ngg-related-gallery {
312
- background:#F9F9F9;
313
- border:1px solid #E0E0E0;
314
- overflow:hidden;
315
- margin-bottom:1em;
316
- margin-top:1em;
317
- padding:5px;
318
- }
319
- .ngg-related-gallery img {
320
- border: 1px solid #DDDDDD;
321
- float: left;
322
- margin: 0pt 2px;
323
- padding: 2px;
324
- height: 50px;
325
- width: 50px;
326
- }
327
-
328
- .ngg-related-gallery img:hover {
329
- border: 1px solid #000000;
330
- }
1
+ /*
2
+ CSS Name: K2 Theme
3
+ Description: NextGEN Style for K2 Theme
4
+ Author: Alex Rabe
5
+ Version: 1.60
6
+
7
+ This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
+ styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
+ it's only a template design
10
+
11
+ */
12
+
13
+ /* ----------- Album Styles Extend -------------*/
14
+
15
+ .ngg-albumoverview {
16
+ margin: 10px 0px 0px 0px !important;
17
+ width: 100%;
18
+ clear:both;
19
+ display:block !important;
20
+ }
21
+
22
+ .ngg-album {
23
+ /*height: 130px;*/
24
+ overflow:hidden;
25
+ margin: 0px 0px 5px !important;
26
+ padding: 5px;
27
+ border: 1px solid #cccccc;
28
+ }
29
+
30
+ .ngg-albumtitle {
31
+ text-align: left;
32
+ font-weight: bold;
33
+ padding:0px;
34
+ font-size: 1.4em;
35
+ margin: 0px 0px 10px 0px !important;
36
+ }
37
+
38
+ .ngg-albumcontent {
39
+ margin: 0px !important;
40
+ }
41
+
42
+ .ngg-thumbnail {
43
+ margin:0px 12px 0px 0px !important;
44
+ float: left;
45
+ }
46
+
47
+ .ngg-thumbnail img {
48
+ background-color:#FFFFFF;
49
+ border:1px solid #A9A9A9;
50
+ margin:4px 0px 4px 5px !important;
51
+ padding:4px;
52
+ position:relative;
53
+ }
54
+
55
+ .ngg-thumbnail img:hover {
56
+ background-color: #A9A9A9;
57
+ }
58
+
59
+ .ngg-description {
60
+ text-align: left;
61
+ }
62
+
63
+ /* ----------- Album Styles Compact -------------*/
64
+
65
+ .ngg-album-compact {
66
+ float:left;
67
+ height:180px;
68
+ padding-right:6px !important;
69
+ margin:0px !important;
70
+ text-align:left;
71
+ width:120px;
72
+ }
73
+
74
+ .ngg-album-compactbox {
75
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
76
+ height:86px;
77
+ margin:0pt 0pt 6px !important;
78
+ padding:12px 0pt 0pt 7px !important;
79
+ width:120px;
80
+ }
81
+
82
+ .ngg-album-link {
83
+ margin:0px !important;
84
+ }
85
+
86
+ .ngg-album-compactbox .Thumb {
87
+ border:1px solid #000000;
88
+ margin:0px !important;
89
+ padding:0px !important;
90
+ width:91px;
91
+ height:68px;
92
+ }
93
+
94
+ .ngg-album-compact h4 {
95
+ font-size:15px;
96
+ font-weight:bold;
97
+ margin-bottom:0px !important;
98
+ margin-top:0px !important;
99
+ width:110px;
100
+ padding:0px !important;
101
+ }
102
+
103
+ .ngg-album-compact p {
104
+ font-size:11px;
105
+ margin-top:2px;
106
+ }
107
+
108
+ /* ----------- Gallery style -------------*/
109
+
110
+ .ngg-galleryoverview {
111
+ margin-top: 10px;
112
+ width: 100%;
113
+ clear:both;
114
+ display:block !important;
115
+ }
116
+
117
+ .ngg-gallery-thumbnail-box {
118
+ margin:0px !important;
119
+ float: left;
120
+ }
121
+
122
+ .ngg-gallery-thumbnail {
123
+ float: left;
124
+ background: url(shadowAlpha.png) no-repeat bottom right !important;
125
+ background: url(shadow.gif) no-repeat bottom right;
126
+ margin: 10px 0 0 10px !important;
127
+ }
128
+
129
+ .ngg-gallery-thumbnail img {
130
+ margin: -6px 6px 6px -6px !important;
131
+ background-color:#FFFFFF;
132
+ border:1px solid #A9A9A9;
133
+ display:block;
134
+ padding:4px;
135
+ position:relative;
136
+ }
137
+
138
+ .ngg-gallery-thumbnail img:hover {
139
+ background-color: #A9A9A9;
140
+ }
141
+
142
+ .ngg-gallery-thumbnail span {
143
+ /* Images description */
144
+ font-size:90%;
145
+ padding-left:5px;
146
+ display:block;
147
+ }
148
+
149
+ .ngg-clear {
150
+ clear: both;
151
+ }
152
+
153
+ /* ----------- Gallery navigation -------------*/
154
+
155
+ .ngg-navigation {
156
+ font-size:0.9em !important;
157
+ clear:both !important;
158
+ display:block !important;
159
+ padding-top:15px;
160
+ text-align:center;
161
+ }
162
+
163
+ .ngg-navigation span {
164
+ font-weight:bold;
165
+ margin:0pt 6px;
166
+ }
167
+
168
+ .ngg-navigation a.page-numbers,
169
+ .ngg-navigation a.next,
170
+ .ngg-navigation a.prev,
171
+ .ngg-navigation span.page-numbers,
172
+ .ngg-navigation span.next,
173
+ .ngg-navigation span.prev {
174
+ border:1px solid #DDDDDD;
175
+ margin-right:3px;
176
+ padding:3px 7px;
177
+ }
178
+
179
+ .ngg-navigation a.page-numbers:hover,
180
+ .ngg-navigation a.next:hover,
181
+ .ngg-navigation a.prev:hover,
182
+ .ngg-navigation span.page-numbers:hover,
183
+ .ngg-navigation span.next:hover,
184
+ .ngg-navigation span.prev:hover {
185
+ background-color: #0066CC;
186
+ color: #FFFFFF;
187
+ text-decoration: none;
188
+ }
189
+
190
+ /* ----------- Image browser style -------------*/
191
+
192
+ .ngg-imagebrowser {
193
+
194
+ }
195
+
196
+ .ngg-imagebrowser h3 {
197
+ text-align:center;
198
+ }
199
+
200
+ .ngg-imagebrowser img {
201
+ border:1px solid #A9A9A9;
202
+ margin-top: 10px;
203
+ margin-bottom: 10px;
204
+ width: 100%;
205
+ display:block !important;
206
+ padding:5px;
207
+ }
208
+
209
+ .ngg-imagebrowser-nav {
210
+ padding:5px;
211
+ margin-left:10px;
212
+ }
213
+
214
+ .ngg-imagebrowser-nav .back {
215
+ float:left;
216
+ border:1px solid #DDDDDD;
217
+ margin-right:3px;
218
+ padding:3px 7px;
219
+ }
220
+
221
+ .ngg-imagebrowser-nav .next {
222
+ float:right;
223
+ border:1px solid #DDDDDD;
224
+ margin-right:3px;
225
+ padding:3px 7px;
226
+ }
227
+
228
+ .ngg-imagebrowser-nav .counter {
229
+ text-align:center;
230
+ font-size:0.9em !important;
231
+ }
232
+
233
+ .exif-data {
234
+ margin-left: auto !important;
235
+ margin-right: auto !important;
236
+ }
237
+
238
+ /* ----------- Slideshow -------------*/
239
+ .slideshow {
240
+ margin-left: auto;
241
+ margin-right: auto;
242
+ text-align:center;
243
+ outline: none;
244
+ }
245
+
246
+ .slideshowlink {
247
+
248
+ }
249
+
250
+ /* ----------- JS Slideshow -------------*/
251
+ .ngg-slideshow {
252
+ overflow:hidden;
253
+ position: relative;
254
+ }
255
+
256
+ .ngg-slideshow * {
257
+ vertical-align:middle;
258
+ }
259
+
260
+ /* See also : http://www.brunildo.org/test/img_center.html */
261
+ .ngg-slideshow-loader{
262
+ display: table-cell;
263
+ text-align: center;
264
+ vertical-align:middle;
265
+ }
266
+
267
+ .ngg-slideshow-loader img{
268
+ background: none !important;
269
+ border: 0 none !important;
270
+ margin:auto !important;
271
+ }
272
+
273
+ /* ----------- Single picture -------------*/
274
+ .ngg-singlepic {
275
+ background-color:#FFFFFF;
276
+ display:block;
277
+ padding:4px;
278
+ }
279
+
280
+ .ngg-left {
281
+ float: left;
282
+ margin-right:10px;
283
+ }
284
+
285
+ .ngg-right {
286
+ float: right;
287
+ margin-left:10px;
288
+ }
289
+
290
+ .ngg-center {
291
+ margin-left: auto !important;
292
+ margin-right: auto !important;
293
+ }
294
+
295
+ /* ----------- Sidebar widget -------------*/
296
+ .ngg-widget,
297
+ .ngg-widget-slideshow {
298
+ overflow: hidden;
299
+ margin:0pt;
300
+ padding:5px 0px 0px 0pt;
301
+ text-align:left;
302
+ }
303
+
304
+ .ngg-widget img {
305
+ border:2px solid #A9A9A9;
306
+ margin:0pt 2px 2px 0px;
307
+ padding:1px;
308
+ }
309
+
310
+ /* ----------- Related images -------------*/
311
+ .ngg-related-gallery {
312
+ background:#F9F9F9;
313
+ border:1px solid #E0E0E0;
314
+ overflow:hidden;
315
+ margin-bottom:1em;
316
+ margin-top:1em;
317
+ padding:5px;
318
+ }
319
+ .ngg-related-gallery img {
320
+ border: 1px solid #DDDDDD;
321
+ float: left;
322
+ margin: 0pt 2px;
323
+ padding: 2px;
324
+ height: 50px;
325
+ width: 50px;
326
+ }
327
+
328
+ .ngg-related-gallery img:hover {
329
+ border: 1px solid #000000;
330
+ }
css/ngg_shadow.css CHANGED
@@ -1,371 +1,371 @@
1
- /*
2
- CSS Name: Shadow Effect
3
- Description: NextGEN Default Style with a Shadow effect
4
- Author: Alex Rabe
5
- Version: 1.60
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin-top: 10px;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- /*height: 130px;*/
24
- padding: 5px;
25
- margin-bottom: 5px;
26
- border: 1px solid #cccccc;
27
- overflow:hidden;
28
- }
29
-
30
- .ngg-albumtitle {
31
- text-align: left;
32
- font-weight: bold;
33
- margin:0px;
34
- padding:0px;
35
- font-size: 1.4em;
36
- margin-bottom: 10px;
37
- }
38
-
39
- .ngg-thumbnail {
40
- float: left;
41
- margin-right: 12px;
42
- }
43
-
44
- .ngg-thumbnail img {
45
- background-color:#FFFFFF;
46
- border:1px solid #A9A9A9;
47
- margin:4px 0px 4px 5px;
48
- padding:4px;
49
- position:relative;
50
- }
51
-
52
- .ngg-thumbnail img:hover {
53
- background-color: #A9A9A9;
54
- }
55
-
56
- .ngg-description {
57
- text-align: left;
58
- }
59
-
60
- /* ----------- Album Styles Compact -------------*/
61
-
62
- .ngg-album-compact {
63
- float:left;
64
- height:180px;
65
- padding-right:6px !important;
66
- margin:0px !important;
67
- text-align:left;
68
- width:120px;
69
- }
70
-
71
- .ngg-album-compactbox {
72
- background:transparent url(albumset.gif) no-repeat scroll 0%;
73
- height:86px;
74
- margin:0pt 0pt 6px !important;
75
- padding:12px 0pt 0pt 7px !important;
76
- width:120px;
77
- }
78
-
79
-
80
- .ngg-album-compactbox .Thumb {
81
- border:1px solid #000000;
82
- margin:0px !important;
83
- padding:0px !important;
84
- width:91px;
85
- height:68px;
86
- }
87
-
88
- .ngg-album-compact h4 {
89
- font-size:15px;
90
- font-weight:bold;
91
- margin-bottom:0px;
92
- margin-top:0px;
93
- width:110px;
94
- }
95
-
96
- .ngg-album-compact p {
97
- font-size:11px;
98
- margin-top:2px;
99
- }
100
-
101
- /* ----------- Gallery style -------------*/
102
-
103
- .ngg-galleryoverview {
104
- margin-top: 10px;
105
- width: 100%;
106
- clear:both;
107
- display:block !important;
108
- }
109
-
110
- .ngg-gallery-thumbnail-box {
111
- float: left;
112
- }
113
-
114
- .ngg-gallery-thumbnail {
115
- float: left;
116
- background: url(shadowAlpha.png) no-repeat bottom right !important;
117
- background: url(shadow.gif) no-repeat bottom right;
118
- margin: 10px 0 0 10px !important;
119
- }
120
-
121
- .ngg-gallery-thumbnail img {
122
- margin: -6px 6px 6px -6px;
123
- background-color:#FFFFFF;
124
- border:1px solid #A9A9A9;
125
- display:block;
126
- padding:4px;
127
- position:relative;
128
- }
129
-
130
- .ngg-gallery-thumbnail img:hover {
131
- background-color: #A9A9A9;
132
- }
133
-
134
- .ngg-gallery-thumbnail span {
135
- display:none;
136
- }
137
-
138
- .ngg-clear {
139
- clear: both;
140
- }
141
-
142
- /* ----------- Gallery navigation -------------*/
143
-
144
- .ngg-navigation {
145
- font-size:0.9em !important;
146
- clear:both !important;
147
- display:block !important;
148
- padding-top:15px;
149
- text-align:center;
150
- }
151
-
152
- .ngg-navigation span {
153
- font-weight:bold;
154
- margin:0pt 6px;
155
- }
156
-
157
- .ngg-navigation a.page-numbers,
158
- .ngg-navigation a.next,
159
- .ngg-navigation a.prev,
160
- .ngg-navigation span.page-numbers,
161
- .ngg-navigation span.next,
162
- .ngg-navigation span.prev {
163
- border:1px solid #DDDDDD;
164
- margin-right:3px;
165
- padding:3px 7px;
166
- }
167
-
168
- .ngg-navigation a.page-numbers:hover,
169
- .ngg-navigation a.next:hover,
170
- .ngg-navigation a.prev:hover,
171
- .ngg-navigation span.page-numbers:hover,
172
- .ngg-navigation span.next:hover,
173
- .ngg-navigation span.prev:hover {
174
- background-color: #0066CC;
175
- color: #FFFFFF !important;
176
- text-decoration: none !important;
177
- }
178
-
179
- /* ----------- Image browser style -------------*/
180
-
181
- .ngg-imagebrowser {
182
-
183
- }
184
-
185
- .ngg-imagebrowser h3 {
186
- text-align:center;
187
- }
188
-
189
- .ngg-imagebrowser img {
190
- border:1px solid #A9A9A9;
191
- margin-top: 10px;
192
- margin-bottom: 10px;
193
- width: 100%;
194
- display:block !important;
195
- padding:5px;
196
- }
197
-
198
- .ngg-imagebrowser-nav {
199
- padding:5px;
200
- margin-left:10px;
201
- }
202
-
203
- .ngg-imagebrowser-nav .back {
204
- float:left;
205
- border:1px solid #DDDDDD;
206
- margin-right:3px;
207
- padding:3px 7px;
208
- }
209
-
210
- .ngg-imagebrowser-nav .next {
211
- float:right;
212
- border:1px solid #DDDDDD;
213
- margin-right:3px;
214
- padding:3px 7px;
215
- }
216
-
217
- .ngg-imagebrowser-nav .counter {
218
- text-align:center;
219
- font-size:0.9em !important;
220
- }
221
-
222
- .exif-data {
223
- margin-left: auto !important;
224
- margin-right: auto !important;
225
- }
226
-
227
- /* ----------- Slideshow -------------*/
228
- .slideshow {
229
- margin-left: auto;
230
- margin-right: auto;
231
- text-align:center;
232
- outline: none;
233
- }
234
-
235
- .slideshowlink {
236
-
237
- }
238
-
239
- /* ----------- JS Slideshow -------------*/
240
- .ngg-slideshow {
241
- overflow:hidden;
242
- position: relative;
243
- }
244
-
245
- .ngg-slideshow * {
246
- vertical-align:middle;
247
- }
248
-
249
- /* See also : http://www.brunildo.org/test/img_center.html */
250
- .ngg-slideshow-loader{
251
- display: table-cell;
252
- text-align: center;
253
- vertical-align:middle;
254
- }
255
-
256
- .ngg-slideshow-loader img{
257
- background: none !important;
258
- border: 0 none !important;
259
- margin:auto !important;
260
- }
261
-
262
- /* ----------- Single picture -------------*/
263
- .ngg-singlepic {
264
- background-color:#FFFFFF;
265
- display:block;
266
- padding:4px;
267
- }
268
-
269
- .ngg-left {
270
- float: left;
271
- margin-right:10px;
272
- }
273
-
274
- .ngg-right {
275
- float: right;
276
- margin-left:10px;
277
- }
278
-
279
- .ngg-center {
280
- margin-left: auto !important;
281
- margin-right: auto !important;
282
- }
283
-
284
- /* ----------- Sidebar widget -------------*/
285
-
286
- .ngg-widget,
287
- .ngg-widget-slideshow {
288
- overflow: hidden;
289
- margin:0pt;
290
- padding:5px 0px 0px 0pt;
291
- }
292
-
293
- .ngg-widget img {
294
- border:2px solid #A9A9A9;
295
- margin:0pt 2px 2px 0px;
296
- padding:1px;
297
- }
298
-
299
- /* ----------- Related images -------------*/
300
- .ngg-related-gallery {
301
- background:#F9F9F9;
302
- border:1px solid #E0E0E0;
303
- overflow:hidden;
304
- margin-bottom:1em;
305
- margin-top:1em;
306
- padding:5px;
307
- }
308
- .ngg-related-gallery img {
309
- border: 1px solid #DDDDDD;
310
- float: left;
311
- margin: 0pt 3px;
312
- padding: 2px;
313
- height: 50px;
314
- width: 50px;
315
- }
316
-
317
- .ngg-related-gallery img:hover {
318
- border: 1px solid #000000;
319
- }
320
-
321
- /* ----------- Gallery list -------------*/
322
-
323
- .ngg-galleryoverview ul li:before {
324
- content: '' !important;
325
- }
326
-
327
- .ngg-gallery-list {
328
- list-style-type:none;
329
- padding: 0px !important;
330
- text-indent:0px !important;
331
- }
332
-
333
- .ngg-galleryoverview div.pic img{
334
- width: 100%;
335
- }
336
-
337
- .ngg-gallery-list li {
338
- float:left;
339
- margin:0 2px 0px 2px !important;
340
- overflow:hidden;
341
- }
342
-
343
- .ngg-gallery-list li a {
344
- border:1px solid #CCCCCC;
345
- display:block;
346
- padding:2px;
347
- }
348
-
349
- .ngg-gallery-list li.selected a{
350
- -moz-background-clip:border;
351
- -moz-background-inline-policy:continuous;
352
- -moz-background-origin:padding;
353
- background:#000000 none repeat scroll 0 0;
354
- }
355
-
356
- .ngg-gallery-list li img {
357
- height:40px;
358
- width:40px;
359
- }
360
-
361
- li.ngg-next, li.ngg-prev {
362
- height:40px;
363
- width:40px;
364
- font-size:3.5em;
365
- }
366
-
367
- li.ngg-next a, li.ngg-prev a {
368
- padding-top: 10px;
369
- border: none;
370
- text-decoration: none;
371
  }
1
+ /*
2
+ CSS Name: Shadow Effect
3
+ Description: NextGEN Default Style with a Shadow effect
4
+ Author: Alex Rabe
5
+ Version: 1.60
6
+
7
+ This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
+ styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
+ it's only a template design
10
+
11
+ */
12
+
13
+ /* ----------- Album Styles Extend -------------*/
14
+
15
+ .ngg-albumoverview {
16
+ margin-top: 10px;
17
+ width: 100%;
18
+ clear:both;
19
+ display:block !important;
20
+ }
21
+
22
+ .ngg-album {
23
+ /*height: 130px;*/
24
+ padding: 5px;
25
+ margin-bottom: 5px;
26
+ border: 1px solid #cccccc;
27
+ overflow:hidden;
28
+ }
29
+
30
+ .ngg-albumtitle {
31
+ text-align: left;
32
+ font-weight: bold;
33
+ margin:0px;
34
+ padding:0px;
35
+ font-size: 1.4em;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ .ngg-thumbnail {
40
+ float: left;
41
+ margin-right: 12px;
42
+ }
43
+
44
+ .ngg-thumbnail img {
45
+ background-color:#FFFFFF;
46
+ border:1px solid #A9A9A9;
47
+ margin:4px 0px 4px 5px;
48
+ padding:4px;
49
+ position:relative;
50
+ }
51
+
52
+ .ngg-thumbnail img:hover {
53
+ background-color: #A9A9A9;
54
+ }
55
+
56
+ .ngg-description {
57
+ text-align: left;
58
+ }
59
+
60
+ /* ----------- Album Styles Compact -------------*/
61
+
62
+ .ngg-album-compact {
63
+ float:left;
64
+ height:180px;
65
+ padding-right:6px !important;
66
+ margin:0px !important;
67
+ text-align:left;
68
+ width:120px;
69
+ }
70
+
71
+ .ngg-album-compactbox {
72
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
73
+ height:86px;
74
+ margin:0pt 0pt 6px !important;
75
+ padding:12px 0pt 0pt 7px !important;
76
+ width:120px;
77
+ }
78
+
79
+
80
+ .ngg-album-compactbox .Thumb {
81
+ border:1px solid #000000;
82
+ margin:0px !important;
83
+ padding:0px !important;
84
+ width:91px;
85
+ height:68px;
86
+ }
87
+
88
+ .ngg-album-compact h4 {
89
+ font-size:15px;
90
+ font-weight:bold;
91
+ margin-bottom:0px;
92
+ margin-top:0px;
93
+ width:110px;
94
+ }
95
+
96
+ .ngg-album-compact p {
97
+ font-size:11px;
98
+ margin-top:2px;
99
+ }
100
+
101
+ /* ----------- Gallery style -------------*/
102
+
103
+ .ngg-galleryoverview {
104
+ margin-top: 10px;
105
+ width: 100%;
106
+ clear:both;
107
+ display:block !important;
108
+ }
109
+
110
+ .ngg-gallery-thumbnail-box {
111
+ float: left;
112
+ }
113
+
114
+ .ngg-gallery-thumbnail {
115
+ float: left;
116
+ background: url(shadowAlpha.png) no-repeat bottom right !important;
117
+ background: url(shadow.gif) no-repeat bottom right;
118
+ margin: 10px 0 0 10px !important;
119
+ }
120
+
121
+ .ngg-gallery-thumbnail img {
122
+ margin: -6px 6px 6px -6px;
123
+ background-color:#FFFFFF;
124
+ border:1px solid #A9A9A9;
125
+ display:block;
126
+ padding:4px;
127
+ position:relative;
128
+ }
129
+
130
+ .ngg-gallery-thumbnail img:hover {
131
+ background-color: #A9A9A9;
132
+ }
133
+
134
+ .ngg-gallery-thumbnail span {
135
+ display:none;
136
+ }
137
+
138
+ .ngg-clear {
139
+ clear: both;
140
+ }
141
+
142
+ /* ----------- Gallery navigation -------------*/
143
+
144
+ .ngg-navigation {
145
+ font-size:0.9em !important;
146
+ clear:both !important;
147
+ display:block !important;
148
+ padding-top:15px;
149
+ text-align:center;
150
+ }
151
+
152
+ .ngg-navigation span {
153
+ font-weight:bold;
154
+ margin:0pt 6px;
155
+ }
156
+
157
+ .ngg-navigation a.page-numbers,
158
+ .ngg-navigation a.next,
159
+ .ngg-navigation a.prev,
160
+ .ngg-navigation span.page-numbers,
161
+ .ngg-navigation span.next,
162
+ .ngg-navigation span.prev {
163
+ border:1px solid #DDDDDD;
164
+ margin-right:3px;
165
+ padding:3px 7px;
166
+ }
167
+
168
+ .ngg-navigation a.page-numbers:hover,
169
+ .ngg-navigation a.next:hover,
170
+ .ngg-navigation a.prev:hover,
171
+ .ngg-navigation span.page-numbers:hover,
172
+ .ngg-navigation span.next:hover,
173
+ .ngg-navigation span.prev:hover {
174
+ background-color: #0066CC;
175
+ color: #FFFFFF !important;
176
+ text-decoration: none !important;
177
+ }
178
+
179
+ /* ----------- Image browser style -------------*/
180
+
181
+ .ngg-imagebrowser {
182
+
183
+ }
184
+
185
+ .ngg-imagebrowser h3 {
186
+ text-align:center;
187
+ }
188
+
189
+ .ngg-imagebrowser img {
190
+ border:1px solid #A9A9A9;
191
+ margin-top: 10px;
192
+ margin-bottom: 10px;
193
+ width: 100%;
194
+ display:block !important;
195
+ padding:5px;
196
+ }
197
+
198
+ .ngg-imagebrowser-nav {
199
+ padding:5px;
200
+ margin-left:10px;
201
+ }
202
+
203
+ .ngg-imagebrowser-nav .back {
204
+ float:left;
205
+ border:1px solid #DDDDDD;
206
+ margin-right:3px;
207
+ padding:3px 7px;
208
+ }
209
+
210
+ .ngg-imagebrowser-nav .next {
211
+ float:right;
212
+ border:1px solid #DDDDDD;
213
+ margin-right:3px;
214
+ padding:3px 7px;
215
+ }
216
+
217
+ .ngg-imagebrowser-nav .counter {
218
+ text-align:center;
219
+ font-size:0.9em !important;
220
+ }
221
+
222
+ .exif-data {
223
+ margin-left: auto !important;
224
+ margin-right: auto !important;
225
+ }
226
+
227
+ /* ----------- Slideshow -------------*/
228
+ .slideshow {
229
+ margin-left: auto;
230
+ margin-right: auto;
231
+ text-align:center;
232
+ outline: none;
233
+ }
234
+
235
+ .slideshowlink {
236
+
237
+ }
238
+
239
+ /* ----------- JS Slideshow -------------*/
240
+ .ngg-slideshow {
241
+ overflow:hidden;
242
+ position: relative;
243
+ }
244
+
245
+ .ngg-slideshow * {
246
+ vertical-align:middle;
247
+ }
248
+
249
+ /* See also : http://www.brunildo.org/test/img_center.html */
250
+ .ngg-slideshow-loader{
251
+ display: table-cell;
252
+ text-align: center;
253
+ vertical-align:middle;
254
+ }
255
+
256
+ .ngg-slideshow-loader img{
257
+ background: none !important;
258
+ border: 0 none !important;
259
+ margin:auto !important;
260
+ }
261
+
262
+ /* ----------- Single picture -------------*/
263
+ .ngg-singlepic {
264
+ background-color:#FFFFFF;
265
+ display:block;
266
+ padding:4px;
267
+ }
268
+
269
+ .ngg-left {
270
+ float: left;
271
+ margin-right:10px;
272
+ }
273
+
274
+ .ngg-right {
275
+ float: right;
276
+ margin-left:10px;
277
+ }
278
+
279
+ .ngg-center {
280
+ margin-left: auto !important;
281
+ margin-right: auto !important;
282
+ }
283
+
284
+ /* ----------- Sidebar widget -------------*/
285
+
286
+ .ngg-widget,
287
+ .ngg-widget-slideshow {
288
+ overflow: hidden;
289
+ margin:0pt;
290
+ padding:5px 0px 0px 0pt;
291
+ }
292
+
293
+ .ngg-widget img {
294
+ border:2px solid #A9A9A9;
295
+ margin:0pt 2px 2px 0px;
296
+ padding:1px;
297
+ }
298
+
299
+ /* ----------- Related images -------------*/
300
+ .ngg-related-gallery {
301
+ background:#F9F9F9;
302
+ border:1px solid #E0E0E0;
303
+ overflow:hidden;
304
+ margin-bottom:1em;
305
+ margin-top:1em;
306
+ padding:5px;
307
+ }
308
+ .ngg-related-gallery img {
309
+ border: 1px solid #DDDDDD;
310
+ float: left;
311
+ margin: 0pt 3px;
312
+ padding: 2px;
313
+ height: 50px;
314
+ width: 50px;
315
+ }
316
+
317
+ .ngg-related-gallery img:hover {
318
+ border: 1px solid #000000;
319
+ }
320
+
321
+ /* ----------- Gallery list -------------*/
322
+
323
+ .ngg-galleryoverview ul li:before {
324
+ content: '' !important;
325
+ }
326
+
327
+ .ngg-gallery-list {
328
+ list-style-type:none;
329
+ padding: 0px !important;
330
+ text-indent:0px !important;
331
+ }
332
+
333
+ .ngg-galleryoverview div.pic img{
334
+ width: 100%;
335
+ }
336
+
337
+ .ngg-gallery-list li {
338
+ float:left;
339
+ margin:0 2px 0px 2px !important;
340
+ overflow:hidden;
341
+ }
342
+
343
+ .ngg-gallery-list li a {
344
+ border:1px solid #CCCCCC;
345
+ display:block;
346
+ padding:2px;
347
+ }
348
+
349
+ .ngg-gallery-list li.selected a{
350
+ -moz-background-clip:border;
351
+ -moz-background-inline-policy:continuous;
352
+ -moz-background-origin:padding;
353
+ background:#000000 none repeat scroll 0 0;
354
+ }
355
+
356
+ .ngg-gallery-list li img {
357
+ height:40px;
358
+ width:40px;
359
+ }
360
+
361
+ li.ngg-next, li.ngg-prev {
362
+ height:40px;
363
+ width:40px;
364
+ font-size:3.5em;
365
+ }
366
+
367
+ li.ngg-next a, li.ngg-prev a {
368
+ padding-top: 10px;
369
+ border: none;
370
+ text-decoration: none;
371
  }
css/ngg_shadow2.css CHANGED
@@ -1,379 +1,379 @@
1
- /*
2
- CSS Name: Shadow Effect with Description text
3
- Description: NextGEN Default Style with a Shadow effect and description text below the thumbnail
4
- Author: Alex Rabe
5
- Version: 1.60
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin-top: 10px;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- /*height: 130px;*/
24
- padding: 5px;
25
- margin-bottom: 5px;
26
- border: 1px solid #cccccc;
27
- overflow:hidden;
28
- }
29
-
30
- .ngg-albumtitle {
31
- text-align: left;
32
- font-weight: bold;
33
- margin:0px;
34
- padding:0px;
35
- font-size: 1.4em;
36
- margin-bottom: 10px;
37
- }
38
-
39
- .ngg-thumbnail {
40
- float: left;
41
- margin-right: 12px;
42
- }
43
-
44
- .ngg-thumbnail img {
45
- background-color:#FFFFFF;
46
- border:1px solid #A9A9A9;
47
- margin:4px 0px 4px 5px;
48
- padding:4px;
49
- position:relative;
50
- }
51
-
52
- .ngg-thumbnail img:hover {
53
- background-color: #A9A9A9;
54
- }
55
-
56
- .ngg-description {
57
- text-align: left;
58
- }
59
-
60
- /* ----------- Album Styles Compact -------------*/
61
-
62
- .ngg-album-compact {
63
- float:left;
64
- height:180px;
65
- padding-right:6px !important;
66
- margin:0px !important;
67
- text-align:left;
68
- width:120px;
69
- }
70
-
71
- .ngg-album-compactbox {
72
- background:transparent url(albumset.gif) no-repeat scroll 0%;
73
- height:86px;
74
- margin:0pt 0pt 6px !important;
75
- padding:12px 0pt 0pt 7px !important;
76
- width:120px;
77
- }
78
-
79
-
80
- .ngg-album-compactbox .Thumb {
81
- border:1px solid #000000;
82
- margin:0px !important;
83
- padding:0px !important;
84
- width:91px;
85
- height:68px;
86
- }
87
-
88
- .ngg-album-compact h4 {
89
- font-size:15px;
90
- font-weight:bold;
91
- margin-bottom:0px;
92
- margin-top:0px;
93
- width:110px;
94
- }
95
-
96
- .ngg-album-compact p {
97
- font-size:11px;
98
- margin-top:2px;
99
- }
100
-
101
- /* ----------- Gallery style -------------*/
102
-
103
- .ngg-galleryoverview {
104
- margin-top: 10px;
105
- width: 100%;
106
- clear:both;
107
- display:block !important;
108
- }
109
-
110
- .ngg-gallery-thumbnail-box {
111
- float: left;
112
- }
113
-
114
- .ngg-gallery-thumbnail {
115
- float: left;
116
- background: url(shadowAlpha.png) no-repeat bottom right !important;
117
- background: url(shadow.gif) no-repeat bottom right;
118
- margin: 10px 0 0 10px !important;
119
- padding:10px 15px 10px 15px;
120
- border-color:#EEEEEE;
121
- border-style:solid none none solid;
122
- border-width:1px medium medium 1px;
123
- }
124
-
125
- .ngg-gallery-thumbnail img {
126
- margin: -6px 6px 6px -6px;
127
- background-color:#FFFFFF;
128
- border:1px solid #A9A9A9;
129
- display:block;
130
- padding:4px;
131
- position:relative;
132
- }
133
-
134
- .ngg-gallery-thumbnail img:hover {
135
- background-color: #A9A9A9;
136
- }
137
-
138
- .ngg-gallery-thumbnail span {
139
- margin: -6px 6px 6px -6px;
140
- text-align:center;
141
- font-size:90%;
142
- color:#808080;
143
- display:block;
144
- }
145
-
146
- .ngg-clear {
147
- clear: both;
148
- }
149
-
150
- /* ----------- Gallery navigation -------------*/
151
-
152
- .ngg-navigation {
153
- font-size:0.9em !important;
154
- clear:both !important;
155
- display:block !important;
156
- padding-top:15px;
157
- text-align:center;
158
- }
159
-
160
- .ngg-navigation span {
161
- font-weight:bold;
162
- margin:0pt 6px;
163
- }
164
-
165
- .ngg-navigation a.page-numbers,
166
- .ngg-navigation a.next,
167
- .ngg-navigation a.prev,
168
- .ngg-navigation span.page-numbers,
169
- .ngg-navigation span.next,
170
- .ngg-navigation span.prev {
171
- border:1px solid #DDDDDD;
172
- margin-right:3px;
173
- padding:3px 7px;
174
- }
175
-
176
- .ngg-navigation a.page-numbers:hover,
177
- .ngg-navigation a.next:hover,
178
- .ngg-navigation a.prev:hover,
179
- .ngg-navigation span.page-numbers:hover,
180
- .ngg-navigation span.next:hover,
181
- .ngg-navigation span.prev:hover {
182
- background-color: #0066CC;
183
- color: #FFFFFF !important;
184
- text-decoration: none !important;
185
- }
186
-
187
- /* ----------- Image browser style -------------*/
188
-
189
- .ngg-imagebrowser {
190
-
191
- }
192
-
193
- .ngg-imagebrowser h3 {
194
- text-align:center;
195
- }
196
-
197
- .ngg-imagebrowser img {
198
- border:1px solid #A9A9A9;
199
- margin-top: 10px;
200
- margin-bottom: 10px;
201
- width: 100%;
202
- display:block !important;
203
- padding:5px;
204
- }
205
-
206
- .ngg-imagebrowser-nav {
207
- padding:5px;
208
- margin-left:10px;
209
- }
210
-
211
- .ngg-imagebrowser-nav .back {
212
- float:left;
213
- border:1px solid #DDDDDD;
214
- margin-right:3px;
215
- padding:3px 7px;
216
- }
217
-
218
- .ngg-imagebrowser-nav .next {
219
- float:right;
220
- border:1px solid #DDDDDD;
221
- margin-right:3px;
222
- padding:3px 7px;
223
- }
224
-
225
- .ngg-imagebrowser-nav .counter {
226
- text-align:center;
227
- font-size:0.9em !important;
228
- }
229
-
230
- .exif-data {
231
- margin-left: auto !important;
232
- margin-right: auto !important;
233
- }
234
-
235
- /* ----------- Slideshow -------------*/
236
- .slideshow {
237
- margin-left: auto;
238
- margin-right: auto;
239
- text-align:center;
240
- outline: none;
241
- }
242
-
243
- .slideshowlink {
244
-
245
- }
246
-
247
- /* ----------- JS Slideshow -------------*/
248
- .ngg-slideshow {
249
- overflow:hidden;
250
- position: relative;
251
- }
252
-
253
- .ngg-slideshow * {
254
- vertical-align:middle;
255
- }
256
-
257
- /* See also : http://www.brunildo.org/test/img_center.html */
258
- .ngg-slideshow-loader{
259
- display: table-cell;
260
- text-align: center;
261
- vertical-align:middle;
262
- }
263
-
264
- .ngg-slideshow-loader img{
265
- background: none !important;
266
- border: 0 none !important;
267
- margin:auto !important;
268
- }
269
-
270
- /* ----------- Single picture -------------*/
271
- .ngg-singlepic {
272
- background-color:#FFFFFF;
273
- display:block;
274
- padding:4px;
275
- }
276
-
277
- .ngg-left {
278
- float: left;
279
- margin-right:10px;
280
- }
281
-
282
- .ngg-right {
283
- float: right;
284
- margin-left:10px;
285
- }
286
-
287
- .ngg-center {
288
- margin-left: auto !important;
289
- margin-right: auto !important;
290
- }
291
-
292
- /* ----------- Sidebar widget -------------*/
293
-
294
- .ngg-widget,
295
- .ngg-widget-slideshow {
296
- overflow: hidden;
297
- margin:0pt;
298
- padding:5px 0px 0px 0pt;
299
- }
300
-
301
- .ngg-widget img {
302
- border:2px solid #A9A9A9;
303
- margin:0pt 2px 2px 0px;
304
- padding:1px;
305
- }
306
-
307
- /* ----------- Related images -------------*/
308
- .ngg-related-gallery {
309
- background:#F9F9F9;
310
- border:1px solid #E0E0E0;
311
- overflow:hidden;
312
- margin-bottom:1em;
313
- margin-top:1em;
314
- padding:5px;
315
- }
316
- .ngg-related-gallery img {
317
- border: 1px solid #DDDDDD;
318
- float: left;
319
- margin: 0pt 3px;
320
- padding: 2px;
321
- height: 50px;
322
- width: 50px;
323
- }
324
-
325
- .ngg-related-gallery img:hover {
326
- border: 1px solid #000000;
327
- }
328
-
329
- /* ----------- Gallery list -------------*/
330
-
331
- .ngg-galleryoverview ul li:before {
332
- content: '' !important;
333
- }
334
-
335
- .ngg-gallery-list {
336
- list-style-type:none;
337
- padding: 0px !important;
338
- text-indent:0px !important;
339
- }
340
-
341
- .ngg-galleryoverview div.pic img{
342
- width: 100%;
343
- }
344
-
345
- .ngg-gallery-list li {
346
- float:left;
347
- margin:0 2px 0px 2px !important;
348
- overflow:hidden;
349
- }
350
-
351
- .ngg-gallery-list li a {
352
- border:1px solid #CCCCCC;
353
- display:block;
354
- padding:2px;
355
- }
356
-
357
- .ngg-gallery-list li.selected a{
358
- -moz-background-clip:border;
359
- -moz-background-inline-policy:continuous;
360
- -moz-background-origin:padding;
361
- background:#000000 none repeat scroll 0 0;
362
- }
363
-
364
- .ngg-gallery-list li img {
365
- height:40px;
366
- width:40px;
367
- }
368
-
369
- li.ngg-next, li.ngg-prev {
370
- height:40px;
371
- width:40px;
372
- font-size:3.5em;
373
- }
374
-
375
- li.ngg-next a, li.ngg-prev a {
376
- padding-top: 10px;
377
- border: none;
378
- text-decoration: none;
379
  }
1
+ /*
2
+ CSS Name: Shadow Effect with Description text
3
+ Description: NextGEN Default Style with a Shadow effect and description text below the thumbnail
4
+ Author: Alex Rabe
5
+ Version: 1.60
6
+
7
+ This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
+ styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
+ it's only a template design
10
+
11
+ */
12
+
13
+ /* ----------- Album Styles Extend -------------*/
14
+
15
+ .ngg-albumoverview {
16
+ margin-top: 10px;
17
+ width: 100%;
18
+ clear:both;
19
+ display:block !important;
20
+ }
21
+
22
+ .ngg-album {
23
+ /*height: 130px;*/
24
+ padding: 5px;
25
+ margin-bottom: 5px;
26
+ border: 1px solid #cccccc;
27
+ overflow:hidden;
28
+ }
29
+
30
+ .ngg-albumtitle {
31
+ text-align: left;
32
+ font-weight: bold;
33
+ margin:0px;
34
+ padding:0px;
35
+ font-size: 1.4em;
36
+ margin-bottom: 10px;
37
+ }
38
+
39
+ .ngg-thumbnail {
40
+ float: left;
41
+ margin-right: 12px;
42
+ }
43
+
44
+ .ngg-thumbnail img {
45
+ background-color:#FFFFFF;
46
+ border:1px solid #A9A9A9;
47
+ margin:4px 0px 4px 5px;
48
+ padding:4px;
49
+ position:relative;
50
+ }
51
+
52
+ .ngg-thumbnail img:hover {
53
+ background-color: #A9A9A9;
54
+ }
55
+
56
+ .ngg-description {
57
+ text-align: left;
58
+ }
59
+
60
+ /* ----------- Album Styles Compact -------------*/
61
+
62
+ .ngg-album-compact {
63
+ float:left;
64
+ height:180px;
65
+ padding-right:6px !important;
66
+ margin:0px !important;
67
+ text-align:left;
68
+ width:120px;
69
+ }
70
+
71
+ .ngg-album-compactbox {
72
+ background:transparent url(albumset.gif) no-repeat scroll 0%;
73
+ height:86px;
74
+ margin:0pt 0pt 6px !important;
75
+ padding:12px 0pt 0pt 7px !important;
76
+ width:120px;
77
+ }
78
+
79
+
80
+ .ngg-album-compactbox .Thumb {
81
+ border:1px solid #000000;
82
+ margin:0px !important;
83
+ padding:0px !important;
84
+ width:91px;
85
+ height:68px;
86
+ }
87
+
88
+ .ngg-album-compact h4 {
89
+ font-size:15px;
90
+ font-weight:bold;
91
+ margin-bottom:0px;
92
+ margin-top:0px;
93
+ width:110px;
94
+ }
95
+
96
+ .ngg-album-compact p {
97
+ font-size:11px;
98
+ margin-top:2px;
99
+ }
100
+
101
+ /* ----------- Gallery style -------------*/
102
+
103
+ .ngg-galleryoverview {
104
+ margin-top: 10px;
105
+ width: 100%;
106
+ clear:both;
107
+ display:block !important;
108
+ }
109
+
110
+ .ngg-gallery-thumbnail-box {
111
+ float: left;
112
+ }
113
+
114
+ .ngg-gallery-thumbnail {
115
+ float: left;
116
+ background: url(shadowAlpha.png) no-repeat bottom right !important;
117
+ background: url(shadow.gif) no-repeat bottom right;
118
+ margin: 10px 0 0 10px !important;
119
+ padding:10px 15px 10px 15px;
120
+ border-color:#EEEEEE;
121
+ border-style:solid none none solid;
122
+ border-width:1px medium medium 1px;
123
+ }
124
+
125
+ .ngg-gallery-thumbnail img {
126
+ margin: -6px 6px 6px -6px;
127
+ background-color:#FFFFFF;
128
+ border:1px solid #A9A9A9;
129
+ display:block;
130
+ padding:4px;
131
+ position:relative;
132
+ }
133
+
134
+ .ngg-gallery-thumbnail img:hover {
135
+ background-color: #A9A9A9;
136
+ }
137
+
138
+ .ngg-gallery-thumbnail span {
139
+ margin: -6px 6px 6px -6px;
140
+ text-align:center;
141
+ font-size:90%;
142
+ color:#808080;
143
+ display:block;
144
+ }
145
+
146
+ .ngg-clear {
147
+ clear: both;
148
+ }
149
+
150
+ /* ----------- Gallery navigation -------------*/
151
+
152
+ .ngg-navigation {
153
+ font-size:0.9em !important;
154
+ clear:both !important;
155
+ display:block !important;
156
+ padding-top:15px;
157
+ text-align:center;
158
+ }
159
+
160
+ .ngg-navigation span {
161
+ font-weight:bold;
162
+ margin:0pt 6px;
163
+ }
164
+
165
+ .ngg-navigation a.page-numbers,
166
+ .ngg-navigation a.next,
167
+ .ngg-navigation a.prev,
168
+ .ngg-navigation span.page-numbers,
169
+ .ngg-navigation span.next,
170
+ .ngg-navigation span.prev {
171
+ border:1px solid #DDDDDD;
172
+ margin-right:3px;
173
+ padding:3px 7px;
174
+ }
175
+
176
+ .ngg-navigation a.page-numbers:hover,
177
+ .ngg-navigation a.next:hover,
178
+ .ngg-navigation a.prev:hover,
179
+ .ngg-navigation span.page-numbers:hover,
180
+ .ngg-navigation span.next:hover,
181
+ .ngg-navigation span.prev:hover {
182
+ background-color: #0066CC;
183
+ color: #FFFFFF !important;
184
+ text-decoration: none !important;
185
+ }
186
+
187
+ /* ----------- Image browser style -------------*/
188
+
189
+ .ngg-imagebrowser {
190
+
191
+ }
192
+
193
+ .ngg-imagebrowser h3 {
194
+ text-align:center;
195
+ }
196
+
197
+ .ngg-imagebrowser img {
198
+ border:1px solid #A9A9A9;
199
+ margin-top: 10px;
200
+ margin-bottom: 10px;
201
+ width: 100%;
202
+ display:block !important;
203
+ padding:5px;
204
+ }
205
+
206
+ .ngg-imagebrowser-nav {
207
+ padding:5px;
208
+ margin-left:10px;
209
+ }
210
+
211
+ .ngg-imagebrowser-nav .back {
212
+ float:left;
213
+ border:1px solid #DDDDDD;
214
+ margin-right:3px;
215
+ padding:3px 7px;
216
+ }
217
+
218
+ .ngg-imagebrowser-nav .next {
219
+ float:right;
220
+ border:1px solid #DDDDDD;
221
+ margin-right:3px;
222
+ padding:3px 7px;
223
+ }
224
+
225
+ .ngg-imagebrowser-nav .counter {
226
+ text-align:center;
227
+ font-size:0.9em !important;
228
+ }
229
+
230
+ .exif-data {
231
+ margin-left: auto !important;
232
+ margin-right: auto !important;
233
+ }
234
+
235
+ /* ----------- Slideshow -------------*/
236
+ .slideshow {
237
+ margin-left: auto;
238
+ margin-right: auto;
239
+ text-align:center;
240
+ outline: none;
241
+ }
242
+
243
+ .slideshowlink {
244
+
245
+ }
246
+
247
+ /* ----------- JS Slideshow -------------*/
248
+ .ngg-slideshow {
249
+ overflow:hidden;
250
+ position: relative;
251
+ }
252
+
253
+ .ngg-slideshow * {
254
+ vertical-align:middle;
255
+ }
256
+
257
+ /* See also : http://www.brunildo.org/test/img_center.html */
258
+ .ngg-slideshow-loader{
259
+ display: table-cell;
260
+ text-align: center;
261
+ vertical-align:middle;
262
+ }
263
+
264
+ .ngg-slideshow-loader img{
265
+ background: none !important;
266
+ border: 0 none !important;
267
+ margin:auto !important;
268
+ }
269
+
270
+ /* ----------- Single picture -------------*/
271
+ .ngg-singlepic {
272
+ background-color:#FFFFFF;
273
+ display:block;
274
+ padding:4px;
275
+ }
276
+
277
+ .ngg-left {
278
+ float: left;
279
+ margin-right:10px;
280
+ }
281
+
282
+ .ngg-right {
283
+ float: right;
284
+ margin-left:10px;
285
+ }
286
+
287
+ .ngg-center {
288
+ margin-left: auto !important;
289
+ margin-right: auto !important;
290
+ }
291
+
292
+ /* ----------- Sidebar widget -------------*/
293
+
294
+ .ngg-widget,
295
+ .ngg-widget-slideshow {
296
+ overflow: hidden;
297
+ margin:0pt;
298
+ padding:5px 0px 0px 0pt;
299
+ }
300
+
301
+ .ngg-widget img {
302
+ border:2px solid #A9A9A9;
303
+ margin:0pt 2px 2px 0px;
304
+ padding:1px;
305
+ }
306
+
307
+ /* ----------- Related images -------------*/
308
+ .ngg-related-gallery {
309
+ background:#F9F9F9;
310
+ border:1px solid #E0E0E0;
311
+ overflow:hidden;
312
+ margin-bottom:1em;
313
+ margin-top:1em;
314
+ padding:5px;
315
+ }
316
+ .ngg-related-gallery img {
317
+ border: 1px solid #DDDDDD;
318
+ float: left;
319
+ margin: 0pt 3px;
320
+ padding: 2px;
321
+ height: 50px;
322
+ width: 50px;
323
+ }
324
+
325
+ .ngg-related-gallery img:hover {
326
+ border: 1px solid #000000;
327
+ }
328
+
329
+ /* ----------- Gallery list -------------*/
330
+
331
+ .ngg-galleryoverview ul li:before {
332
+ content: '' !important;
333
+ }
334
+
335
+ .ngg-gallery-list {
336
+ list-style-type:none;
337
+ padding: 0px !important;
338
+ text-indent:0px !important;
339
+ }
340
+
341
+ .ngg-galleryoverview div.pic img{
342
+ width: 100%;
343
+ }
344
+
345
+ .ngg-gallery-list li {
346
+ float:left;
347
+ margin:0 2px 0px 2px !important;
348
+ overflow:hidden;
349
+ }
350
+
351
+ .ngg-gallery-list li a {
352
+ border:1px solid #CCCCCC;
353
+ display:block;
354
+ padding:2px;
355
+ }
356
+
357
+ .ngg-gallery-list li.selected a{
358
+ -moz-background-clip:border;
359
+ -moz-background-inline-policy:continuous;
360
+ -moz-background-origin:padding;
361
+ background:#000000 none repeat scroll 0 0;
362
+ }
363
+
364
+ .ngg-gallery-list li img {
365
+ height:40px;
366
+ width:40px;
367
+ }
368
+
369
+ li.ngg-next, li.ngg-prev {
370
+ height:40px;
371
+ width:40px;
372
+ font-size:3.5em;
373
+ }
374
+
375
+ li.ngg-next a, li.ngg-prev a {
376
+ padding-top: 10px;
377
+ border: none;
378
+ text-decoration: none;
379
  }
css/nggallery.css CHANGED
@@ -1,397 +1,401 @@
1
- /*
2
- CSS Name: Default Styles
3
- Description: NextGEN Default Gallery Stylesheet
4
- Author: Alex Rabe
5
- Version: 2.11
6
-
7
- This is a template stylesheet that can be used with NextGEN Gallery. I tested the
8
- styles with a default theme Kubrick. Modify it when your theme struggle with it,
9
- it's only a template design
10
-
11
- */
12
-
13
- /* ----------- Album Styles Extend -------------*/
14
-
15
- .ngg-albumoverview {
16
- margin-top: 10px;
17
- width: 100%;
18
- clear:both;
19
- display:block !important;
20
- }
21
-
22
- .ngg-album {
23
- height: 100%;
24
- padding: 5px;
25
- margin-bottom: 5px;
26
- border: 1px solid #fff;
27
- }
28
-
29
- /* IE6 will ignore this , again I hate IE6 */
30
- /* See also http://www.sitepoint.com/article/browser-specific-css-hacks */
31
- html>body .ngg-album {
32
- overflow:hidden;
33
- padding: 5px;
34
- margin-bottom: 5px;
35
- border: 1px solid #cccccc;
36
- }
37
-
38
- .ngg-album {
39
- overflow: hidden;
40
- padding: 5px;
41
- margin-bottom: 5px;
42
- border: 1px solid #cccccc;
43
- }
44
-
45
- .ngg-albumtitle {
46
- text-align: left;
47
- font-weight: bold;
48
- margin:0px;
49
- padding:0px;
50
- font-size: 1.4em;
51
- margin-bottom: 10px;
52
- }
53
-
54
- .ngg-thumbnail {
55
- float: left;
56
- margin-right: 12px;
57
- }
58
-
59
- .ngg-thumbnail img {
60
- background-color:#FFFFFF;
61
- border:1px solid #A9A9A9;
62
- margin:4px 0px 4px 5px;
63
- paddin