Gallery – Flagallery Photo Portfolio - Version 2.17

Version Description

  • After plugin update go to Skins page and update skins with 'Update skins' button.
  • If you use Facebook template and copied it in the root directory, then after each plugin update click 'Copy facebook.php file to root directory'.
  • If GRAND FlAGallery displays an error message after upgrade, go to FlAGallery Overview page and press 'Reset settings'.
  • Have some troubles with plugin? Try first reseting settings, deactivate and reactivate plugin.
Download this release

Release Info

Developer pasyuk
Plugin Icon 128x128 Gallery – Flagallery Photo Portfolio
Version 2.17
Comparing to
See all releases

Code changes from version 2.11 to 2.17

admin/addgallery.php CHANGED
@@ -24,14 +24,14 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
24
 
25
  if ($_POST['addgallery']){
26
  check_admin_referer('flag_addgallery');
27
- $newgallery = attribute_escape( $_POST['galleryname']);
28
  if ( !empty($newgallery) )
29
  flagAdmin::create_gallery($newgallery, $defaultpath);
30
  }
31
  if ($_POST['uploadimage']){
32
  check_admin_referer('flag_addgallery');
33
  if ($_FILES['MF__F_0_0']['error'] == 0) {
34
- $messagetext = flagAdmin::upload_images();
35
  }
36
  else
37
  flagGallery::show_error( __('Upload failed!','flag') );
@@ -81,7 +81,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
81
  jQuery("span.browsefiles").show().click(function(){
82
  jQuery("#file_browser").fileTree({
83
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
84
- root: jQuery("#galleryfolder").val(),
85
  }, function(file) {
86
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
87
  jQuery("#galleryfolder").val(file);
24
 
25
  if ($_POST['addgallery']){
26
  check_admin_referer('flag_addgallery');
27
+ $newgallery = esc_attr( $_POST['galleryname']);
28
  if ( !empty($newgallery) )
29
  flagAdmin::create_gallery($newgallery, $defaultpath);
30
  }
31
  if ($_POST['uploadimage']){
32
  check_admin_referer('flag_addgallery');
33
  if ($_FILES['MF__F_0_0']['error'] == 0) {
34
+ flagAdmin::upload_images();
35
  }
36
  else
37
  flagGallery::show_error( __('Upload failed!','flag') );
81
  jQuery("span.browsefiles").show().click(function(){
82
  jQuery("#file_browser").fileTree({
83
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
84
+ root: jQuery("#galleryfolder").val()
85
  }, function(file) {
86
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
87
  jQuery("#galleryfolder").val(file);
admin/admin.php CHANGED
@@ -292,7 +292,7 @@ class flagAdminPanel{
292
  function flag_wpmu_site_admin() {
293
  // Check for site admin
294
  if ( function_exists('is_site_admin') )
295
- if ( is_site_admin() )
296
  return true;
297
 
298
  return false;
292
  function flag_wpmu_site_admin() {
293
  // Check for site admin
294
  if ( function_exists('is_site_admin') )
295
+ if ( is_super_admin() )
296
  return true;
297
 
298
  return false;
admin/ajax.php CHANGED
@@ -23,9 +23,11 @@ function flag_ajax_operation() {
23
  switch ( $_POST['operation'] ) {
24
  case 'create_thumbnail' :
25
  $result = flagAdmin::create_thumbnail($picture);
 
26
  break;
27
  case 'resize_image' :
28
  $result = flagAdmin::resize_image($picture);
 
29
  break;
30
  case 'import_metadata' :
31
  $result = flagAdmin::import_MetaData( $id );
@@ -123,6 +125,7 @@ function flag_save_album() {
123
  $g = array();
124
  if(isset($_POST['form']))
125
  parse_str($_POST['form']);
 
126
  if($album_name && $album_id) {
127
  if(count($g))
128
  $galstring = implode(',', $g);
@@ -150,12 +153,13 @@ function flag_delete_album() {
150
  die('-1');
151
  // check for correct FlAG capability
152
  if ( !current_user_can('FlAG Manage gallery') )
153
- die('-1');
154
-
 
155
  if(isset($_POST['post'])) {
156
  $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagalbum WHERE id = %d", $_POST['post']) );
157
  }
158
-
159
  if($result) {
160
  _e('Success','flag');
161
  }
23
  switch ( $_POST['operation'] ) {
24
  case 'create_thumbnail' :
25
  $result = flagAdmin::create_thumbnail($picture);
26
+ do_action('flag_thumbnail_created', $picture);
27
  break;
28
  case 'resize_image' :
29
  $result = flagAdmin::resize_image($picture);
30
+ do_action('flag_image_resized', $picture);
31
  break;
32
  case 'import_metadata' :
33
  $result = flagAdmin::import_MetaData( $id );
125
  $g = array();
126
  if(isset($_POST['form']))
127
  parse_str($_POST['form']);
128
+ $result = false;
129
  if($album_name && $album_id) {
130
  if(count($g))
131
  $galstring = implode(',', $g);
153
  die('-1');
154
  // check for correct FlAG capability
155
  if ( !current_user_can('FlAG Manage gallery') )
156
+ die('-1');
157
+
158
+ $result = false;
159
  if(isset($_POST['post'])) {
160
  $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagalbum WHERE id = %d", $_POST['post']) );
161
  }
162
+
163
  if($result) {
164
  _e('Success','flag');
165
  }
admin/banner-box.php CHANGED
@@ -38,6 +38,7 @@ function flag_banner_controler() {
38
  $title = $_POST['playlist_title'];
39
  $descr = $_POST['playlist_descr'];
40
  $file = $_GET['playlist'];
 
41
  foreach($_POST['item_a'] as $item_id => $item) {
42
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
43
  continue;
@@ -113,7 +114,7 @@ jQuery(document).ready(function(){
113
  path: encodeURI(bannerfolder + crunch_list[0])
114
  },
115
  function( response ) {
116
- crunch_list.shift()
117
  var parts_done = parts - crunch_list.length;
118
  jQuery(".flag_crunching .flag_progress .flag_complete").animate({width:parts_done*(100/parts)+'%'}, 400);
119
  jQuery(".flag_crunching").append(response);
@@ -196,6 +197,7 @@ function flag_banner_wp_media_lib($added=false) {
196
  global $wpdb;
197
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
198
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
 
199
  if($added!==false) {
200
  $filepath .= '&amp;playlist='.$_GET['playlist'].'&amp;mode=save';
201
  $flag_options = get_option('flag_options');
@@ -208,17 +210,18 @@ function flag_banner_wp_media_lib($added=false) {
208
  <!--
209
  jQuery(document).ready(function(){
210
  jQuery('.cb :checkbox').click(function() {
 
211
  if(jQuery(this).is(':checked')){
212
- var cur = jQuery(this).val();
213
- var arr = jQuery('#items_array').val();
214
- if(arr) { var del = ','; } else { var del = ''; }
215
  jQuery('#items_array').val(arr+del+cur);
216
  } else {
217
- var cur = jQuery(this).val();
218
- var arr = jQuery('#items_array').val().split(',');
219
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
220
  jQuery('#items_array').val(arr);
221
- };
222
  });
223
  });
224
  function checkAll(form) {
@@ -238,20 +241,20 @@ function checkAll(form) {
238
  // this function check for a the number of selected images, sumbmit false when no one selected
239
  function checkSelected() {
240
  if(!jQuery('.cb input:checked')) {
241
- alert('<?php echo js_escape(__("No items selected", "flag")); ?>');
242
  return false;
243
- }
244
- actionId = jQuery('#bulkaction').val();
245
  switch (actionId) {
246
  case "new_playlist":
247
  showDialog('new_playlist', 160);
248
  return false;
249
  break;
250
  case "add_to_playlist":
251
- return confirm('<?php echo sprintf(js_escape(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
252
  break;
253
  }
254
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
255
  }
256
 
257
  function showDialog( windowId, height ) {
@@ -273,7 +276,7 @@ function showDialog( windowId, height ) {
273
  jQuery(function() {
274
  jQuery("#file_browser").fileTree({
275
  root: "<?php echo WINABSPATH; ?>",
276
- script: "<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/connectors/jqueryFileTree.php",
277
  }, function(file) {
278
  var path = file.replace("<?php echo WINABSPATH; ?>", "");
279
  jQuery("#bannerfolder").val(path);
38
  $title = $_POST['playlist_title'];
39
  $descr = $_POST['playlist_descr'];
40
  $file = $_GET['playlist'];
41
+ $data = array();
42
  foreach($_POST['item_a'] as $item_id => $item) {
43
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
44
  continue;
114
  path: encodeURI(bannerfolder + crunch_list[0])
115
  },
116
  function( response ) {
117
+ crunch_list.shift();
118
  var parts_done = parts - crunch_list.length;
119
  jQuery(".flag_crunching .flag_progress .flag_complete").animate({width:parts_done*(100/parts)+'%'}, 400);
120
  jQuery(".flag_crunching").append(response);
197
  global $wpdb;
198
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
199
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
200
+ $exclude = array();
201
  if($added!==false) {
202
  $filepath .= '&amp;playlist='.$_GET['playlist'].'&amp;mode=save';
203
  $flag_options = get_option('flag_options');
210
  <!--
211
  jQuery(document).ready(function(){
212
  jQuery('.cb :checkbox').click(function() {
213
+ var cur, arr, del;
214
  if(jQuery(this).is(':checked')){
215
+ cur = jQuery(this).val();
216
+ arr = jQuery('#items_array').val();
217
+ if(arr) { del = ','; } else { del = ''; }
218
  jQuery('#items_array').val(arr+del+cur);
219
  } else {
220
+ cur = jQuery(this).val();
221
+ arr = jQuery('#items_array').val().split(',');
222
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
223
  jQuery('#items_array').val(arr);
224
+ }
225
  });
226
  });
227
  function checkAll(form) {
241
  // this function check for a the number of selected images, sumbmit false when no one selected
242
  function checkSelected() {
243
  if(!jQuery('.cb input:checked')) {
244
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
245
  return false;
246
+ }
247
+ var actionId = jQuery('#bulkaction').val();
248
  switch (actionId) {
249
  case "new_playlist":
250
  showDialog('new_playlist', 160);
251
  return false;
252
  break;
253
  case "add_to_playlist":
254
+ return confirm('<?php echo sprintf(esc_js(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
255
  break;
256
  }
257
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
258
  }
259
 
260
  function showDialog( windowId, height ) {
276
  jQuery(function() {
277
  jQuery("#file_browser").fileTree({
278
  root: "<?php echo WINABSPATH; ?>",
279
+ script: "<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/connectors/jqueryFileTree.php"
280
  }, function(file) {
281
  var path = file.replace("<?php echo WINABSPATH; ?>", "");
282
  jQuery("#bannerfolder").val(path);
admin/banner.functions.php CHANGED
@@ -2,7 +2,7 @@
2
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
 
4
  function get_b_playlist_data( $playlist_file ) {
5
- global $wpdb;
6
  $playlist_content = file_get_contents($playlist_file);
7
 
8
  $playlist_data['title'] = flagGallery::flagGetBetween($playlist_content,'<title><![CDATA[',']]></title>');
@@ -60,7 +60,7 @@ function get_b_playlists($playlist_folder = '') {
60
  }
61
 
62
  function flagSave_bPlaylist($title,$descr,$data,$file='',$skinaction='') {
63
- global $wpdb;
64
  require_once(ABSPATH . '/wp-admin/includes/image.php');
65
  if(!trim($title)) {
66
  $title = 'default';
@@ -155,7 +155,7 @@ function flagSave_bPlaylist($title,$descr,$data,$file='',$skinaction='') {
155
  }
156
 
157
  function flagSave_bPlaylistSkin($file) {
158
- global $wpdb;
159
  $flag_options = get_option('flag_options');
160
  $playlistPath = ABSPATH.$flag_options['galleryPath'].'playlists/banner/'.$file.'.xml';
161
  // Save options
2
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
 
4
  function get_b_playlist_data( $playlist_file ) {
5
+
6
  $playlist_content = file_get_contents($playlist_file);
7
 
8
  $playlist_data['title'] = flagGallery::flagGetBetween($playlist_content,'<title><![CDATA[',']]></title>');
60
  }
61
 
62
  function flagSave_bPlaylist($title,$descr,$data,$file='',$skinaction='') {
63
+
64
  require_once(ABSPATH . '/wp-admin/includes/image.php');
65
  if(!trim($title)) {
66
  $title = 'default';
155
  }
156
 
157
  function flagSave_bPlaylistSkin($file) {
158
+
159
  $flag_options = get_option('flag_options');
160
  $playlistPath = ABSPATH.$flag_options['galleryPath'].'playlists/banner/'.$file.'.xml';
161
  // Save options
admin/css/flagallery_noflash.css CHANGED
@@ -9,11 +9,12 @@
9
  -o-user-select: none;
10
  user-select: none;
11
  }
12
- .flag_alternate { background-color: <?php echo $bg; ?>; margin: 7px 0; }
 
13
  .flag_alternate .flagcategory { width: 100%; height: auto; position: relative; text-align: center; padding-bottom: 4px; }
14
- .flag_alternate .flagcategory a.flag_pic_alt { display: inline-block; margin: 1px 0 0 1px; padding: 0; height: 100px; width: 115px; line-height: 96px; position:relative; z-index: 2; text-align: center; z-index:99; cursor:pointer; background-color: #ffffff; border: 2px solid #ffffff; text-decoration: none; background-image: url(../images/loadingAnimation.gif); background-repeat: no-repeat; background-position: 50% 50%; font-size: 8px; color: #ffffff; }
15
  .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc { display: none; padding: 4px; line-height: 140%; font-size: 12px; }
16
  .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc * { display: none; line-height: 140%; font-size: 12px !important; }
17
  .flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; text-decoration: none; z-index: 3; }
18
  .flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
19
- .flag_alternate .flagcategory a.flag_pic_alt > img { vertical-align: middle; display:inline-block; position: static; margin: 0 auto; padding: 0; border: none; height: 100px !important; width: 115px !important; max-width: 115px; min-width: 115px; }
9
  -o-user-select: none;
10
  user-select: none;
11
  }
12
+ div.flashalbum br { display: none; }
13
+ .flag_alternate { margin: 7px 0; }
14
  .flag_alternate .flagcategory { width: 100%; height: auto; position: relative; text-align: center; padding-bottom: 4px; }
15
+ .flag_alternate .flagcategory a.flag_pic_alt { display: inline-block; margin: 1px 0 0 1px; padding: 0; height: 100px; width: 115px; line-height: 96px; position:relative; overflow: hidden; text-align: center; z-index:99; cursor:pointer; background-color: #ffffff; border: 2px solid #ffffff; text-decoration: none; background-image: url(../images/loadingAnimation.gif); background-repeat: no-repeat; background-position: 50% 50%; font-size: 8px; color: #ffffff; }
16
  .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc { display: none; padding: 4px; line-height: 140%; font-size: 12px; }
17
  .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc * { display: none; line-height: 140%; font-size: 12px !important; }
18
  .flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; text-decoration: none; z-index: 3; }
19
  .flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
20
+ .flag_alternate .flagcategory a.flag_pic_alt > img { vertical-align: middle; display:inline-block; position: static; margin: 0 auto; padding: 0; border: none; height: auto !important; width: auto !important; min-height: 100px !important; min-width: 115px !important; max-height: 130px; max-width: 150px; }
admin/facebook-tool.php CHANGED
@@ -43,20 +43,21 @@ jQuery(document).ready(function() {
43
  if(l) l = '&l='+l; else l = '';
44
  fb_url(galleries,skin,h,l);
45
  jQuery('#galleries :checkbox').click(function(){
 
46
  if(jQuery(this).is(':checked')){
47
- var cur = jQuery(this).val();
48
  if(cur == 'all') {
49
  jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
50
  jQuery('#items_array').val(cur);
51
  } else {
52
  jQuery('#galleries input[value="all"]').removeAttr('checked');
53
- var arr = jQuery('#items_array').val();
54
- if(arr && arr != 'all') { var del = ','; } else { arr = ''; var del = ''; }
55
  jQuery('#items_array').val(arr+del+cur);
56
  }
57
  } else {
58
- var cur = jQuery(this).val();
59
- var arr = jQuery('#items_array').val().split(',');
60
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
61
  if(arr) {
62
  jQuery('#items_array').val(arr);
43
  if(l) l = '&l='+l; else l = '';
44
  fb_url(galleries,skin,h,l);
45
  jQuery('#galleries :checkbox').click(function(){
46
+ var cur, arr, del;
47
  if(jQuery(this).is(':checked')){
48
+ cur = jQuery(this).val();
49
  if(cur == 'all') {
50
  jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
51
  jQuery('#items_array').val(cur);
52
  } else {
53
  jQuery('#galleries input[value="all"]').removeAttr('checked');
54
+ arr = jQuery('#items_array').val();
55
+ if(arr && arr != 'all') { del = ','; } else { arr = ''; del = ''; }
56
  jQuery('#items_array').val(arr+del+cur);
57
  }
58
  } else {
59
+ cur = jQuery(this).val();
60
+ arr = jQuery('#items_array').val().split(',');
61
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
62
  if(arr) {
63
  jQuery('#items_array').val(arr);
admin/flag_install.php CHANGED
@@ -67,7 +67,7 @@ function flag_install () {
67
  }
68
 
69
 
70
- if($wpdb->get_var("show tables like '$flagallery'") != $flaggallery) {
71
 
72
  $sql = "CREATE TABLE " . $flaggallery . " (
73
  gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
67
  }
68
 
69
 
70
+ if($wpdb->get_var("show tables like '$flaggallery'") != $flaggallery) {
71
 
72
  $sql = "CREATE TABLE " . $flaggallery . " (
73
  gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
admin/functions.php CHANGED
@@ -9,14 +9,14 @@ class flagAdmin{
9
 
10
  /**
11
  * create a new gallery & folder
12
- *
13
  * @class flagAdmin
14
  * @param string $gallerytitle
15
  * @param string $defaultpath
16
  * @param bool $output if the function should show an error messsage or not
17
- * @return
18
  */
19
- function create_gallery($gallerytitle, $defaultpath, $output = true) {
20
  global $wpdb, $user_ID;
21
 
22
  // get the current user ID
@@ -93,7 +93,7 @@ class flagAdmin{
93
  $result = $wpdb->get_var("SELECT name FROM $wpdb->flaggallery WHERE name = '$galleryname' ");
94
 
95
  if ($result) {
96
- if ($output) flagGallery::show_error( __ngettext( 'Gallery', 'Galleries', 1, 'flag' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flag'));
97
  return false;
98
  } else {
99
  $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $flagpath, $gallerytitle , $user_ID) );
@@ -102,10 +102,6 @@ class flagAdmin{
102
  // here you can inject a custom function
103
  do_action('flag_created_new_gallery', $gallery_id);
104
 
105
- // return only the id if defined
106
- if ($return_id)
107
- return $gallery_id;
108
-
109
  if ($result) {
110
  $message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flag');
111
  $message = sprintf($message, stripcslashes($gallerytitle), '[flagallery gid=' . $gallery_id . ' name="' . stripcslashes($gallerytitle) . '"]');
@@ -115,19 +111,23 @@ class flagAdmin{
115
 
116
  if ($output) flagGallery::show_message($message);
117
  }
 
 
 
 
118
  return true;
119
  }
120
  }
121
-
122
  /**
123
  * flagAdmin::import_gallery()
124
  * TODO: Check permission of existing thumb folder & images
125
- *
126
  * @class flagAdmin
127
  * @param string $galleryfolder contains relative path
128
- * @return
129
  */
130
- function import_gallery($galleryfolder) {
131
 
132
  global $wpdb, $user_ID;
133
 
@@ -153,7 +153,7 @@ class flagAdmin{
153
  }
154
 
155
  // check & create thumbnail folder
156
- if ( !flagGallery::get_thumbnail_folder($gallerypath) )
157
  return;
158
 
159
  // take folder name as gallery name
@@ -209,14 +209,14 @@ class flagAdmin{
209
 
210
  /**
211
  * flagAdmin::import_video()
212
- *
213
  * @class flagAdmin
214
  * @param string $folder contains relative path
215
- * @return
216
  */
217
- function import_video($folder) {
218
- global $wpdb, $user_ID;
219
-
220
  $created_msg = '';
221
  // remove trailing slash at the end, if somebody use it
222
  $folder = rtrim($folder, '/');
@@ -250,14 +250,13 @@ class flagAdmin{
250
 
251
  /**
252
  * flagAdmin::import_mp3()
253
- *
254
  * @class flagAdmin
255
  * @param string $folder contains relative path
256
- * @return
257
  */
258
- function import_mp3($folder) {
259
- global $wpdb, $user_ID;
260
-
261
  $created_msg = '';
262
  // remove trailing slash at the end, if somebody use it
263
  $folder = rtrim($folder, '/');
@@ -291,27 +290,26 @@ class flagAdmin{
291
 
292
  /**
293
  * flagAdmin::import_banner()
294
- *
295
  * @class flagAdmin
296
  * @param string $folder contains relative path
297
- * @return
298
  */
299
- function import_banner($folder) {
300
- global $wpdb, $user_ID;
301
-
302
  $created_msg = '';
303
  // remove trailing slash at the end, if somebody use it
304
  $folder = rtrim($folder, '/');
305
  $path = WINABSPATH . $folder;
306
  if (!is_dir($path)) {
307
  echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('doesn&#96;t exist!', 'flag').'</p>';
308
- return ;
309
  }
310
  // read list of files
311
  $new_filelist = flagAdmin::scandir($path);
312
  if (empty($new_filelist)) {
313
  echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('does not contain image files', 'flag').'</p>';
314
- return;
315
  }
316
  $created_msg .= '<div class="message"><p>'.count($new_filelist).' '.__('image(s) in the folder','flag').':</p><div class="flag_crunching"><div class="flag_progress"><span class="flag_complete"></span><span class="txt">'.__('Crunching...','flag').'</span></div></div></div>';
317
  echo $created_msg;
@@ -333,6 +331,8 @@ class flagAdmin{
333
 
334
  $wp_filetype = wp_check_filetype( $file, null );
335
 
 
 
336
  extract( $wp_filetype );
337
 
338
  if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
@@ -349,7 +349,7 @@ class flagAdmin{
349
 
350
  $attachment = get_posts(array( 'post_type' => 'attachment', 'meta_key' => '_wp_attached_file', 'meta_value' => $uploads['subdir'] . '/' . $filename ));
351
  if ( !empty($attachment) )
352
- return $attachments[0]->ID;
353
 
354
  //Ok, Its in the uploads folder, But NOT in WordPress's media library.
355
  if ( preg_match("|(\d+)/(\d+)|", $mat[1], $datemat) ) //So lets set the date of the import to the date folder its in, IF its in a date folder.
@@ -427,9 +427,10 @@ class flagAdmin{
427
 
428
  /**
429
  * flagAdmin::scandir()
430
- *
431
  * @class flagAdmin
432
  * @param string $dirname
 
433
  * @return array
434
  */
435
  function scandir($dirname = '.', $ext = array()) {
@@ -454,7 +455,7 @@ class flagAdmin{
454
  * @param object | int $image contain all information about the image or the id
455
  * @return string result code
456
  */
457
- function create_thumbnail($image) {
458
 
459
  global $flag;
460
 
@@ -527,7 +528,7 @@ class flagAdmin{
527
  * @param integer $height optional
528
  * @return string result code
529
  */
530
- function resize_image($image, $width = 0, $height = 0) {
531
 
532
  global $flag;
533
 
@@ -571,10 +572,11 @@ class flagAdmin{
571
 
572
  /**
573
  * Add images to database
574
- *
575
  * @class flagAdmin
576
  * @param int $galleryID
577
  * @param array $imageslist
 
578
  * @return array $image_ids Id's which are sucessful added
579
  */
580
  function add_Images($galleryID, $imageslist, $name2alt = false) {
@@ -618,7 +620,7 @@ class flagAdmin{
618
  * @param array|int $imagesIds
619
  * @return bool
620
  */
621
- function import_MetaData($imagesIds) {
622
 
623
  global $wpdb;
624
 
@@ -640,7 +642,7 @@ class flagAdmin{
640
  // get the file date/time from exif
641
  $timestamp = $meta['timestamp'];
642
  // update database
643
- $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", attribute_escape($alttext), attribute_escape($description), $timestamp, $image->pid) );
644
  if ($result === false)
645
  return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
646
 
@@ -665,10 +667,11 @@ class flagAdmin{
665
  * @param array|int $imagesIds
666
  * @return bool
667
  */
668
- function copy_MetaData($imagesIds) {
669
 
670
  global $wpdb;
671
-
 
672
  require_once(FLAG_ABSPATH . 'lib/meta.php');
673
  require_once(FLAG_ABSPATH . 'lib/image.php');
674
 
@@ -679,7 +682,8 @@ class flagAdmin{
679
 
680
  $image = flagdb::find_image($imageID);
681
  if (!$image->error) {
682
-
 
683
  require_once(FLAG_ABSPATH . 'admin/grab_meta.php');
684
 
685
  // get the title
@@ -691,7 +695,7 @@ class flagAdmin{
691
  // get the file date/time from exif
692
  $makedescription = $alttext.$description.$makedescription;
693
  // update database
694
- $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", '', attribute_escape($makedescription), $timestamp, $image->pid) );
695
  if ($result === false)
696
  return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
697
 
@@ -705,10 +709,10 @@ class flagAdmin{
705
 
706
  /**
707
  * flagAdmin::get_MetaData()
708
- *
709
  * @class flagAdmin
710
  * @require Meta class
711
- * @param string $picPath must be Gallery absPath + filename
712
  * @return array metadata
713
  */
714
  function get_MetaData($id) {
@@ -735,7 +739,7 @@ class flagAdmin{
735
  * and if based on compat reason (pre V0.40) we save then some meta datas to the database
736
  *
737
  * @param int $id
738
- * @return result
739
  */
740
  function maybe_import_meta( $id ) {
741
 
@@ -786,7 +790,7 @@ class flagAdmin{
786
  * @class flagAdmin
787
  * @return void
788
  */
789
- function upload_images() {
790
 
791
  global $wpdb;
792
 
@@ -814,7 +818,7 @@ class flagAdmin{
814
  }
815
 
816
  // read list of images
817
- $dirlist = flagAdmin::scandir(WINABSPATH.$gallerypath);
818
 
819
  $imagefiles = $_FILES['imagefiles'];
820
 
@@ -894,13 +898,13 @@ class flagAdmin{
894
  * @param integer $galleryID
895
  * @return string $result
896
  */
897
- function swfupload_image($galleryID = 0) {
898
 
899
  global $wpdb;
900
 
901
  if ($galleryID == 0) {
902
- @unlink($temp_file);
903
- return __('No gallery selected!','flag');;
904
  }
905
 
906
  // WPMU action
@@ -920,7 +924,7 @@ class flagAdmin{
920
  // check for allowed extension
921
  $ext = array('jpeg', 'jpg', 'png', 'gif');
922
  if (!in_array($filepart['extension'], $ext))
923
- return $_FILES[$key]['name'] . __('is no valid image file!','flag');
924
 
925
  // get the path to the gallery
926
  $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->flaggallery WHERE gid = '$galleryID' ");
@@ -950,12 +954,13 @@ class flagAdmin{
950
  return __('Error, the file permissions could not set','flag');
951
 
952
  return '0';
953
- }
954
-
955
  /**
956
  * File upload error message
957
- *
958
  * @class flagAdmin
 
959
  * @return string $result
960
  */
961
  function file_upload_error_message($error_code) {
@@ -1021,7 +1026,7 @@ class flagAdmin{
1021
  * @param string $foldername
1022
  * @return bool $result
1023
  */
1024
- function check_safemode($foldername) {
1025
 
1026
  if ( SAFE_MODE ) {
1027
 
@@ -1046,7 +1051,7 @@ class flagAdmin{
1046
  * @param int $check_ID is the user_id
1047
  * @return bool $result
1048
  */
1049
- function can_manage_this_gallery($check_ID) {
1050
 
1051
  global $user_ID, $wp_roles;
1052
 
@@ -1067,7 +1072,7 @@ class flagAdmin{
1067
  * @param int $dest_gid destination gallery
1068
  * @return void
1069
  */
1070
- function move_images($pic_ids, $dest_gid) {
1071
 
1072
  $errors = '';
1073
  $count = 0;
@@ -1117,7 +1122,7 @@ class flagAdmin{
1117
  }
1118
 
1119
  // Move the thumbnail, if possible
1120
- !@rename($image->thumbPath, $destination_thumbnail);
1121
 
1122
  // Change the gallery id in the database , maybe the filename
1123
  if ( flagdb::update_image($image->pid, $dest_gid, $destination_file_name) )
@@ -1143,7 +1148,7 @@ class flagAdmin{
1143
  * @param int $dest_gid destination gallery
1144
  * @return void
1145
  */
1146
- function copy_images($pic_ids, $dest_gid) {
1147
 
1148
  $errors = $messages = '';
1149
 
@@ -1192,7 +1197,7 @@ class flagAdmin{
1192
  }
1193
 
1194
  // Copy the thumbnail if possible
1195
- !@copy($image->thumbPath, $destination_thumb_file_path);
1196
 
1197
  // Create new database entry for the image
1198
  $new_pid = flagdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
@@ -1236,7 +1241,7 @@ class flagAdmin{
1236
  * @param string $title name of the operation
1237
  * @return string the javascript output
1238
  */
1239
- function do_ajax_operation( $operation, $image_array, $title = '' ) {
1240
 
1241
  if ( !is_array($image_array) || empty($image_array) )
1242
  return;
@@ -1296,9 +1301,9 @@ class flagAdmin{
1296
  * Return a JSON coded array of Image ids for a requested gallery
1297
  *
1298
  * @param int $galleryID
1299
- * @return arry (JSON)
1300
  */
1301
- function get_image_ids( $galleryID ) {
1302
 
1303
  if ( !function_exists('json_encode') )
1304
  return(-2);
9
 
10
  /**
11
  * create a new gallery & folder
12
+ *
13
  * @class flagAdmin
14
  * @param string $gallerytitle
15
  * @param string $defaultpath
16
  * @param bool $output if the function should show an error messsage or not
17
+ * @return bool|int
18
  */
19
+ static function create_gallery($gallerytitle, $defaultpath, $output = true) {
20
  global $wpdb, $user_ID;
21
 
22
  // get the current user ID
93
  $result = $wpdb->get_var("SELECT name FROM $wpdb->flaggallery WHERE name = '$galleryname' ");
94
 
95
  if ($result) {
96
+ if ($output) flagGallery::show_error( _n( 'Gallery', 'Galleries', 1, 'flag' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flag'));
97
  return false;
98
  } else {
99
  $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $flagpath, $gallerytitle , $user_ID) );
102
  // here you can inject a custom function
103
  do_action('flag_created_new_gallery', $gallery_id);
104
 
 
 
 
 
105
  if ($result) {
106
  $message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flag');
107
  $message = sprintf($message, stripcslashes($gallerytitle), '[flagallery gid=' . $gallery_id . ' name="' . stripcslashes($gallerytitle) . '"]');
111
 
112
  if ($output) flagGallery::show_message($message);
113
  }
114
+ // return only the id if defined
115
+ if ($gallery_id)
116
+ return $gallery_id;
117
+
118
  return true;
119
  }
120
  }
121
+
122
  /**
123
  * flagAdmin::import_gallery()
124
  * TODO: Check permission of existing thumb folder & images
125
+ *
126
  * @class flagAdmin
127
  * @param string $galleryfolder contains relative path
128
+ * @return void
129
  */
130
+ static function import_gallery($galleryfolder) {
131
 
132
  global $wpdb, $user_ID;
133
 
153
  }
154
 
155
  // check & create thumbnail folder
156
+ if ( !flagGallery::create_thumbnail_folder($gallerypath) )
157
  return;
158
 
159
  // take folder name as gallery name
209
 
210
  /**
211
  * flagAdmin::import_video()
212
+ *
213
  * @class flagAdmin
214
  * @param string $folder contains relative path
215
+ * @return void
216
  */
217
+ static function import_video($folder) {
218
+
219
+
220
  $created_msg = '';
221
  // remove trailing slash at the end, if somebody use it
222
  $folder = rtrim($folder, '/');
250
 
251
  /**
252
  * flagAdmin::import_mp3()
253
+ *
254
  * @class flagAdmin
255
  * @param string $folder contains relative path
256
+ * @return void
257
  */
258
+ static function import_mp3($folder) {
259
+
 
260
  $created_msg = '';
261
  // remove trailing slash at the end, if somebody use it
262
  $folder = rtrim($folder, '/');
290
 
291
  /**
292
  * flagAdmin::import_banner()
293
+ *
294
  * @class flagAdmin
295
  * @param string $folder contains relative path
296
+ * @return array
297
  */
298
+ static function import_banner($folder) {
299
+
 
300
  $created_msg = '';
301
  // remove trailing slash at the end, if somebody use it
302
  $folder = rtrim($folder, '/');
303
  $path = WINABSPATH . $folder;
304
  if (!is_dir($path)) {
305
  echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('doesn&#96;t exist!', 'flag').'</p>';
306
+ return false;
307
  }
308
  // read list of files
309
  $new_filelist = flagAdmin::scandir($path);
310
  if (empty($new_filelist)) {
311
  echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('does not contain image files', 'flag').'</p>';
312
+ return false;
313
  }
314
  $created_msg .= '<div class="message"><p>'.count($new_filelist).' '.__('image(s) in the folder','flag').':</p><div class="flag_crunching"><div class="flag_progress"><span class="flag_complete"></span><span class="txt">'.__('Crunching...','flag').'</span></div></div></div>';
315
  echo $created_msg;
331
 
332
  $wp_filetype = wp_check_filetype( $file, null );
333
 
334
+ /** @var $type
335
+ * @var $ext */
336
  extract( $wp_filetype );
337
 
338
  if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
349
 
350
  $attachment = get_posts(array( 'post_type' => 'attachment', 'meta_key' => '_wp_attached_file', 'meta_value' => $uploads['subdir'] . '/' . $filename ));
351
  if ( !empty($attachment) )
352
+ return $attachment[0]->ID;
353
 
354
  //Ok, Its in the uploads folder, But NOT in WordPress's media library.
355
  if ( preg_match("|(\d+)/(\d+)|", $mat[1], $datemat) ) //So lets set the date of the import to the date folder its in, IF its in a date folder.
427
 
428
  /**
429
  * flagAdmin::scandir()
430
+ *
431
  * @class flagAdmin
432
  * @param string $dirname
433
+ * @param array $ext
434
  * @return array
435
  */
436
  function scandir($dirname = '.', $ext = array()) {
455
  * @param object | int $image contain all information about the image or the id
456
  * @return string result code
457
  */
458
+ static function create_thumbnail($image) {
459
 
460
  global $flag;
461
 
528
  * @param integer $height optional
529
  * @return string result code
530
  */
531
+ static function resize_image($image, $width = 0, $height = 0) {
532
 
533
  global $flag;
534
 
572
 
573
  /**
574
  * Add images to database
575
+ *
576
  * @class flagAdmin
577
  * @param int $galleryID
578
  * @param array $imageslist
579
+ * @param bool $name2alt
580
  * @return array $image_ids Id's which are sucessful added
581
  */
582
  function add_Images($galleryID, $imageslist, $name2alt = false) {
620
  * @param array|int $imagesIds
621
  * @return bool
622
  */
623
+ static function import_MetaData($imagesIds) {
624
 
625
  global $wpdb;
626
 
642
  // get the file date/time from exif
643
  $timestamp = $meta['timestamp'];
644
  // update database
645
+ $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", esc_attr($alttext), esc_attr($description), $timestamp, $image->pid) );
646
  if ($result === false)
647
  return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
648
 
667
  * @param array|int $imagesIds
668
  * @return bool
669
  */
670
+ static function copy_MetaData($imagesIds) {
671
 
672
  global $wpdb;
673
+
674
+ /** @var $meta */
675
  require_once(FLAG_ABSPATH . 'lib/meta.php');
676
  require_once(FLAG_ABSPATH . 'lib/image.php');
677
 
682
 
683
  $image = flagdb::find_image($imageID);
684
  if (!$image->error) {
685
+ /** @var $makedescription
686
+ * @var $timestamp */
687
  require_once(FLAG_ABSPATH . 'admin/grab_meta.php');
688
 
689
  // get the title
695
  // get the file date/time from exif
696
  $makedescription = $alttext.$description.$makedescription;
697
  // update database
698
+ $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", '', esc_attr($makedescription), $timestamp, $image->pid) );
699
  if ($result === false)
700
  return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
701
 
709
 
710
  /**
711
  * flagAdmin::get_MetaData()
712
+ *
713
  * @class flagAdmin
714
  * @require Meta class
715
+ * @param $id
716
  * @return array metadata
717
  */
718
  function get_MetaData($id) {
739
  * and if based on compat reason (pre V0.40) we save then some meta datas to the database
740
  *
741
  * @param int $id
742
+ * @return mixed result
743
  */
744
  function maybe_import_meta( $id ) {
745
 
790
  * @class flagAdmin
791
  * @return void
792
  */
793
+ static function upload_images() {
794
 
795
  global $wpdb;
796
 
818
  }
819
 
820
  // read list of images
821
+ $dirlist = flagAdmin::scandir(WINABSPATH.$gallery->path);
822
 
823
  $imagefiles = $_FILES['imagefiles'];
824
 
898
  * @param integer $galleryID
899
  * @return string $result
900
  */
901
+ static function swfupload_image($galleryID = 0) {
902
 
903
  global $wpdb;
904
 
905
  if ($galleryID == 0) {
906
+ //@unlink($temp_file);
907
+ return __('No gallery selected!','flag');
908
  }
909
 
910
  // WPMU action
924
  // check for allowed extension
925
  $ext = array('jpeg', 'jpg', 'png', 'gif');
926
  if (!in_array($filepart['extension'], $ext))
927
+ return $filename . __('is no valid image file!','flag');
928
 
929
  // get the path to the gallery
930
  $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->flaggallery WHERE gid = '$galleryID' ");
954
  return __('Error, the file permissions could not set','flag');
955
 
956
  return '0';
957
+ }
958
+
959
  /**
960
  * File upload error message
961
+ *
962
  * @class flagAdmin
963
+ * @param $error_code
964
  * @return string $result
965
  */
966
  function file_upload_error_message($error_code) {
1026
  * @param string $foldername
1027
  * @return bool $result
1028
  */
1029
+ static function check_safemode($foldername) {
1030
 
1031
  if ( SAFE_MODE ) {
1032
 
1051
  * @param int $check_ID is the user_id
1052
  * @return bool $result
1053
  */
1054
+ static function can_manage_this_gallery($check_ID) {
1055
 
1056
  global $user_ID, $wp_roles;
1057
 
1072
  * @param int $dest_gid destination gallery
1073
  * @return void
1074
  */
1075
+ static function move_images($pic_ids, $dest_gid) {
1076
 
1077
  $errors = '';
1078
  $count = 0;
1122
  }
1123
 
1124
  // Move the thumbnail, if possible
1125
+ @rename($image->thumbPath, $destination_thumbnail);
1126
 
1127
  // Change the gallery id in the database , maybe the filename
1128
  if ( flagdb::update_image($image->pid, $dest_gid, $destination_file_name) )
1148
  * @param int $dest_gid destination gallery
1149
  * @return void
1150
  */
1151
+ static function copy_images($pic_ids, $dest_gid) {
1152
 
1153
  $errors = $messages = '';
1154
 
1197
  }
1198
 
1199
  // Copy the thumbnail if possible
1200
+ @copy($image->thumbPath, $destination_thumb_file_path);
1201
 
1202
  // Create new database entry for the image
1203
  $new_pid = flagdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
1241
  * @param string $title name of the operation
1242
  * @return string the javascript output
1243
  */
1244
+ static function do_ajax_operation( $operation, $image_array, $title = '' ) {
1245
 
1246
  if ( !is_array($image_array) || empty($image_array) )
1247
  return;
1301
  * Return a JSON coded array of Image ids for a requested gallery
1302
  *
1303
  * @param int $galleryID
1304
+ * @return array (JSON)
1305
  */
1306
+ static function get_image_ids( $galleryID ) {
1307
 
1308
  if ( !function_exists('json_encode') )
1309
  return(-2);
admin/get_skin.php CHANGED
@@ -58,6 +58,7 @@ function get_skin_data( $skin_file, $type='' ) {
58
  );
59
  return $skin_data;
60
  }
 
61
  }
62
 
63
  /**
@@ -94,6 +95,7 @@ function get_skins($skin_folder='', $type='') {
94
  // Files in flash-album-gallery/skins directory
95
  $skins_dir = @ opendir( $skin_root);
96
  $skin_files = array();
 
97
  if ( $skins_dir ) {
98
  while (($file = readdir( $skins_dir ) ) !== false ) {
99
  if ( substr($file, 0, 1) == '.' )
58
  );
59
  return $skin_data;
60
  }
61
+ return false;
62
  }
63
 
64
  /**
95
  // Files in flash-album-gallery/skins directory
96
  $skins_dir = @ opendir( $skin_root);
97
  $skin_files = array();
98
+ $skins_subdir = '';
99
  if ( $skins_dir ) {
100
  while (($file = readdir( $skins_dir ) ) !== false ) {
101
  if ( substr($file, 0, 1) == '.' )
admin/jgallery.php CHANGED
@@ -32,11 +32,11 @@ if($altColors['FullWindow'] && !$isCrawler){
32
  }
33
  $xml['alt'] .= '</style>'.PHP_EOL;
34
  if(!$isCrawler){
35
- if(!$flag_options['jAlterGalScript']) {
36
  $xml['alt'] .= '<link href="'.plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.css').'" rel="stylesheet" type="text/css" />'.PHP_EOL;
37
  $xml['alt'] .= "<script type='text/javascript' src='".plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.pack.js')."'></script>".PHP_EOL;
38
  $xml['alt'] .= "<script type='text/javascript'>var ExtendVar='fancybox', hitajax = '".plugins_url('/lib/hitcounter.php', dirname(__FILE__))."';</script>".PHP_EOL;
39
- } else if($flag_options['jAlterGalScript'] == 1) {
40
  $xml['alt'] .= "<style type='text/css'>@import url('".plugins_url('/admin/js/photoswipe/photoswipe.css', dirname(__FILE__))."');</style>
41
  <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/klass.min.js', dirname(__FILE__))."'></script>
42
  <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/code.photoswipe.jquery-3.0.5.min.js', dirname(__FILE__))."'></script>
@@ -95,7 +95,7 @@ foreach ( $gID as $galID ) {
95
  $pid = intval($picture['pid']);
96
 
97
  if ($isCrawler){
98
- $xml['alt'] .= '<a style="display:block; overflow: hidden; height: auto; width: auto; margin-bottom: 10px; background-color: #eeeeee; background-position: 22px 44px; text-align: left;" class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'"><img style="float:left; margin-right: 10px;" title="'.strip_tags($picture['alttext']).'" alt="'.strip_tags($picture['alttext']).'" src="'.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].'" width="115" height="100" /><span style="display: block; overflow: hidden; text-decoration: none; color: #000; font-weight: normal;" class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.strip_tags($picture['alttext']).'</strong><br />'.strip_tags($picture['description'],'<b><u><i><span>').'</span></a>'.PHP_EOL;
99
  } else {
100
  $xml['alt'] .= '<a class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'" title="'.strip_tags($picture['alttext']).'">[img src='.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].']<span class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.htmlspecialchars($picture['alttext']).'</strong><br /><span>'.htmlspecialchars($picture['description']).'</span></span></a>'.PHP_EOL;
101
  }
32
  }
33
  $xml['alt'] .= '</style>'.PHP_EOL;
34
  if(!$isCrawler){
35
+ if(!intval($flag_options['jAlterGalScript'])) {
36
  $xml['alt'] .= '<link href="'.plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.css').'" rel="stylesheet" type="text/css" />'.PHP_EOL;
37
  $xml['alt'] .= "<script type='text/javascript' src='".plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.pack.js')."'></script>".PHP_EOL;
38
  $xml['alt'] .= "<script type='text/javascript'>var ExtendVar='fancybox', hitajax = '".plugins_url('/lib/hitcounter.php', dirname(__FILE__))."';</script>".PHP_EOL;
39
+ } else if(intval($flag_options['jAlterGalScript']) == 1) {
40
  $xml['alt'] .= "<style type='text/css'>@import url('".plugins_url('/admin/js/photoswipe/photoswipe.css', dirname(__FILE__))."');</style>
41
  <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/klass.min.js', dirname(__FILE__))."'></script>
42
  <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/code.photoswipe.jquery-3.0.5.min.js', dirname(__FILE__))."'></script>
95
  $pid = intval($picture['pid']);
96
 
97
  if ($isCrawler){
98
+ $xml['alt'] .= '<a style="display:block; overflow: hidden; height: 100px; width: 115px; margin-bottom: 10px; background-color: #eeeeee; background-position: 22px 44px; text-align: left;" class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'"><img style="float:left; margin-right: 10px; width: auto; height: auto; min-height:100px; min-width:115px;" title="'.strip_tags($picture['alttext']).'" alt="'.strip_tags($picture['alttext']).'" src="'.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].'" /><span style="display: block; overflow: hidden; text-decoration: none; color: #000; font-weight: normal;" class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.strip_tags($picture['alttext']).'</strong><br />'.strip_tags($picture['description'],'<b><u><i><span>').'</span></a>'.PHP_EOL;
99
  } else {
100
  $xml['alt'] .= '<a class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'" title="'.strip_tags($picture['alttext']).'">[img src='.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].']<span class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.htmlspecialchars($picture['alttext']).'</strong><br /><span>'.htmlspecialchars($picture['description']).'</span></span></a>'.PHP_EOL;
101
  }
admin/js/swfupload.swf CHANGED
Binary file
admin/manage-banner.php CHANGED
@@ -3,7 +3,7 @@
3
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.');}
4
 
5
  function flag_b_playlist_edit() {
6
- global $wpdb;
7
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
8
  $all_playlists = get_b_playlists();
9
  $flag_options = get_option('flag_options');
@@ -39,7 +39,7 @@ function checkSelected() {
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
- alert('<?php echo js_escape(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
@@ -47,11 +47,11 @@ function checkSelected() {
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
- return confirm('<?php echo sprintf(js_escape(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
@@ -62,7 +62,7 @@ function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
- elementlist = form.elements[i].value
66
  else
67
  elementlist += "," + form.elements[i].value ;
68
  }
@@ -92,7 +92,7 @@ jQuery(document).ready(function(){
92
  var skin = jQuery(this).val();
93
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
94
  });
95
- })
96
  //]]>
97
  </script>
98
 
@@ -195,9 +195,9 @@ jQuery(document).ready(function(){
195
  </tr>
196
  </tfoot>
197
  <tbody>
198
- <?php
 
199
  if(count($items_a)) {
200
- $counter = 0;
201
  $alt = ' class="alternate"';
202
  $uploads = wp_upload_dir();
203
  foreach($items_a as $item) {
3
  if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.');}
4
 
5
  function flag_b_playlist_edit() {
6
+
7
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
8
  $all_playlists = get_b_playlists();
9
  $flag_options = get_option('flag_options');
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
+ return confirm('<?php echo sprintf(esc_js(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
+ elementlist = form.elements[i].value;
66
  else
67
  elementlist += "," + form.elements[i].value ;
68
  }
92
  var skin = jQuery(this).val();
93
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
94
  });
95
+ });
96
  //]]>
97
  </script>
98
 
195
  </tr>
196
  </tfoot>
197
  <tbody>
198
+ <?php
199
+ $counter = 0;
200
  if(count($items_a)) {
 
201
  $alt = ' class="alternate"';
202
  $uploads = wp_upload_dir();
203
  foreach($items_a as $item) {
admin/manage-galleries.php CHANGED
@@ -60,7 +60,7 @@ function flag_manage_gallery_main() {
60
  var numchecked = getNumChecked(document.getElementById('editgalleries'));
61
 
62
  if(numchecked < 1) {
63
- alert('<?php echo js_escape(__('No images selected', 'flag')); ?>');
64
  return false;
65
  }
66
 
@@ -77,7 +77,7 @@ function flag_manage_gallery_main() {
77
  break;
78
  }
79
 
80
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
81
  }
82
 
83
  function showDialog( windowId, height ) {
@@ -88,7 +88,7 @@ function flag_manage_gallery_main() {
88
  if(form.elements[i].name == "doaction[]")
89
  if(form.elements[i].checked == true)
90
  if (elementlist == "")
91
- elementlist = form.elements[i].value
92
  else
93
  elementlist += "," + form.elements[i].value ;
94
  }
@@ -125,6 +125,7 @@ function flag_manage_gallery_main() {
125
  <option value="resize_images" ><?php _e("Resize images",'flag'); ?></option>
126
  <option value="import_meta" ><?php _e("Import metadata",'flag'); ?></option>
127
  <option value="copy_meta" ><?php _e("Metadata to description",'flag'); ?></option>
 
128
  </select>
129
  <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
130
  <?php endif; ?>
@@ -230,7 +231,6 @@ jQuery(document).ready(function(){
230
  var form = jQuery(this).attr('data-form');
231
  var edata = jQuery(this).dataset();
232
  edata.form = jQuery('#'+form).serialize()+'&'+jQuery(this).parents('.album').find('.album_categoties').sortable("serialize");
233
- ;
234
  jQuery.post( ajaxurl, edata,
235
  function( response ) {
236
  jQuery(e.target).parent().find('.alb_msg').show().html(response).fadeOut(1200);
60
  var numchecked = getNumChecked(document.getElementById('editgalleries'));
61
 
62
  if(numchecked < 1) {
63
+ alert('<?php echo esc_js(__('No images selected', 'flag')); ?>');
64
  return false;
65
  }
66
 
77
  break;
78
  }
79
 
80
+ 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.",'flag')), "' + numchecked + '") ; ?>');
81
  }
82
 
83
  function showDialog( windowId, height ) {
88
  if(form.elements[i].name == "doaction[]")
89
  if(form.elements[i].checked == true)
90
  if (elementlist == "")
91
+ elementlist = form.elements[i].value;
92
  else
93
  elementlist += "," + form.elements[i].value ;
94
  }
125
  <option value="resize_images" ><?php _e("Resize images",'flag'); ?></option>
126
  <option value="import_meta" ><?php _e("Import metadata",'flag'); ?></option>
127
  <option value="copy_meta" ><?php _e("Metadata to description",'flag'); ?></option>
128
+ <?php do_action('flag_manage_galleries_bulkaction'); ?>
129
  </select>
130
  <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
131
  <?php endif; ?>
231
  var form = jQuery(this).attr('data-form');
232
  var edata = jQuery(this).dataset();
233
  edata.form = jQuery('#'+form).serialize()+'&'+jQuery(this).parents('.album').find('.album_categoties').sortable("serialize");
 
234
  jQuery.post( ajaxurl, edata,
235
  function( response ) {
236
  jQuery(e.target).parent().find('.alb_msg').show().html(response).fadeOut(1200);
admin/manage-images.php CHANGED
@@ -60,8 +60,8 @@ function flag_picturelist() {
60
  // get the current author
61
  $act_author_user = get_userdata( (int) $gallery->author );
62
 
63
- }
64
-
65
  // list all galleries
66
  $gallerylist = $flagdb->find_all_galleries();
67
 
@@ -69,6 +69,7 @@ function flag_picturelist() {
69
  $gallery_columns = flag_manage_gallery_columns();
70
  $hidden_columns = get_hidden_columns('flag-manage-images');
71
  if($picturelist){
 
72
  foreach($picturelist as $p){
73
  $a_hits[] = $p->hitcounter;
74
  }
@@ -100,7 +101,7 @@ function showDialog( windowId, height ) {
100
  if(form.elements[i].name == "doaction[]")
101
  if(form.elements[i].checked == true)
102
  if (elementlist == "")
103
- elementlist = form.elements[i].value
104
  else
105
  elementlist += "," + form.elements[i].value ;
106
  }
@@ -144,7 +145,7 @@ function checkSelected() {
144
  var numchecked = getNumChecked(document.getElementById('updategallery'));
145
 
146
  if(numchecked < 1) {
147
- alert('<?php echo js_escape(__("No images selected", "flag")); ?>');
148
  return false;
149
  }
150
 
@@ -166,7 +167,7 @@ function checkSelected() {
166
  break;
167
  }
168
 
169
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
170
  }
171
 
172
  jQuery(document).ready( function() {
@@ -181,7 +182,7 @@ jQuery(document).ready( function() {
181
  <div class="wrap">
182
 
183
  <?php if ($is_search) :?>
184
- <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'flag'), wp_specialchars( get_search_query() ) ); ?></h2>
185
  <form class="search-form" action="" method="get">
186
  <p class="search-box">
187
  <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'flag' ); ?>:</label>
@@ -199,14 +200,14 @@ jQuery(document).ready( function() {
199
 
200
  <?php else :?>
201
 
202
- <h2><?php echo _n( 'Gallery', 'Galleries', 1, 'flag' ); ?> : <?php echo flagGallery::i18n($gallery->title); ?></h2>
203
  <select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value">
204
  <option selected="selected"><?php _e('Choose another gallery', 'flag'); ?></option>
205
  <?php
206
  foreach ($gallerylist as $gal) {
207
  if ($gal->gid != $act_gid) {
208
  ?>
209
- <option value="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gal->gid, 'flag_editgallery')?>" ><?php echo $gal->gid; ?> - <?php echo attribute_escape(stripslashes($gal->title)); ?></option>
210
  <?php
211
  }
212
  }
@@ -282,6 +283,7 @@ jQuery(document).ready( function() {
282
  <option value="copy_meta" ><?php _e("Metadata to description",'flag')?></option>
283
  <option value="copy_to" ><?php _e("Copy to...",'flag')?></option>
284
  <option value="move_to"><?php _e("Move to...",'flag')?></option>
 
285
  </select>
286
  <input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php _e("OK",'flag')?>" onclick="if ( !checkSelected() ) return false;" />
287
 
@@ -312,7 +314,7 @@ jQuery(document).ready( function() {
312
  <?php foreach($gallery_columns as $key=>$value){
313
  if ( in_array($key, $hidden_columns) )
314
  continue;
315
- if($key == 'cb' && !$header) { $value = ''; }
316
  echo $cols = '<th class="manage-column column-'.$key.'">'.$value.'</td>';
317
  }
318
  ?>
@@ -397,10 +399,10 @@ if($picturelist) {
397
  <p>
398
  <?php
399
  $actions = array();
400
- $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . attribute_escape(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flag') . '</a>';
401
  $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','flag') . '">' . __('Meta', 'flag') . '</a>';
402
  $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','flag') . '">' . __('Edit thumb', 'flag') . '</a>';
403
- $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&amp;mode=delpic&amp;gid=".$act_gid."&amp;pid=".$pid, 'flag_delpicture'). '" class="delete column-delete" onclick="javascript:check=confirm( \'' . attribute_escape(sprintf(__('Delete "%s"' , 'flag'), $picture->filename)). '\');if(check==false) return false;">' . __('Delete','flag') . '</a>';
404
  $action_count = count($actions);
405
  $i = 0;
406
  echo '<div class="row-actions">';
@@ -602,6 +604,7 @@ function flag_manage_gallery_columns() {
602
  $gallery_columns['alt_title_desc'] = __('Alt &amp; Title Text', 'flag') . ' / ' . __('Description', 'flag');
603
  $gallery_columns['exclude'] = '<img src="'.FLAG_URLPATH.'admin/images/lock.png" alt="member view" title="'.__('Only for logged in users', 'flag').'" />';
604
  //$gallery_columns['views'] = '<img src="'.FLAG_URLPATH.'admin/images/hits.png" alt="total views" title="'.__('Views', 'flag').'" />';
 
605
 
606
  return $gallery_columns;
607
  }
60
  // get the current author
61
  $act_author_user = get_userdata( (int) $gallery->author );
62
 
63
+ }
64
+
65
  // list all galleries
66
  $gallerylist = $flagdb->find_all_galleries();
67
 
69
  $gallery_columns = flag_manage_gallery_columns();
70
  $hidden_columns = get_hidden_columns('flag-manage-images');
71
  if($picturelist){
72
+ $a_hits = array();
73
  foreach($picturelist as $p){
74
  $a_hits[] = $p->hitcounter;
75
  }
101
  if(form.elements[i].name == "doaction[]")
102
  if(form.elements[i].checked == true)
103
  if (elementlist == "")
104
+ elementlist = form.elements[i].value;
105
  else
106
  elementlist += "," + form.elements[i].value ;
107
  }
145
  var numchecked = getNumChecked(document.getElementById('updategallery'));
146
 
147
  if(numchecked < 1) {
148
+ alert('<?php echo esc_js(__("No images selected", "flag")); ?>');
149
  return false;
150
  }
151
 
167
  break;
168
  }
169
 
170
+ 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.",'flag')), "' + numchecked + '") ; ?>');
171
  }
172
 
173
  jQuery(document).ready( function() {
182
  <div class="wrap">
183
 
184
  <?php if ($is_search) :?>
185
+ <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'flag'), esc_html( get_search_query() ) ); ?></h2>
186
  <form class="search-form" action="" method="get">
187
  <p class="search-box">
188
  <label class="hidden" for="media-search-input"><?php _e( 'Search Images', 'flag' ); ?>:</label>
200
 
201
  <?php else :?>
202
 
203
+ <h2><?php echo _n( 'Gallery', 'Galleries', 1, 'flag' ); ?> : <?php echo $gallery->title; ?></h2>
204
  <select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value">
205
  <option selected="selected"><?php _e('Choose another gallery', 'flag'); ?></option>
206
  <?php
207
  foreach ($gallerylist as $gal) {
208
  if ($gal->gid != $act_gid) {
209
  ?>
210
+ <option value="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gal->gid, 'flag_editgallery')?>" ><?php echo $gal->gid; ?> - <?php echo esc_attr(stripslashes($gal->title)); ?></option>
211
  <?php
212
  }
213
  }
283
  <option value="copy_meta" ><?php _e("Metadata to description",'flag')?></option>
284
  <option value="copy_to" ><?php _e("Copy to...",'flag')?></option>
285
  <option value="move_to"><?php _e("Move to...",'flag')?></option>
286
+ <?php do_action('flag_manage_images_bulkaction'); ?>
287
  </select>
288
  <input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php _e("OK",'flag')?>" onclick="if ( !checkSelected() ) return false;" />
289
 
314
  <?php foreach($gallery_columns as $key=>$value){
315
  if ( in_array($key, $hidden_columns) )
316
  continue;
317
+ if($key == 'cb') { $value = ''; }
318
  echo $cols = '<th class="manage-column column-'.$key.'">'.$value.'</td>';
319
  }
320
  ?>
399
  <p>
400
  <?php
401
  $actions = array();
402
+ $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flag') . '</a>';
403
  $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data','flag') . '">' . __('Meta', 'flag') . '</a>';
404
  $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail','flag') . '">' . __('Edit thumb', 'flag') . '</a>';
405
+ $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&amp;mode=delpic&amp;gid=".$act_gid."&amp;pid=".$pid, 'flag_delpicture'). '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s"' , 'flag'), $picture->filename)). '\');if(check==false) return false;">' . __('Delete','flag') . '</a>';
406
  $action_count = count($actions);
407
  $i = 0;
408
  echo '<div class="row-actions">';
604
  $gallery_columns['alt_title_desc'] = __('Alt &amp; Title Text', 'flag') . ' / ' . __('Description', 'flag');
605
  $gallery_columns['exclude'] = '<img src="'.FLAG_URLPATH.'admin/images/lock.png" alt="member view" title="'.__('Only for logged in users', 'flag').'" />';
606
  //$gallery_columns['views'] = '<img src="'.FLAG_URLPATH.'admin/images/hits.png" alt="total views" title="'.__('Views', 'flag').'" />';
607
+ $gallery_columns = apply_filters('flag_manage_images_columns', $gallery_columns);
608
 
609
  return $gallery_columns;
610
  }
admin/manage-playlist.php CHANGED
@@ -39,7 +39,7 @@ function checkSelected() {
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
- alert('<?php echo js_escape(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
@@ -47,11 +47,11 @@ function checkSelected() {
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
- return confirm('<?php echo sprintf(js_escape(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
@@ -62,9 +62,9 @@ function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
- elementlist = form.elements[i].value
66
  else
67
- elementlist += "," + form.elements[i].value ;
68
  }
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
@@ -93,7 +93,7 @@ jQuery(document).ready(function(){
93
  var skin = jQuery(this).val();
94
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
95
  });
96
- })
97
  //]]>
98
  </script>
99
 
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
+ return confirm('<?php echo sprintf(esc_js(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
+ elementlist = form.elements[i].value;
66
  else
67
+ elementlist += "," + form.elements[i].value;
68
  }
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
93
  var skin = jQuery(this).val();
94
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
95
  });
96
+ });
97
  //]]>
98
  </script>
99
 
admin/manage-sort.php CHANGED
@@ -6,7 +6,7 @@
6
  */
7
 
8
  function flag_sortorder($galleryID = 0){
9
- global $wpdb, $flag;
10
 
11
  if ($galleryID == 0) return;
12
 
@@ -38,10 +38,10 @@ function flag_sortorder($galleryID = 0){
38
 
39
  // set gallery url
40
  $act_gallery_url = get_option ('siteurl')."/".$act_gallery->path."/";
41
- $act_thumbnail_url = get_option ('siteurl')."/".$act_gallery->path.flagGallery::get_thumbnail_folder($act_gallery->path, FALSE);
42
 
43
  // look for presort args
44
- $picturelist = $wpdb->get_results("SELECT * FROM $wpdb->flagpictures WHERE galleryid = '$galleryID' ORDER BY sortorder {$dir}");
45
 
46
  //this is the url without any presort variable
47
  $base_url = admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
6
  */
7
 
8
  function flag_sortorder($galleryID = 0){
9
+ global $wpdb;
10
 
11
  if ($galleryID == 0) return;
12
 
38
 
39
  // set gallery url
40
  $act_gallery_url = get_option ('siteurl')."/".$act_gallery->path."/";
41
+ $act_thumbnail_url = get_option ('siteurl')."/".$act_gallery->path.flagGallery::create_thumbnail_folder($act_gallery->path, FALSE);
42
 
43
  // look for presort args
44
+ $picturelist = $wpdb->get_results("SELECT * FROM $wpdb->flagpictures WHERE galleryid = '$galleryID' ORDER BY sortorder");
45
 
46
  //this is the url without any presort variable
47
  $base_url = admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
admin/manage-video.php CHANGED
@@ -39,7 +39,7 @@ function checkSelected() {
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
- alert('<?php echo js_escape(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
@@ -47,11 +47,11 @@ function checkSelected() {
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
- return confirm('<?php echo sprintf(js_escape(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
@@ -62,9 +62,9 @@ function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
- elementlist = form.elements[i].value
66
  else
67
- elementlist += "," + form.elements[i].value ;
68
  }
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
@@ -93,7 +93,7 @@ jQuery(document).ready(function(){
93
  var skin = jQuery(this).val();
94
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
95
  });
96
- })
97
  //]]>
98
  </script>
99
 
39
  var numchecked = getNumChecked(document.getElementById('updatePlaylist'));
40
 
41
  if(numchecked < 1) {
42
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
43
  return false;
44
  }
45
 
47
 
48
  switch (actionId) {
49
  case "delete_items":
50
+ return confirm('<?php echo sprintf(esc_js(__("You are about to delete %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
51
  break;
52
  }
53
 
54
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s item(s) \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
55
  }
56
 
57
  function showDialog( windowId, height ) {
62
  if(form.elements[i].name == "doaction[]")
63
  if(form.elements[i].checked == true)
64
  if (elementlist == "")
65
+ elementlist = form.elements[i].value;
66
  else
67
+ elementlist += "," + form.elements[i].value;
68
  }
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
93
  var skin = jQuery(this).val();
94
  jQuery('#skinOptions').attr("href","<?php echo FLAG_URLPATH; ?>admin/skin_options.php?show_options=1&amp;skin="+skin+"&amp;TB_iframe=1&amp;width=600&amp;height=560");
95
  });
96
+ });
97
  //]]>
98
  </script>
99
 
admin/manage.php CHANGED
@@ -57,7 +57,9 @@ class flagManageGallery {
57
 
58
  function processor() {
59
  global $wpdb, $flag, $flagdb;
60
-
 
 
61
  // Delete a gallery
62
  if ($this->mode == 'delete') {
63
 
@@ -122,6 +124,7 @@ class flagManageGallery {
122
 
123
  check_admin_referer('flag_delpicture');
124
  $image = $flagdb->find_image( $this->pid );
 
125
  if ($image) {
126
  //if ($flag->options['deleteImg']) {
127
  @unlink($image->imagePath);
@@ -156,7 +159,9 @@ class flagManageGallery {
156
 
157
  function post_processor_galleries() {
158
  global $wpdb, $flag, $flagdb;
159
-
 
 
160
  // bulk update in a single gallery
161
  if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
162
 
@@ -214,7 +219,9 @@ class flagManageGallery {
214
 
215
  function post_processor_images() {
216
  global $wpdb, $flag, $flagdb;
217
-
 
 
218
  // bulk update in a single gallery
219
  if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
220
 
@@ -225,6 +232,7 @@ class flagManageGallery {
225
  break;
226
  case 'delete_images':
227
  if ( is_array($_POST['doaction']) ) {
 
228
  foreach ( $_POST['doaction'] as $imageID ) {
229
  $image = $flagdb->find_image( $imageID );
230
  if ($image) {
57
 
58
  function processor() {
59
  global $wpdb, $flag, $flagdb;
60
+
61
+ do_action('flag_manage_processor');
62
+
63
  // Delete a gallery
64
  if ($this->mode == 'delete') {
65
 
124
 
125
  check_admin_referer('flag_delpicture');
126
  $image = $flagdb->find_image( $this->pid );
127
+ $delete_pic = false;
128
  if ($image) {
129
  //if ($flag->options['deleteImg']) {
130
  @unlink($image->imagePath);
159
 
160
  function post_processor_galleries() {
161
  global $wpdb, $flag, $flagdb;
162
+
163
+ do_action('flag_manage_post_processor_galleries');
164
+
165
  // bulk update in a single gallery
166
  if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
167
 
219
 
220
  function post_processor_images() {
221
  global $wpdb, $flag, $flagdb;
222
+
223
+ do_action('flag_manage_post_processor_images');
224
+
225
  // bulk update in a single gallery
226
  if (isset ($_POST['bulkaction']) && isset ($_POST['doaction'])) {
227
 
232
  break;
233
  case 'delete_images':
234
  if ( is_array($_POST['doaction']) ) {
235
+ $delete_pic = false;
236
  foreach ( $_POST['doaction'] as $imageID ) {
237
  $image = $flagdb->find_image( $imageID );
238
  if ($image) {
admin/media-upload.php CHANGED
@@ -123,7 +123,7 @@ function media_upload_flag_form($errors) {
123
 
124
  <div class="alignleft actions">
125
  <select id="select_gal" name="select_gal" style="width:200px;">;
126
- <option value="0" <?php selected('0', $galleryID); ?> ><?php esc_attr( _e('No gallery',"flag") ); ?></option>
127
  <?php
128
  // Show gallery selection
129
  $gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->flaggallery ORDER BY gid ASC");
@@ -135,7 +135,7 @@ function media_upload_flag_form($errors) {
135
  }
136
  ?>
137
  </select>
138
- <input type="submit" id="show-gallery" value="<?php esc_attr( _e('Select &#187;','flag') ); ?>" class="button-secondary" />
139
  </div>
140
  <br style="clear:both;" />
141
  </div>
@@ -166,46 +166,46 @@ function media_upload_flag_form($errors) {
166
  ?>
167
  <div id='media-item-<?php echo $picid; ?>' class='media-item preloaded'>
168
  <div class='filename'></div>
169
- <a class='toggle describe-toggle-on' href='#'><?php esc_attr( _e('Show', "flag") ); ?></a>
170
- <a class='toggle describe-toggle-off' href='#'><?php esc_attr( _e('Hide', "flag") ); ?></a>
171
  <div class='filename new'><?php echo ( empty($picture->alttext) ) ? wp_html_excerpt($picture->filename,60): stripslashes( wp_html_excerpt($picture->alttext,60) ); ?></div>
172
  <table class='slidetoggle describe startclosed'><tbody>
173
  <tr>
174
  <td rowspan='4'><img class='thumbnail' alt='<?php echo esc_attr( $picture->alttext ); ?>' src='<?php echo esc_attr( $picture->thumbURL ); ?>'/></td>
175
- <td><?php esc_attr( _e('Image ID:', "flag") ); ?><?php echo $picid; ?></td>
176
  </tr>
177
  <tr><td><?php echo esc_attr( $picture->filename ); ?></td></tr>
178
  <tr><td><?php echo esc_attr( stripslashes($picture->alttext) ); ?></td></tr>
179
  <tr><td>&nbsp;</td></tr>
180
  <tr>
181
- <td class="label"><label for="image[<?php echo $picid; ?>][alttext]"><?php esc_attr( _e('Alt/Title text', "flag") ); ?></label></td>
182
  <td class="field"><input id="image[<?php echo $picid; ?>][alttext]" name="image[<?php echo $picid; ?>][alttext]" value="<?php echo esc_attr( stripslashes($picture->alttext) ); ?>" type="text"/></td>
183
  </tr>
184
  <tr>
185
- <td class="label"><label for="image[<?php echo $picid; ?>][description]"><?php esc_attr( _e("Description","flag") ); ?></label></td>
186
  <td class="field"><textarea name="image[<?php echo $picid; ?>][description]" id="image[<?php echo $picid; ?>][description]"><?php echo esc_attr( stripslashes($picture->description) ); ?></textarea></td>
187
  </tr>
188
  <tr class="align">
189
- <td class="label"><label for="image[<?php echo $picid; ?>][align]"><?php esc_attr( _e("Alignment") ); ?></label></td>
190
  <td class="field">
191
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-none-<?php echo $picid; ?>" checked="checked" value="none" type="radio" />
192
- <label for="image-align-none-<?php echo $picid; ?>" class="align image-align-none-label"><?php esc_attr( _e("None") ); ?></label>
193
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-left-<?php echo $picid; ?>" value="left" type="radio" />
194
- <label for="image-align-left-<?php echo $picid; ?>" class="align image-align-left-label"><?php esc_attr( _e("Left") ); ?></label>
195
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-center-<?php echo $picid; ?>" value="center" type="radio" />
196
- <label for="image-align-center-<?php echo $picid; ?>" class="align image-align-center-label"><?php esc_attr( _e("Center") ); ?></label>
197
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-right-<?php echo $picid; ?>" value="right" type="radio" />
198
- <label for="image-align-right-<?php echo $picid; ?>" class="align image-align-right-label"><?php esc_attr( _e("Right") ); ?></label>
199
  </td>
200
  </tr>
201
  <tr class="image-size">
202
- <th class="label"><label for="image[<?php echo $picid; ?>][size]"><span class="alignleft"><?php esc_attr( _e("Size") ); ?></span></label>
203
  </th>
204
  <td class="field">
205
  <input name="image[<?php echo $picid; ?>][size]" id="image-size-thumb-<?php echo $picid; ?>" type="radio" checked="checked" value="thumbnail" />
206
- <label for="image-size-thumb-<?php echo $picid; ?>"><?php esc_attr( _e("Thumbnail") ); ?></label>
207
  <input name="image[<?php echo $picid; ?>][size]" id="image-size-full-<?php echo $picid; ?>" type="radio" value="full" />
208
- <label for="image-size-full-<?php echo $picid; ?>"><?php esc_attr( _e("Full size") ); ?></label>
209
  </td>
210
  </tr>
211
  <tr class="submit">
@@ -223,7 +223,7 @@ function media_upload_flag_form($errors) {
223
  ?>
224
  </div>
225
  <p class="ml-submit">
226
- <input type="submit" class="button savebutton" name="save" value="<?php esc_attr( _e('Save all changes','flag') ); ?>" />
227
  </p>
228
  <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
229
  <input type="hidden" name="select_gal" id="select_gal" value="<?php echo (int) $galleryID; ?>" />
123
 
124
  <div class="alignleft actions">
125
  <select id="select_gal" name="select_gal" style="width:200px;">;
126
+ <option value="0" <?php selected('0', $galleryID); ?> ><?php _e('No gallery',"flag"); ?></option>
127
  <?php
128
  // Show gallery selection
129
  $gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->flaggallery ORDER BY gid ASC");
135
  }
136
  ?>
137
  </select>
138
+ <input type="submit" id="show-gallery" value="<?php _e('Select &#187;','flag'); ?>" class="button-secondary" />
139
  </div>
140
  <br style="clear:both;" />
141
  </div>
166
  ?>
167
  <div id='media-item-<?php echo $picid; ?>' class='media-item preloaded'>
168
  <div class='filename'></div>
169
+ <a class='toggle describe-toggle-on' href='#'><?php _e('Show', "flag"); ?></a>
170
+ <a class='toggle describe-toggle-off' href='#'><?php _e('Hide', "flag"); ?></a>
171
  <div class='filename new'><?php echo ( empty($picture->alttext) ) ? wp_html_excerpt($picture->filename,60): stripslashes( wp_html_excerpt($picture->alttext,60) ); ?></div>
172
  <table class='slidetoggle describe startclosed'><tbody>
173
  <tr>
174
  <td rowspan='4'><img class='thumbnail' alt='<?php echo esc_attr( $picture->alttext ); ?>' src='<?php echo esc_attr( $picture->thumbURL ); ?>'/></td>
175
+ <td><?php _e('Image ID:', "flag"); ?><?php echo $picid; ?></td>
176
  </tr>
177
  <tr><td><?php echo esc_attr( $picture->filename ); ?></td></tr>
178
  <tr><td><?php echo esc_attr( stripslashes($picture->alttext) ); ?></td></tr>
179
  <tr><td>&nbsp;</td></tr>
180
  <tr>
181
+ <td class="label"><label for="image[<?php echo $picid; ?>][alttext]"><?php _e('Alt/Title text', "flag"); ?></label></td>
182
  <td class="field"><input id="image[<?php echo $picid; ?>][alttext]" name="image[<?php echo $picid; ?>][alttext]" value="<?php echo esc_attr( stripslashes($picture->alttext) ); ?>" type="text"/></td>
183
  </tr>
184
  <tr>
185
+ <td class="label"><label for="image[<?php echo $picid; ?>][description]"><?php _e("Description","flag"); ?></label></td>
186
  <td class="field"><textarea name="image[<?php echo $picid; ?>][description]" id="image[<?php echo $picid; ?>][description]"><?php echo esc_attr( stripslashes($picture->description) ); ?></textarea></td>
187
  </tr>
188
  <tr class="align">
189
+ <td class="label"><label for="image[<?php echo $picid; ?>][align]"><?php _e("Alignment"); ?></label></td>
190
  <td class="field">
191
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-none-<?php echo $picid; ?>" checked="checked" value="none" type="radio" />
192
+ <label for="image-align-none-<?php echo $picid; ?>" class="align image-align-none-label"><?php _e("None"); ?></label>
193
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-left-<?php echo $picid; ?>" value="left" type="radio" />
194
+ <label for="image-align-left-<?php echo $picid; ?>" class="align image-align-left-label"><?php _e("Left"); ?></label>
195
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-center-<?php echo $picid; ?>" value="center" type="radio" />
196
+ <label for="image-align-center-<?php echo $picid; ?>" class="align image-align-center-label"><?php _e("Center"); ?></label>
197
  <input name="image[<?php echo $picid; ?>][align]" id="image-align-right-<?php echo $picid; ?>" value="right" type="radio" />
198
+ <label for="image-align-right-<?php echo $picid; ?>" class="align image-align-right-label"><?php _e("Right"); ?></label>
199
  </td>
200
  </tr>
201
  <tr class="image-size">
202
+ <th class="label"><label for="image[<?php echo $picid; ?>][size]"><span class="alignleft"><?php _e("Size"); ?></span></label>
203
  </th>
204
  <td class="field">
205
  <input name="image[<?php echo $picid; ?>][size]" id="image-size-thumb-<?php echo $picid; ?>" type="radio" checked="checked" value="thumbnail" />
206
+ <label for="image-size-thumb-<?php echo $picid; ?>"><?php _e("Thumbnail"); ?></label>
207
  <input name="image[<?php echo $picid; ?>][size]" id="image-size-full-<?php echo $picid; ?>" type="radio" value="full" />
208
+ <label for="image-size-full-<?php echo $picid; ?>"><?php _e("Full size"); ?></label>
209
  </td>
210
  </tr>
211
  <tr class="submit">
223
  ?>
224
  </div>
225
  <p class="ml-submit">
226
+ <input type="submit" class="button savebutton" name="save" value="<?php _e('Save all changes','flag'); ?>" />
227
  </p>
228
  <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
229
  <input type="hidden" name="select_gal" id="select_gal" value="<?php echo (int) $galleryID; ?>" />
admin/meta_box.php CHANGED
@@ -36,20 +36,21 @@ jQuery(document).ready(function() {
36
  if(wmode) wmode = ' wmode=transparent'; else wmode = ' wmode=window';
37
  short_code(galleries,skin,wmode);
38
  jQuery('#galleries :checkbox').click(function(){
 
39
  if(jQuery(this).is(':checked')){
40
- var cur = jQuery(this).val();
41
  if(cur == 'all') {
42
  jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
43
  jQuery('#mb_items_array').val(cur);
44
  } else {
45
  jQuery('#galleries input[value="all"]').removeAttr('checked');
46
- var arr = jQuery('#mb_items_array').val();
47
- if(arr && arr != 'all') { var del = ','; } else { arr = ''; var del = ''; }
48
  jQuery('#mb_items_array').val(arr+del+cur);
49
  }
50
  } else {
51
- var cur = jQuery(this).val();
52
- var arr = jQuery('#mb_items_array').val().split(',');
53
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
54
  if(arr) {
55
  jQuery('#mb_items_array').val(arr);
36
  if(wmode) wmode = ' wmode=transparent'; else wmode = ' wmode=window';
37
  short_code(galleries,skin,wmode);
38
  jQuery('#galleries :checkbox').click(function(){
39
+ var cur, arr, del;
40
  if(jQuery(this).is(':checked')){
41
+ cur = jQuery(this).val();
42
  if(cur == 'all') {
43
  jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
44
  jQuery('#mb_items_array').val(cur);
45
  } else {
46
  jQuery('#galleries input[value="all"]').removeAttr('checked');
47
+ arr = jQuery('#mb_items_array').val();
48
+ if(arr && arr != 'all') { del = ','; } else { arr = ''; del = ''; }
49
  jQuery('#mb_items_array').val(arr+del+cur);
50
  }
51
  } else {
52
+ cur = jQuery(this).val();
53
+ arr = jQuery('#mb_items_array').val().split(',');
54
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
55
  if(arr) {
56
  jQuery('#mb_items_array').val(arr);
admin/music-box.php CHANGED
@@ -36,6 +36,7 @@ function flag_music_controler() {
36
  $title = $_POST['playlist_title'];
37
  $descr = $_POST['playlist_descr'];
38
  $file = $_GET['playlist'];
 
39
  foreach($_POST['item_a'] as $item_id => $item) {
40
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
41
  continue;
@@ -161,17 +162,18 @@ function flag_music_wp_media_lib($added=false) {
161
  <!--
162
  jQuery(document).ready(function(){
163
  jQuery('.cb :checkbox').click(function() {
 
164
  if(jQuery(this).is(':checked')){
165
- var cur = jQuery(this).val();
166
- var arr = jQuery('#items_array').val();
167
- if(arr) { var del = ','; } else { var del = ''; }
168
  jQuery('#items_array').val(arr+del+cur);
169
  } else {
170
- var cur = jQuery(this).val();
171
- var arr = jQuery('#items_array').val().split(',');
172
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
173
  jQuery('#items_array').val(arr);
174
- };
175
  });
176
  jQuery('.del_thumb').click(function(){
177
  var id = jQuery(this).attr('data-id');
@@ -197,7 +199,7 @@ function checkAll(form) {
197
  // this function check for a the number of selected images, sumbmit false when no one selected
198
  function checkSelected() {
199
  if(!jQuery('.cb input:checked')) {
200
- alert('<?php echo js_escape(__('No items selected', 'flag')); ?>');
201
  return false;
202
  }
203
  actionId = jQuery('#bulkaction').val();
@@ -207,10 +209,10 @@ function checkSelected() {
207
  return false;
208
  break;
209
  case "add_to_playlist":
210
- return confirm('<?php echo sprintf(js_escape(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
211
  break;
212
  }
213
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
214
  }
215
 
216
  function showDialog( windowId, height ) {
@@ -244,7 +246,7 @@ function send_to_editor(html) {
244
  jQuery("span.browsefiles").show().click(function(){
245
  jQuery("#file_browser").fileTree({
246
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
247
- root: jQuery("#mp3folder").val(),
248
  }, function(file) {
249
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
250
  jQuery("#mp3folder").val(file);
36
  $title = $_POST['playlist_title'];
37
  $descr = $_POST['playlist_descr'];
38
  $file = $_GET['playlist'];
39
+ $data = array();
40
  foreach($_POST['item_a'] as $item_id => $item) {
41
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
42
  continue;
162
  <!--
163
  jQuery(document).ready(function(){
164
  jQuery('.cb :checkbox').click(function() {
165
+ var cur, arr, del;
166
  if(jQuery(this).is(':checked')){
167
+ cur = jQuery(this).val();
168
+ arr = jQuery('#items_array').val();
169
+ if(arr) { del = ','; } else { del = ''; }
170
  jQuery('#items_array').val(arr+del+cur);
171
  } else {
172
+ cur = jQuery(this).val();
173
+ arr = jQuery('#items_array').val().split(',');
174
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
175
  jQuery('#items_array').val(arr);
176
+ }
177
  });
178
  jQuery('.del_thumb').click(function(){
179
  var id = jQuery(this).attr('data-id');
199
  // this function check for a the number of selected images, sumbmit false when no one selected
200
  function checkSelected() {
201
  if(!jQuery('.cb input:checked')) {
202
+ alert('<?php echo esc_js(__('No items selected', 'flag')); ?>');
203
  return false;
204
  }
205
  actionId = jQuery('#bulkaction').val();
209
  return false;
210
  break;
211
  case "add_to_playlist":
212
+ return confirm('<?php echo sprintf(esc_js(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
213
  break;
214
  }
215
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
216
  }
217
 
218
  function showDialog( windowId, height ) {
246
  jQuery("span.browsefiles").show().click(function(){
247
  jQuery("#file_browser").fileTree({
248
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
249
+ root: jQuery("#mp3folder").val()
250
  }, function(file) {
251
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
252
  jQuery("#mp3folder").val(file);
admin/overview.php CHANGED
@@ -52,10 +52,10 @@ function flag_overview_server() {
52
  <div class="flag-dashboard-widget">
53
  <?php if (IS_WPMU) {
54
  if (flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck'))
55
- echo flag_SpaceManager::details();
56
  else {
57
  //TODO:WPMU message in WP2.5 style
58
- echo flag_SpaceManager::details();
59
  }
60
  } else { ?>
61
  <div class="dashboard-widget-content">
@@ -94,7 +94,7 @@ function flag_overview_graphic_lib() {
94
  * @return void
95
  */
96
  function flag_overview_setup(){
97
- global $wpdb, $flag;
98
 
99
  if (isset($_POST['resetdefault'])) {
100
  check_admin_referer('flag_uninstall');
@@ -187,13 +187,13 @@ function flag_overview_right_now() {
187
  <tbody>
188
  <tr class="first">
189
  <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=1"><?php echo $images; ?></a></td>
190
- <td class="t"><?php echo __ngettext( 'Image', 'Images', $images, 'flag' ); ?></td>
191
  <td class="b"></td>
192
  <td class="last"></td>
193
  </tr>
194
  <tr>
195
  <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=0"><?php echo $galleries; ?></a></td>
196
- <td class="t"><?php echo __ngettext( 'Gallery', 'Galleries', $galleries, 'flag' ); ?></td>
197
  <td class="b"></td>
198
  <td class="last"></td>
199
  </tr>
@@ -243,7 +243,7 @@ function flag_GD_info() {
243
  * Return localized Yes or no
244
  *
245
  * @param bool $bool
246
- * @return return 'Yes' | 'No'
247
  */
248
  function flag_GD_Support($bool){
249
  if($bool)
@@ -336,7 +336,7 @@ class flag_SpaceManager {
336
  return $quota;
337
  }
338
 
339
- function details() {
340
 
341
  // take default seetings
342
  $settings = array(
52
  <div class="flag-dashboard-widget">
53
  <?php if (IS_WPMU) {
54
  if (flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck'))
55
+ flag_SpaceManager::details();
56
  else {
57
  //TODO:WPMU message in WP2.5 style
58
+ flag_SpaceManager::details();
59
  }
60
  } else { ?>
61
  <div class="dashboard-widget-content">
94
  * @return void
95
  */
96
  function flag_overview_setup(){
97
+ global $flag;
98
 
99
  if (isset($_POST['resetdefault'])) {
100
  check_admin_referer('flag_uninstall');
187
  <tbody>
188
  <tr class="first">
189
  <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=1"><?php echo $images; ?></a></td>
190
+ <td class="t"><?php echo _n( 'Image', 'Images', $images, 'flag' ); ?></td>
191
  <td class="b"></td>
192
  <td class="last"></td>
193
  </tr>
194
  <tr>
195
  <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=0"><?php echo $galleries; ?></a></td>
196
+ <td class="t"><?php echo _n( 'Gallery', 'Galleries', $galleries, 'flag' ); ?></td>
197
  <td class="b"></td>
198
  <td class="last"></td>
199
  </tr>
243
  * Return localized Yes or no
244
  *
245
  * @param bool $bool
246
+ * @return string 'Yes' | 'No'
247
  */
248
  function flag_GD_Support($bool){
249
  if($bool)
336
  return $quota;
337
  }
338
 
339
+ static function details() {
340
 
341
  // take default seetings
342
  $settings = array(
admin/settings.php CHANGED
@@ -3,7 +3,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
3
 
4
  function flag_admin_options() {
5
 
6
- global $wpdb, $flag;
7
 
8
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
9
  $filepath = admin_url() . 'admin.php?page='.$_GET['page'];
@@ -11,9 +11,10 @@ function flag_admin_options() {
11
  if ( isset($_POST['updateoption']) ) {
12
  check_admin_referer('flag_settings');
13
  // get the hidden option fields, taken from WP core
 
14
  if ( $_POST['page_options'] )
15
  $options = explode(',', stripslashes($_POST['page_options']));
16
- if ($options) {
17
  foreach ($options as $option) {
18
  $option = trim($option);
19
  $value = trim($_POST[$option]);
@@ -195,7 +196,7 @@ jQuery(document).ready(function() {
195
  <h3><?php _e('Image settings','flag'); ?></h3>
196
  <table class="form-table flag-options">
197
  <tr valign="top">
198
- <th scope="row" width="200"><label for="fixratio"><?php _e('Resize Images','flag'); ?></label><br /><small>(Manage Gallery -> 'Resize Images' action)</small></th>
199
  <td><input type="hidden" name="imgResize" value="1" <?php checked('1', $flag_options['imgResize']); ?> />
200
  <input type="text" size="5" name="imgWidth" value="<?php echo $flag_options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $flag_options['imgHeight']; ?>" />
201
  <span class="setting-description"><?php _e('Width x Height (in pixel). Flash Album Gallery will keep ratio size','flag'); ?></span></td>
@@ -215,9 +216,10 @@ jQuery(document).ready(function() {
215
  <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $flag_options['galSort']); ?> /> <?php _e('Image ID', 'flag'); ?></label><br />
216
  <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $flag_options['galSort']); ?> /> <?php _e('File name', 'flag'); ?></label><br />
217
  <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $flag_options['galSort']); ?> /> <?php _e('Alt / Title text', 'flag'); ?></label><br />
218
- <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $flag_options['galSort']); ?> /> <?php _e('Date / Time', 'flag'); ?></label>
219
- <label><input name="galSort" type="radio" value="hitcounter" <?php checked('hitcounter', $flag_options['galSort']); ?> /> <?php _e('Image views', 'flag'); ?></label>
220
- <label><input name="galSort" type="radio" value="total_votes" <?php checked('total_votes', $flag_options['galSort']); ?> /> <?php _e('Image likes', 'flag'); ?></label>
 
221
  </td>
222
  </tr>
223
  <tr>
@@ -377,7 +379,7 @@ jQuery(document).ready(function() {
377
  </tr>
378
  <tr valign="top">
379
  <th scope="row" style="white-space: nowrap"><?php _e('Facebook page', 'flag'); ?>:</th>
380
- <td><label for="facebook_page"><select style="width: 150px;" name="facebook_page" id="change_options"><?php wp_dropdown_roles( flag_get_role('FlAG Facebook page') ); ?></select></label></td>
381
  </tr>
382
  </table>
383
  <div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php _e('Update capabilities', 'flag'); ?>"/></div>
3
 
4
  function flag_admin_options() {
5
 
6
+ global $flag;
7
 
8
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
9
  $filepath = admin_url() . 'admin.php?page='.$_GET['page'];
11
  if ( isset($_POST['updateoption']) ) {
12
  check_admin_referer('flag_settings');
13
  // get the hidden option fields, taken from WP core
14
+ $options=array();
15
  if ( $_POST['page_options'] )
16
  $options = explode(',', stripslashes($_POST['page_options']));
17
+ if (!empty($options)) {
18
  foreach ($options as $option) {
19
  $option = trim($option);
20
  $value = trim($_POST[$option]);
196
  <h3><?php _e('Image settings','flag'); ?></h3>
197
  <table class="form-table flag-options">
198
  <tr valign="top">
199
+ <th scope="row" width="200"><label><?php _e('Resize Images','flag'); ?></label><br /><small>(Manage Gallery -> 'Resize Images' action)</small></th>
200
  <td><input type="hidden" name="imgResize" value="1" <?php checked('1', $flag_options['imgResize']); ?> />
201
  <input type="text" size="5" name="imgWidth" value="<?php echo $flag_options['imgWidth']; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $flag_options['imgHeight']; ?>" />
202
  <span class="setting-description"><?php _e('Width x Height (in pixel). Flash Album Gallery will keep ratio size','flag'); ?></span></td>
216
  <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $flag_options['galSort']); ?> /> <?php _e('Image ID', 'flag'); ?></label><br />
217
  <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $flag_options['galSort']); ?> /> <?php _e('File name', 'flag'); ?></label><br />
218
  <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $flag_options['galSort']); ?> /> <?php _e('Alt / Title text', 'flag'); ?></label><br />
219
+ <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $flag_options['galSort']); ?> /> <?php _e('Date / Time', 'flag'); ?></label><br />
220
+ <label><input name="galSort" type="radio" value="hitcounter" <?php checked('hitcounter', $flag_options['galSort']); ?> /> <?php _e('Image views', 'flag'); ?></label><br />
221
+ <label><input name="galSort" type="radio" value="total_votes" <?php checked('total_votes', $flag_options['galSort']); ?> /> <?php _e('Image likes', 'flag'); ?></label><br />
222
+ <label><input name="galSort" type="radio" value="rand()" <?php checked('rand()', $flag_options['galSort']); ?> /> <?php _e('Randomly', 'flag'); ?></label>
223
  </td>
224
  </tr>
225
  <tr>
379
  </tr>
380
  <tr valign="top">
381
  <th scope="row" style="white-space: nowrap"><?php _e('Facebook page', 'flag'); ?>:</th>
382
+ <td><label for="facebook_page"><select style="width: 150px;" name="facebook_page" id="facebook_page"><?php wp_dropdown_roles( flag_get_role('FlAG Facebook page') ); ?></select></label></td>
383
  </tr>
384
  </table>
385
  <div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php _e('Update capabilities', 'flag'); ?>"/></div>
admin/skin_options.php CHANGED
@@ -23,6 +23,7 @@ if(isset($properties_skin) && !empty($properties_skin)) {
23
  if(!$fp) {
24
  exit( "2");//Failure - not read;
25
  }
 
26
  while(!feof($fp)) {
27
  $mainXML .= fgetc($fp);
28
  }
@@ -59,7 +60,7 @@ function flag_skin_options() {
59
  var flashvars = {
60
  path : "<?php echo $settings; ?>",
61
  constructor : "<?php echo $constructor; ?>",
62
- skin : "<?php echo $act_skin; ?>",
63
  };
64
  var params = {
65
  wmode : "transparent",
23
  if(!$fp) {
24
  exit( "2");//Failure - not read;
25
  }
26
+ $mainXML = '';
27
  while(!feof($fp)) {
28
  $mainXML .= fgetc($fp);
29
  }
60
  var flashvars = {
61
  path : "<?php echo $settings; ?>",
62
  constructor : "<?php echo $constructor; ?>",
63
+ skin : "<?php echo $act_skin; ?>"
64
  };
65
  var params = {
66
  wmode : "transparent",
admin/skins.php CHANGED
@@ -11,6 +11,7 @@ if ( !is_user_logged_in() )
11
  if ( !current_user_can('FlAG Change skin') )
12
  die('-1');
13
 
 
14
  $flag_options = get_option('flag_options');
15
 
16
  require_once (dirname (__FILE__) . '/get_skin.php');
@@ -52,6 +53,7 @@ function upload_skin() {
52
  if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) {
53
  echo "<p>".$uploads['error']."</p>\n";
54
  } else {
 
55
  if ( !empty($_FILES) ) {
56
  $filename = $_FILES['skinzip']['name'];
57
  } else if ( isset($_GET['package']) ) {
@@ -74,7 +76,8 @@ function upload_skin() {
74
  } else {
75
  $local_file = $uploads['basedir'] . '/' . $filename;
76
  }
77
- if( $installed_skin = do_skin_install_local_package($local_file, $filename) ) {
 
78
  if ( file_exists($installed_skin.basename($installed_skin).'.png') ) {
79
  @rename($installed_skin.basename($installed_skin).'.png', $installed_skin.'screenshot.png');
80
  }
@@ -90,7 +93,7 @@ function upload_skin() {
90
  $content = str_replace('/../../flag-config.php','/../../flash-album-gallery/flag-config.php',$content);
91
  $fp = fopen($installed_skin.'xml.php','w');
92
  if( fwrite($fp,$content) === FALSE ) {
93
- echo "<p>".sprintf(__("Failed to search string '/../../flag-config.php' and replace with '/../../flash-album-gallery/flag-config.php' in file '%1$s'",'flag'),
94
  $installed_skin.'xml.php').'</p>';
95
  }
96
  fclose($fp);
@@ -129,6 +132,7 @@ function flag_skin_options_tab() {
129
  if ( isset($_POST['updateskinoption']) ) {
130
  check_admin_referer('skin_settings');
131
  // get the hidden option fields, taken from WP core
 
132
  if ( $_POST['skin_options'] )
133
  $options = explode(',', stripslashes($_POST['skin_options']));
134
  elseif ( $_POST['skinoptions'] )
@@ -155,7 +159,7 @@ if ( isset($_POST['updateskinoption']) ) {
155
  if ( isset($_POST['license_key']) ) {
156
  check_admin_referer('skin-api');
157
  $license_key = mysql_real_escape_string($_POST['license_key']);
158
- $flag_options['license_key'] = $license_key;
159
  update_option('flag_options', $flag_options);
160
  flagGallery::show_message(__('License Key Updated','flag'));
161
  }
@@ -185,6 +189,7 @@ if(!empty($flag_options['license_key'])){
185
  if ( isset($_POST['updateoption']) ) {
186
  check_admin_referer('flag_settings');
187
  // get the hidden option fields, taken from WP core
 
188
  if ( $_POST['page_options'] )
189
  $options = explode(',', stripslashes($_POST['page_options']));
190
  if ($options) {
@@ -438,7 +443,7 @@ $total_all_skins = count($all_skins);
438
  <?php }
439
  if ( current_user_can('FlAG Delete skins') ) {
440
  if ( dirname($skin_file) != $flag_options['flashSkin'] ) { ?>
441
- <br /><br /><a class="delete" onclick="javascript:check=confirm( \'<?php echo attribute_escape(sprintf(__('Delete "%s"' , 'flag'), $skin_data['Name'])); ?>\');if(check==false) return false;" href="<?php echo admin_url('admin.php?page=flag-skins&delete='.dirname($skin_file)); ?>" title="<?php _e( 'Delete this skin', 'flag' ); ?>"><?php _e('Delete', 'flag' ); ?></a>
442
  <?php }
443
  } ?>
444
  </td>
@@ -446,6 +451,11 @@ $total_all_skins = count($all_skins);
446
  <?php } ?>
447
  </tbody>
448
  </table>
 
 
 
 
 
449
  </div>
450
 
451
  <div class="postbox metabox-holder" id="newskins" style="width: 29%; float: right; padding-top: 5px;">
@@ -457,7 +467,7 @@ $total_all_skins = count($all_skins);
457
  <div class="skin <?php echo $skin['type'].' '.$skin['status']; ?>" id="uid-<?php echo $skin['uid']; ?>" style="padding: 10px; float:left;">
458
  <center>
459
  <p><strong style="font-size: 120%;"><?php echo $skin['title']; ?></strong> <span class="version"><?php echo 'v'.$skin['version']; ?></span></p>
460
- <div class="screenshot"><img src="<?php echo $skin['screenshot']; ?>" width="200" height="184" /></div>
461
  </center>
462
  <div class="content">
463
  <div class="links" style="text-align: center;">
11
  if ( !current_user_can('FlAG Change skin') )
12
  die('-1');
13
 
14
+ global $flag;
15
  $flag_options = get_option('flag_options');
16
 
17
  require_once (dirname (__FILE__) . '/get_skin.php');
53
  if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) {
54
  echo "<p>".$uploads['error']."</p>\n";
55
  } else {
56
+ $filename = false;
57
  if ( !empty($_FILES) ) {
58
  $filename = $_FILES['skinzip']['name'];
59
  } else if ( isset($_GET['package']) ) {
76
  } else {
77
  $local_file = $uploads['basedir'] . '/' . $filename;
78
  }
79
+ $installed_skin = do_skin_install_local_package($local_file, $filename);
80
+ if( $installed_skin && is_string($installed_skin) ) {
81
  if ( file_exists($installed_skin.basename($installed_skin).'.png') ) {
82
  @rename($installed_skin.basename($installed_skin).'.png', $installed_skin.'screenshot.png');
83
  }
93
  $content = str_replace('/../../flag-config.php','/../../flash-album-gallery/flag-config.php',$content);
94
  $fp = fopen($installed_skin.'xml.php','w');
95
  if( fwrite($fp,$content) === FALSE ) {
96
+ echo "<p>".sprintf(__('Failed to search string \'/../../flag-config.php\' and replace with \'/../../flash-album-gallery/flag-config.php\' in file \'%1$s\'','flag'),
97
  $installed_skin.'xml.php').'</p>';
98
  }
99
  fclose($fp);
132
  if ( isset($_POST['updateskinoption']) ) {
133
  check_admin_referer('skin_settings');
134
  // get the hidden option fields, taken from WP core
135
+ $options = false;
136
  if ( $_POST['skin_options'] )
137
  $options = explode(',', stripslashes($_POST['skin_options']));
138
  elseif ( $_POST['skinoptions'] )
159
  if ( isset($_POST['license_key']) ) {
160
  check_admin_referer('skin-api');
161
  $license_key = mysql_real_escape_string($_POST['license_key']);
162
+ $flag_options['license_key'] = trim($license_key);
163
  update_option('flag_options', $flag_options);
164
  flagGallery::show_message(__('License Key Updated','flag'));
165
  }
189
  if ( isset($_POST['updateoption']) ) {
190
  check_admin_referer('flag_settings');
191
  // get the hidden option fields, taken from WP core
192
+ $options = false;
193
  if ( $_POST['page_options'] )
194
  $options = explode(',', stripslashes($_POST['page_options']));
195
  if ($options) {
443
  <?php }
444
  if ( current_user_can('FlAG Delete skins') ) {
445
  if ( dirname($skin_file) != $flag_options['flashSkin'] ) { ?>
446
+ <br /><br /><a class="delete" onclick="javascript:return flag_delskin('<?php echo $skin_data['Name']; ?>');" href="<?php echo admin_url('admin.php?page=flag-skins&delete='.dirname($skin_file)); ?>" title="<?php _e( 'Delete this skin', 'flag' ); ?>"><?php _e('Delete', 'flag' ); ?></a>
447
  <?php }
448
  } ?>
449
  </td>
451
  <?php } ?>
452
  </tbody>
453
  </table>
454
+ <script type="text/javascript">
455
+ function flag_delskin(skin_name){
456
+ return confirm( '<?php echo __('Delete' , 'flag'); ?> "'+skin_name+'"');
457
+ }
458
+ </script>
459
  </div>
460
 
461
  <div class="postbox metabox-holder" id="newskins" style="width: 29%; float: right; padding-top: 5px;">
467
  <div class="skin <?php echo $skin['type'].' '.$skin['status']; ?>" id="uid-<?php echo $skin['uid']; ?>" style="padding: 10px; float:left;">
468
  <center>
469
  <p><strong style="font-size: 120%;"><?php echo $skin['title']; ?></strong> <span class="version"><?php echo 'v'.$skin['version']; ?></span></p>
470
+ <div class="screenshot"><img src="<?php echo $skin['screenshot']; ?>" width="200" height="184" alt=""/></div>
471
  </center>
472
  <div class="content">
473
  <div class="links" style="text-align: center;">
admin/tinymce/window.php CHANGED
@@ -145,7 +145,7 @@ if($_REQUEST['riched'] == "false") {
145
  <div id="sort_panel" class="panel cptab">
146
  <table border="0" cellpadding="4" cellspacing="0">
147
  <tr>
148
- <td nowrap="nowrap" valign="middle"><label for="galorderby"><?php _e("Order by", 'flag'); ?>:</label></td>
149
  <td valign="middle"><select id="galorderby" name="galorderby" style="width: 200px">
150
  <option value="" selected="selected"><?php _e("Gallery IDs (default)", 'flag'); ?></option>
151
  <option value="title"><?php _e("Gallery Title", 'flag'); ?></option>
@@ -222,6 +222,7 @@ if($_REQUEST['riched'] == "false") {
222
  var album = jQuery('#album').val();
223
  var len = gallery.length;
224
  var galleryid="";
 
225
  if(!album){
226
  for(i=0;i<len;i++)
227
  {
@@ -238,34 +239,34 @@ if($_REQUEST['riched'] == "false") {
238
  album = ' album='+album;
239
  }
240
  if (gallerywidth && galleryheight)
241
- var gallerysize = " w=" + gallerywidth + " h=" + galleryheight;
242
  else
243
- var gallerysize="";
244
 
245
  if (galleryid == ' gid=all') {
246
  if (galorderby) {
247
- var galorderby = " orderby=" + galorderby;
248
  }
249
  if (galorder) {
250
- var galorder = " order=" + galorder;
251
  }
252
  if (galexclude) {
253
- var galexclude = " exclude=" + galexclude;
254
  }
255
  } else {
256
- var galorderby = '';
257
- var galorder = '';
258
- var galexclude = '';
259
  }
260
  if (skinname) {
261
- var skinname = " skin=" + skinname;
262
- } else var skinname = '';
263
  if (skinalign) {
264
- var skinalign = " align=" + skinalign;
265
- } else var skinalign = '';
266
  if (playlist) {
267
- var skinname = " play=" + playlist;
268
- } else var playlist = '';
269
 
270
  if (galleryid || album ) {
271
  tagtext = '[flagallery' + galleryid + album + gallerysize + galorderby + galorder + galexclude + skinname + skinalign + playlist + ' name=' + galleryname + ']';
145
  <div id="sort_panel" class="panel cptab">
146
  <table border="0" cellpadding="4" cellspacing="0">
147
  <tr>
148
+ <td nowrap="nowrap" valign="middle"><label for="galorderby"><?php _e("Order galleries by", 'flag'); ?>:</label></td>
149
  <td valign="middle"><select id="galorderby" name="galorderby" style="width: 200px">
150
  <option value="" selected="selected"><?php _e("Gallery IDs (default)", 'flag'); ?></option>
151
  <option value="title"><?php _e("Gallery Title", 'flag'); ?></option>
222
  var album = jQuery('#album').val();
223
  var len = gallery.length;
224
  var galleryid="";
225
+ var gallerysize="";
226
  if(!album){
227
  for(i=0;i<len;i++)
228
  {
239
  album = ' album='+album;
240
  }
241
  if (gallerywidth && galleryheight)
242
+ gallerysize = " w=" + gallerywidth + " h=" + galleryheight;
243
  else
244
+ gallerysize="";
245
 
246
  if (galleryid == ' gid=all') {
247
  if (galorderby) {
248
+ galorderby = " orderby=" + galorderby;
249
  }
250
  if (galorder) {
251
+ galorder = " order=" + galorder;
252
  }
253
  if (galexclude) {
254
+ galexclude = " exclude=" + galexclude;
255
  }
256
  } else {
257
+ galorderby = '';
258
+ galorder = '';
259
+ galexclude = '';
260
  }
261
  if (skinname) {
262
+ skinname = " skin=" + skinname;
263
+ } else skinname = '';
264
  if (skinalign) {
265
+ skinalign = " align=" + skinalign;
266
+ } else skinalign = '';
267
  if (playlist) {
268
+ skinname = " play=" + playlist;
269
+ } else playlist = '';
270
 
271
  if (galleryid || album ) {
272
  tagtext = '[flagallery' + galleryid + album + gallerysize + galorderby + galorder + galexclude + skinname + skinalign + playlist + ' name=' + galleryname + ']';
admin/upgrade.php CHANGED
@@ -5,7 +5,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
5
  /**
6
  * flag_upgrade() - update routine for older version
7
  *
8
- * @return Success message
9
  */
10
  function flag_upgrade() {
11
 
@@ -101,8 +101,8 @@ function flag_upgrade() {
101
  update_option('flag_options', $flag_options);
102
  echo __('finished', 'flag') . "<br />\n";
103
  }
104
- return;
105
  }
 
106
  }
107
 
108
 
@@ -158,7 +158,7 @@ function flag_add_sql_column($table_name, $column_name, $create_ddl) {
158
  /**
159
  * flag_upgrade_page() - This page showsup , when the database version doesn't fir to the script FLAG_DBVERSION constant.
160
  *
161
- * @return Upgrade Message
162
  */
163
  function flag_upgrade_page() {
164
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
5
  /**
6
  * flag_upgrade() - update routine for older version
7
  *
8
+ * @return mixed Success message
9
  */
10
  function flag_upgrade() {
11
 
101
  update_option('flag_options', $flag_options);
102
  echo __('finished', 'flag') . "<br />\n";
103
  }
 
104
  }
105
+ return false;
106
  }
107
 
108
 
158
  /**
159
  * flag_upgrade_page() - This page showsup , when the database version doesn't fir to the script FLAG_DBVERSION constant.
160
  *
161
+ * @return string Upgrade Message
162
  */
163
  function flag_upgrade_page() {
164
  $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
admin/video-box.php CHANGED
@@ -36,6 +36,7 @@ function flag_video_controler() {
36
  $title = $_POST['playlist_title'];
37
  $descr = $_POST['playlist_descr'];
38
  $file = $_GET['playlist'];
 
39
  foreach($_POST['item_a'] as $item_id => $item) {
40
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
41
  continue;
@@ -160,17 +161,18 @@ function flag_video_wp_media_lib($added=false) {
160
  <!--
161
  jQuery(document).ready(function(){
162
  jQuery('.cb :checkbox').click(function() {
 
163
  if(jQuery(this).is(':checked')){
164
- var cur = jQuery(this).val();
165
- var arr = jQuery('#items_array').val();
166
- if(arr) { var del = ','; } else { var del = ''; }
167
  jQuery('#items_array').val(arr+del+cur);
168
  } else {
169
- var cur = jQuery(this).val();
170
- var arr = jQuery('#items_array').val().split(',');
171
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
172
  jQuery('#items_array').val(arr);
173
- };
174
  });
175
  jQuery('.del_thumb').click(function(){
176
  var id = jQuery(this).attr('data-id');
@@ -196,7 +198,7 @@ function checkAll(form) {
196
  // this function check for a the number of selected images, sumbmit false when no one selected
197
  function checkSelected() {
198
  if(!jQuery('.cb input:checked')) {
199
- alert('<?php echo js_escape(__('No items selected', 'flag')); ?>');
200
  return false;
201
  }
202
  actionId = jQuery('#bulkaction').val();
@@ -206,10 +208,10 @@ function checkSelected() {
206
  return false;
207
  break;
208
  case "add_to_playlist":
209
- return confirm('<?php echo sprintf(js_escape(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
210
  break;
211
  }
212
- return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
213
  }
214
 
215
  function showDialog( windowId, height ) {
@@ -240,7 +242,7 @@ function send_to_editor(html) {
240
  jQuery("span.browsefiles").show().click(function(){
241
  jQuery("#file_browser").fileTree({
242
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
243
- root: jQuery("#videofolder").val(),
244
  }, function(file) {
245
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
246
  jQuery("#videofolder").val(file);
36
  $title = $_POST['playlist_title'];
37
  $descr = $_POST['playlist_descr'];
38
  $file = $_GET['playlist'];
39
+ $data = array();
40
  foreach($_POST['item_a'] as $item_id => $item) {
41
  if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
42
  continue;
161
  <!--
162
  jQuery(document).ready(function(){
163
  jQuery('.cb :checkbox').click(function() {
164
+ var cur, arr, del;
165
  if(jQuery(this).is(':checked')){
166
+ cur = jQuery(this).val();
167
+ arr = jQuery('#items_array').val();
168
+ if(arr) { del = ','; } else { del = ''; }
169
  jQuery('#items_array').val(arr+del+cur);
170
  } else {
171
+ cur = jQuery(this).val();
172
+ arr = jQuery('#items_array').val().split(',');
173
  arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
174
  jQuery('#items_array').val(arr);
175
+ }
176
  });
177
  jQuery('.del_thumb').click(function(){
178
  var id = jQuery(this).attr('data-id');
198
  // this function check for a the number of selected images, sumbmit false when no one selected
199
  function checkSelected() {
200
  if(!jQuery('.cb input:checked')) {
201
+ alert('<?php echo esc_js(__('No items selected', 'flag')); ?>');
202
  return false;
203
  }
204
  actionId = jQuery('#bulkaction').val();
208
  return false;
209
  break;
210
  case "add_to_playlist":
211
+ return confirm('<?php echo sprintf(esc_js(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
212
  break;
213
  }
214
+ return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
215
  }
216
 
217
  function showDialog( windowId, height ) {
242
  jQuery("span.browsefiles").show().click(function(){
243
  jQuery("#file_browser").fileTree({
244
  script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
245
+ root: jQuery("#videofolder").val()
246
  }, function(file) {
247
  //var path = file.replace("<?php echo WINABSPATH; ?>", "");
248
  jQuery("#videofolder").val(file);
changelog.txt CHANGED
@@ -1,6 +1,27 @@
1
  GRAND FlAGallery
2
  by Rattus & CodEasily DEV Team
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  = v2.11 - 03.11.2012 =
5
  * Updated: New system of checking license key
6
  * Changed: Skins update box.
1
  GRAND FlAGallery
2
  by Rattus & CodEasily DEV Team
3
 
4
+ = v2.17 - 08.01.2013 =
5
+ * Added: Sort images option: Randomly
6
+ * Changed: Alternative gallery thumbs for not square images
7
+ * Fixed: Skin name was wrong when click delete skin
8
+ * Fixed: Small fixes
9
+
10
+ = v2.16 - 17.12.2012 =
11
+ * Added: Hooks for manage images/galleries
12
+
13
+ = v2.15 - 04.12.2012 =
14
+ * Optimized: Code optimized
15
+ * Added: Hook for bulk actions dropdown
16
+ * Added: Hook after thumbnail/image created
17
+ * Fixed: Small PHP and JS fixes
18
+
19
+ = v2.14 - 20.11.2012 =
20
+ * Fixed: swfobject path was wrong on some servers
21
+
22
+ = v2.12 - 12.11.2012 =
23
+ * Fixed: XSS vulnerability in swfupload
24
+
25
  = v2.11 - 03.11.2012 =
26
  * Updated: New system of checking license key
27
  * Changed: Skins update box.
facebook.php CHANGED
@@ -22,21 +22,20 @@ if(isset($_GET['i'])) {
22
  $skin = '';
23
  if(isset($_GET['f'])){
24
  $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$_GET['f'];
25
- $skin = esc_url($_GET['f']);
26
  }
27
  $h = isset($_GET['h'])? intval($_GET['h']) : (int) $flag_options['flashHeight'];
28
 
29
  $gids = $_GET['i'];
30
  if($gids=='all') {
 
 
31
  $gids='';
32
  if(empty($orderby)) $orderby='gid';
33
  if(empty($order)) $order='DESC';
34
  $gallerylist = $flagdb->find_all_galleries($orderby, $order);
35
  if(is_array($gallerylist)) {
36
- $excludelist = explode(',',$exclude);
37
  foreach($gallerylist as $gallery) {
38
- if (in_array($gallery->gid, $excludelist))
39
- continue;
40
  $gids.='_'.$gallery->gid;
41
  }
42
  $gids = ltrim($gids,'_');
22
  $skin = '';
23
  if(isset($_GET['f'])){
24
  $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$_GET['f'];
25
+ $skin = esc_js($_GET['f']);
26
  }
27
  $h = isset($_GET['h'])? intval($_GET['h']) : (int) $flag_options['flashHeight'];
28
 
29
  $gids = $_GET['i'];
30
  if($gids=='all') {
31
+ /** @var $flagdb flagdb */
32
+ global $flagdb;
33
  $gids='';
34
  if(empty($orderby)) $orderby='gid';
35
  if(empty($order)) $order='DESC';
36
  $gallerylist = $flagdb->find_all_galleries($orderby, $order);
37
  if(is_array($gallerylist)) {
 
38
  foreach($gallerylist as $gallery) {
 
 
39
  $gids.='_'.$gallery->gid;
40
  }
41
  $gids = ltrim($gids,'_');
flag.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: GRAND Flash Album Gallery
4
  Plugin URI: http://codeasily.com/wordpress-plugins/flash-album-gallery/flag/
5
  Description: The GRAND FlAGallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
6
- Version: 2.11
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
@@ -23,10 +23,11 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
- var $version = '2.11';
27
  var $dbversion = '1.24';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '2.8';
 
30
  var $options = '';
31
  var $manage_page;
32
  var $add_PHP5_notice = false;
3
  Plugin Name: GRAND Flash Album Gallery
4
  Plugin URI: http://codeasily.com/wordpress-plugins/flash-album-gallery/flag/
5
  Description: The GRAND FlAGallery plugin - provides a comprehensive interface for managing photos and images through a set of admin pages, and it displays photos in a way that makes your web site look very professional.
6
+ Version: 2.17
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
+ var $version = '2.17';
27
  var $dbversion = '1.24';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '2.8';
30
+ var $flagAdminPanel;
31
  var $options = '';
32
  var $manage_page;
33
  var $add_PHP5_notice = false;
lib/constructor.php CHANGED
@@ -6,10 +6,7 @@ if ( !defined('WP_LOAD_PATH') ) {
6
  if (file_exists( $classic_root . 'wp-load.php') )
7
  define( 'WP_LOAD_PATH', $classic_root);
8
  else
9
- if (file_exists( $path . 'wp-load.php') )
10
- define( 'WP_LOAD_PATH', $path);
11
- else
12
- exit("Could not find wp-load.php");
13
  }
14
 
15
  // let's load WordPress
6
  if (file_exists( $classic_root . 'wp-load.php') )
7
  define( 'WP_LOAD_PATH', $classic_root);
8
  else
9
+ exit("Could not find wp-load.php");
 
 
 
10
  }
11
 
12
  // let's load WordPress
lib/core.php CHANGED
@@ -8,14 +8,14 @@ class flagGallery {
8
  /**
9
  * Show a error messages
10
  */
11
- function show_error($message) {
12
  echo '<div class="wrap"><h2></h2><div class="error" id="error"><p>' . $message . '</p></div></div>' . "\n";
13
  }
14
 
15
  /**
16
  * Show a system messages
17
  */
18
- function show_message($message) {
19
  echo '<div class="wrap"><h2></h2><div class="updated fade" id="message"><p>' . $message . '</p></div></div>' . "\n";
20
  }
21
 
@@ -24,7 +24,7 @@ class flagGallery {
24
  */
25
  function get_thumbnail_url($imageID, $picturepath = '', $fileName = ''){
26
 
27
- // get the complete url to the thumbnail
28
  global $wpdb;
29
 
30
  // safety first
@@ -49,7 +49,8 @@ class flagGallery {
49
  /**
50
  * get the complete url to the image
51
  */
52
- function get_image_url($imageID, $picturepath = '', $fileName = '') {
 
53
  global $wpdb;
54
 
55
  // safety first
@@ -77,7 +78,7 @@ class flagGallery {
77
  * @param bool $include_Abspath
78
  * @return string $foldername
79
  */
80
- function create_thumbnail_folder($gallerypath, $include_Abspath = TRUE) {
81
  if (!$include_Abspath) {
82
  $gallerypath = WINABSPATH . $gallerypath;
83
  }
@@ -116,7 +117,7 @@ class flagGallery {
116
  * @deprecated use create_thumbnail_folder() if needed;
117
  * @return string $foldername
118
  */
119
- function get_thumbnail_folder($gallerypath, $include_Abspath = TRUE) {
120
  return flagGallery::create_thumbnail_folder($gallerypath, $include_Abspath);
121
  }
122
 
@@ -135,9 +136,9 @@ class flagGallery {
135
  /**
136
  * flagGallery::graphic_library() - switch between GD and ImageMagick
137
  *
138
- * @return path to the selected library
139
  */
140
- function graphic_library() {
141
 
142
  return FLAG_ABSPATH . '/lib/gd.thumbnail.inc.php';
143
 
@@ -149,7 +150,7 @@ class flagGallery {
149
  * @param string $in
150
  * @return string $in localized
151
  */
152
- function i18n($in) {
153
 
154
  if ( function_exists( 'langswitch_filter_langs_with_message' ) )
155
  $in = langswitch_filter_langs_with_message($in);
@@ -170,7 +171,7 @@ class flagGallery {
170
  *
171
  * @return string message about recommended image size
172
  */
173
- function check_memory_limit() {
174
 
175
  if ( (function_exists('memory_get_usage')) && (ini_get('memory_limit')) ) {
176
 
@@ -201,7 +202,7 @@ class flagGallery {
201
  }
202
  }
203
  }
204
- return;
205
  }
206
 
207
  /**
@@ -210,7 +211,7 @@ class flagGallery {
210
  * @param string $name The name being checked.
211
  * @return array containing information about file
212
  */
213
- function fileinfo( $name ) {
214
 
215
  //Sanitizes a filename replacing whitespace with dashes
216
  $name = sanitize_file_name($name);
@@ -238,10 +239,10 @@ class flagGallery {
238
 
239
  /**
240
  * Function used to delete a folder.
241
- * @param $path full-path to folder
242
  * @return bool result of deletion
243
  */
244
- function flagFolderDelete($path) {
245
  if (is_dir($path)) {
246
  if (version_compare(PHP_VERSION, '5.0.0') < 0) {
247
  $entries = array();
@@ -274,7 +275,7 @@ class flagGallery {
274
  * @return the number of bytes written, or FALSE on error.
275
  */
276
 
277
- function saveFile($sName,$sContent,$mode='w+') {
278
  if (!$dFile=fopen($sName, $mode)) {
279
  flagGallery::show_error(__("Can't create/open file '","flag").$sName."'.");
280
  exit;
@@ -292,7 +293,7 @@ class flagGallery {
292
  }
293
 
294
 
295
- function flag_wpmu_enable_function($value) {
296
  if (IS_WPMU) {
297
  $flag_options = get_site_option('flag_options');
298
  return $flag_options[$value];
@@ -301,7 +302,7 @@ class flagGallery {
301
  return true;
302
  }
303
 
304
- function flagGetBetween($content,$start,$end){
305
  $r = explode($start, $content);
306
  if (isset($r[1])){
307
  $r = explode($end, $r[1]);
@@ -318,7 +319,7 @@ class flagGallery {
318
  return $isCrawler;
319
  }
320
 
321
- function flagSaveWpMedia() {
322
  if ( !empty($_POST['item_a']) )
323
  foreach ( $_POST['item_a'] as $item_id => $item ) {
324
  $post = $_post = get_post($item_id, ARRAY_A);
8
  /**
9
  * Show a error messages
10
  */
11
+ static function show_error($message) {
12
  echo '<div class="wrap"><h2></h2><div class="error" id="error"><p>' . $message . '</p></div></div>' . "\n";
13
  }
14
 
15
  /**
16
  * Show a system messages
17
  */
18
+ static function show_message($message) {
19
  echo '<div class="wrap"><h2></h2><div class="updated fade" id="message"><p>' . $message . '</p></div></div>' . "\n";
20
  }
21
 
24
  */
25
  function get_thumbnail_url($imageID, $picturepath = '', $fileName = ''){
26
 
27
+ /** @var $wpdb wpdb */
28
  global $wpdb;
29
 
30
  // safety first
49
  /**
50
  * get the complete url to the image
51
  */
52
+ function get_image_url($imageID, $picturepath = '', $fileName = '') {
53
+ /** @var $wpdb wpdb */
54
  global $wpdb;
55
 
56
  // safety first
78
  * @param bool $include_Abspath
79
  * @return string $foldername
80
  */
81
+ static function create_thumbnail_folder($gallerypath, $include_Abspath = TRUE) {
82
  if (!$include_Abspath) {
83
  $gallerypath = WINABSPATH . $gallerypath;
84
  }
117
  * @deprecated use create_thumbnail_folder() if needed;
118
  * @return string $foldername
119
  */
120
+ static function get_thumbnail_folder($gallerypath, $include_Abspath = TRUE) {
121
  return flagGallery::create_thumbnail_folder($gallerypath, $include_Abspath);
122
  }
123
 
136
  /**
137
  * flagGallery::graphic_library() - switch between GD and ImageMagick
138
  *
139
+ * @return string path to the selected library
140
  */
141
+ static function graphic_library() {
142
 
143
  return FLAG_ABSPATH . '/lib/gd.thumbnail.inc.php';
144
 
150
  * @param string $in
151
  * @return string $in localized
152
  */
153
+ static function i18n($in) {
154
 
155
  if ( function_exists( 'langswitch_filter_langs_with_message' ) )
156
  $in = langswitch_filter_langs_with_message($in);
171
  *
172
  * @return string message about recommended image size
173
  */
174
+ static function check_memory_limit() {
175
 
176
  if ( (function_exists('memory_get_usage')) && (ini_get('memory_limit')) ) {
177
 
202
  }
203
  }
204
  }
205
+ return false;
206
  }
207
 
208
  /**
211
  * @param string $name The name being checked.
212
  * @return array containing information about file
213
  */
214
+ static function fileinfo( $name ) {
215
 
216
  //Sanitizes a filename replacing whitespace with dashes
217
  $name = sanitize_file_name($name);
239
 
240
  /**
241
  * Function used to delete a folder.
242
+ * @param string $path full-path to folder
243
  * @return bool result of deletion
244
  */
245
+ static function flagFolderDelete($path) {
246
  if (is_dir($path)) {
247
  if (version_compare(PHP_VERSION, '5.0.0') < 0) {
248
  $entries = array();
275
  * @return the number of bytes written, or FALSE on error.
276
  */
277
 
278
+ static function saveFile($sName,$sContent,$mode='w+') {
279
  if (!$dFile=fopen($sName, $mode)) {
280
  flagGallery::show_error(__("Can't create/open file '","flag").$sName."'.");
281
  exit;
293
  }
294
 
295
 
296
+ static function flag_wpmu_enable_function($value) {
297
  if (IS_WPMU) {
298
  $flag_options = get_site_option('flag_options');
299
  return $flag_options[$value];
302
  return true;
303
  }
304
 
305
+ static function flagGetBetween($content,$start,$end){
306
  $r = explode($start, $content);
307
  if (isset($r[1])){
308
  $r = explode($end, $r[1]);
319
  return $isCrawler;
320
  }
321
 
322
+ static function flagSaveWpMedia() {
323
  if ( !empty($_POST['item_a']) )
324
  foreach ( $_POST['item_a'] as $item_id => $item ) {
325
  $post = $_post = get_post($item_id, ARRAY_A);
lib/flag-db.php CHANGED
@@ -29,7 +29,9 @@ class flagdb {
29
  * @var object|array
30
  */
31
  var $comments = false;
32
-
 
 
33
  /**
34
  * PHP4 compatibility layer for calling the PHP5 constructor.
35
  *
@@ -60,20 +62,21 @@ class flagdb {
60
  */
61
  function __destruct() {
62
  return true;
63
- }
64
 
65
  /**
66
  * Get all the galleries
67
- *
68
  * @param string $order_by
69
  * @param string $order_dir
70
  * @param bool $counter (optional) Select true when you need to count the images
71
  * @param int $limit number of paged galleries, 0 shows all galleries
72
  * @param int $start the start index for paged galleries
73
- * @param bool $exclude
74
  * @return array $galleries
75
  */
76
  function find_all_galleries($order_by = 'gid', $order_dir = 'ASC', $counter = false, $limit = 0, $start = 0, $exclude = 0) {
 
77
  global $wpdb;
78
 
79
  $exclude_clause = ($exclude) ? ' AND exclude<>1 ' : '';
@@ -130,22 +133,23 @@ class flagdb {
130
  * @return object $albums
131
  */
132
  function find_all_albums($order_by = 'id', $order_dir = 'DESC') {
133
- global $wpdb;
 
134
 
135
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
136
  $albums = $wpdb->get_results( "SELECT * FROM $wpdb->flagalbum ORDER BY {$order_by} {$order_dir}", OBJECT_K );
137
  return $albums;
138
  }
139
-
140
  /**
141
  * Get all galleries from Album
142
- *
143
- * @param string $order_by
144
- * @param string $order_dir
145
  * @return object $albums
146
  */
147
  function get_album($id) {
148
- global $wpdb;
 
149
  $id = $wpdb->escape($id);
150
  $albums = $wpdb->get_var( "SELECT categories FROM $wpdb->flagalbum WHERE id = '{$id}'" );
151
  return $albums;
@@ -155,9 +159,10 @@ class flagdb {
155
  * Get a gallery given its ID
156
  *
157
  * @param int|string $id or $name
158
- * @return A flagGallery object (null if not found)
159
  */
160
- function find_gallery( $id ) {
 
161
  global $wpdb;
162
 
163
  if( is_numeric($id) ) {
@@ -179,20 +184,21 @@ class flagdb {
179
  } else
180
  return false;
181
  }
182
-
183
  /**
184
  * This function return all information about the gallery and the images inside
185
- *
186
  * @param int|string $id or $name
187
- * @param string $order_by
188
  * @param string $order_dir (ASC |DESC)
189
- * @param bool $exclude
190
  * @param int $limit number of paged galleries, 0 shows all galleries
191
  * @param int $start the start index for paged galleries
192
- * @return An array containing the flagImage objects representing the images in the gallery.
193
  */
194
  function get_gallery($id, $order_by = 'sortorder', $order_dir = 'ASC', $exclude = 0, $limit = 0, $start = 0) {
195
 
 
196
  global $wpdb;
197
 
198
  // init the gallery as empty array
@@ -203,16 +209,20 @@ class flagdb {
203
 
204
  // Say no to any other value
205
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
206
- $order_by = ( empty($order_by) ) ? 'sortorder' : $order_by;
 
 
 
 
207
 
208
  // Should we limit this query ?
209
  $limit_by = ( $limit > 0 ) ? 'LIMIT ' . intval($start) . ',' . intval($limit) : '';
210
 
211
  // Query database
212
  if( is_numeric($id) )
213
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = %d {$exclude_clause} ORDER BY tt.{$order_by} {$order_dir} {$limit_by}", $id ), OBJECT_K );
214
  else
215
- $result = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.name = %s {$exclude_clause} ORDER BY tt.{$order_by} {$order_dir} {$limit_by}", $id ), OBJECT_K );
216
 
217
  // Count the number of images and calculate the pagination
218
  if ($limit > 0) {
@@ -234,18 +244,19 @@ class flagdb {
234
 
235
  return $gallery;
236
  }
237
-
238
  /**
239
  * This function return all information about the gallery and the images inside
240
- *
241
  * @param int|string $id or $name
242
- * @param string $orderby
243
- * @param string $order (ASC |DESC)
244
- * @param bool $exclude
245
- * @return An array containing the flagImage objects representing the images in the gallery.
246
  */
247
- function get_ids_from_gallery($id, $order_by = 'sortorder', $order_dir = 'ASC', $exclude = 0) {
248
 
 
249
  global $wpdb;
250
 
251
  // Check for the exclude setting
@@ -268,23 +279,30 @@ class flagdb {
268
  *
269
  * @gid The gallery ID
270
  */
271
- function delete_gallery($gid) {
 
272
  global $wpdb;
273
 
274
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagpictures WHERE galleryid = %d", $gid) );
275
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flaggallery WHERE gid = %d", $gid) );
276
 
277
- wp_cache_delete($id, 'flag_gallery');
278
 
279
  return true;
280
  }
281
 
282
  /**
283
  * Insert an image in the database
284
- *
285
- * @return the ID of the inserted image
 
 
 
 
 
286
  */
287
- function insert_image($gid, $filename, $alttext, $desc, $exclude = 0) {
 
288
  global $wpdb;
289
 
290
  $result = $wpdb->query(
@@ -298,18 +316,19 @@ class flagdb {
298
 
299
  /**
300
  * flagdb::update_image() - Insert an image in the database
301
- *
302
  * @param int $pid id of the image
303
- * @param (optional) string | int $galleryid
304
- * @param (optional) string $filename
305
- * @param (optional) string $description
306
- * @param (optional) string $alttext
307
- * @param (optional) int $exclude (0 or 1)
308
- * @param (optional) int $sortorder
309
  * @return bool result of the ID of the inserted image
310
  */
311
- function update_image($pid, $galleryid = false, $filename = false, $description = false, $alttext = false, $exclude = 0, $sortorder = false) {
312
 
 
313
  global $wpdb;
314
 
315
  $sql = array();
@@ -331,6 +350,7 @@ class flagdb {
331
  // create the final string
332
  $sql = implode(', ', $sql);
333
 
 
334
  if ( !empty($sql) && $pid != 0)
335
  $result = $wpdb->query( "UPDATE $wpdb->flagpictures SET $sql WHERE pid = $pid" );
336
 
@@ -345,7 +365,8 @@ class flagdb {
345
  * @param int $id The image ID
346
  * @return object A flagImage object representing the image (false if not found)
347
  */
348
- function find_image( $id ) {
 
349
  global $wpdb;
350
 
351
  if ( $image = wp_cache_get($id, 'flag_image') )
@@ -362,14 +383,17 @@ class flagdb {
362
 
363
  return false;
364
  }
365
-
366
  /**
367
- * Get images given a list of IDs
368
- *
369
  * @param $pids array of picture_ids
370
- * @return An array of flagImage objects representing the images
 
 
371
  */
372
- function find_images_in_list( $pids, $exclude = 0, $order = 'ASC' ) {
 
373
  global $wpdb;
374
 
375
  $result = array();
@@ -394,24 +418,24 @@ class flagdb {
394
  }
395
  return $result;
396
  }
397
-
398
- /**
399
- * Add an image to the database
400
- *
401
- * @param int $pid id of the gallery
402
- * @param (optional) string|int $galleryid
403
- * @param (optional) string $filename
404
- * @param (optional) string $description
405
- * @param (optional) string $alttext
406
- * @param (optional) array $meta data
407
- * @param (optional) int $post_id (required for sync with WP media lib)
408
- * @param (optional) string $imagedate
409
- * @param (optional) int $exclude (0 or 1)
410
- * @param (optional) int $sortorder
411
- * @return bool result of the ID of the inserted image
412
- */
413
  function add_image( $id = false, $filename = false, $description = '', $alttext = '', $meta_data = false, $post_id = 0, $imagedate = '0000-00-00 00:00:00', $exclude = 0, $sortorder = 0 ) {
414
- global $wpdb;
 
415
 
416
  if ( is_array($meta_data) )
417
  $meta_data = serialize($meta_data);
@@ -434,29 +458,32 @@ class flagdb {
434
  /**
435
  * Delete an image entry from the database
436
  */
437
- function delete_image($pid) {
 
438
  global $wpdb;
439
 
440
  // Delete the image row
441
  $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagpictures WHERE pid = %d", $pid) );
442
 
443
  // Remove from cache
444
- wp_cache_delete( $id, 'flag_image');
445
 
446
  return $result;
447
  }
448
-
449
  /**
450
  * Get the last images registered in the database with a maximum number of $limit results
451
- *
452
  * @param integer $page
453
  * @param integer $limit
454
- * @param bool $use_exclude
455
- * @param int $galleryId Only look for images with this gallery id, or in all galleries if id is 0
456
- * @param string $orderby is one of "id" (default, order by pid), "date" (order by exif date), sort (order by user sort order)
457
- * @return
 
458
  */
459
  function find_last_images($page = 0, $limit = 30, $exclude = 0, $galleryId = 0, $orderby = "id") {
 
460
  global $wpdb;
461
 
462
  // Check for the exclude setting
@@ -503,15 +530,17 @@ class flagdb {
503
 
504
  return $result;
505
  }
506
-
507
  /**
508
  * flagdb::get_random_images() - Get an random image from one ore more gally
509
- *
510
  * @param integer $number of images
511
  * @param integer $galleryID optional a Gallery
512
- * @return A flagImage object representing the image (null if not found)
 
513
  */
514
  function get_random_images($number = 1, $galleryID = 0, $exclude = 0) {
 
515
  global $wpdb;
516
 
517
  // Check for the exclude setting
@@ -546,7 +575,8 @@ class flagdb {
546
  * @return Array Result of the request
547
  */
548
  function search_for_images( $request ) {
549
- global $wpdb;
 
550
 
551
  // If a search pattern is specified, load the posts that match
552
  if ( !empty($request) ) {
@@ -558,8 +588,9 @@ class flagdb {
558
  $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
559
 
560
  $n = '%';
 
561
  $searchand = '';
562
-
563
  foreach( (array) $search_terms as $term) {
564
  $term = addslashes_gpc($term);
565
  $search .= "{$searchand}((tt.description LIKE '{$n}{$term}{$n}') OR (tt.alttext LIKE '{$n}{$term}{$n}') OR (tt.filename LIKE '{$n}{$term}{$n}'))";
@@ -580,6 +611,7 @@ class flagdb {
580
 
581
  // Return the object from the query result
582
  if ($result) {
 
583
  foreach ($result as $image) {
584
  $images[] = new flagImage( $image );
585
  }
@@ -589,23 +621,24 @@ class flagdb {
589
  return null;
590
  }
591
 
592
- /**
593
- * search for a filename
594
- *
595
- * @since 0.40
596
- * @param string $filename
597
- * @param int (optional) $galleryID
598
- * @return Array Result of the request
599
- */
600
  function search_for_file( $filename, $galleryID = false ) {
601
- global $wpdb;
602
-
603
- // If a search pattern is specified, load the posts that match
 
 
604
  if ( !empty($filename) ) {
605
  // added slashes screw with quote grouping when done early, so done later
606
  $term = $wpdb->escape($filename);
607
 
608
- $where_clause = '';
609
  if ( is_numeric($galleryID) ) {
610
  $id = (int) $galleryID;
611
  $where_clause = " AND tt.galleryid = {$id}";
@@ -625,15 +658,17 @@ class flagdb {
625
  return null;
626
  }
627
 
628
- /**
629
- * Update or add meta data for an image
630
- *
631
- * @param int $id The image ID
632
- * @param array $values An array with existing or new values
633
- * @return bool result of query
634
- */
635
- function update_image_meta( $id, $new_values ) {
636
- global $wpdb;
 
 
637
 
638
  // Query database for existing values
639
  // Use cache object
29
  * @var object|array
30
  */
31
  var $comments = false;
32
+
33
+ var $paged;
34
+
35
  /**
36
  * PHP4 compatibility layer for calling the PHP5 constructor.
37
  *
62
  */
63
  function __destruct() {
64
  return true;
65
+ }
66
 
67
  /**
68
  * Get all the galleries
69
+ *
70
  * @param string $order_by
71
  * @param string $order_dir
72
  * @param bool $counter (optional) Select true when you need to count the images
73
  * @param int $limit number of paged galleries, 0 shows all galleries
74
  * @param int $start the start index for paged galleries
75
+ * @param bool|int $exclude
76
  * @return array $galleries
77
  */
78
  function find_all_galleries($order_by = 'gid', $order_dir = 'ASC', $counter = false, $limit = 0, $start = 0, $exclude = 0) {
79
+ /** @var $wpdb wpdb */
80
  global $wpdb;
81
 
82
  $exclude_clause = ($exclude) ? ' AND exclude<>1 ' : '';
133
  * @return object $albums
134
  */
135
  function find_all_albums($order_by = 'id', $order_dir = 'DESC') {
136
+ /** @var $wpdb wpdb */
137
+ global $wpdb;
138
 
139
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
140
  $albums = $wpdb->get_results( "SELECT * FROM $wpdb->flagalbum ORDER BY {$order_by} {$order_dir}", OBJECT_K );
141
  return $albums;
142
  }
143
+
144
  /**
145
  * Get all galleries from Album
146
+ *
147
+ * @param $id
 
148
  * @return object $albums
149
  */
150
  function get_album($id) {
151
+ /** @var $wpdb wpdb */
152
+ global $wpdb;
153
  $id = $wpdb->escape($id);
154
  $albums = $wpdb->get_var( "SELECT categories FROM $wpdb->flagalbum WHERE id = '{$id}'" );
155
  return $albums;
159
  * Get a gallery given its ID
160
  *
161
  * @param int|string $id or $name
162
+ * @return object flagGallery (null if not found)
163
  */
164
+ static function find_gallery( $id ) {
165
+ /** @var $wpdb wpdb */
166
  global $wpdb;
167
 
168
  if( is_numeric($id) ) {
184
  } else
185
  return false;
186
  }
187
+
188
  /**
189
  * This function return all information about the gallery and the images inside
190
+ *
191
  * @param int|string $id or $name
192
+ * @param string $order_by
193
  * @param string $order_dir (ASC |DESC)
194
+ * @param bool|int $exclude
195
  * @param int $limit number of paged galleries, 0 shows all galleries
196
  * @param int $start the start index for paged galleries
197
+ * @return array containing the flagImage objects representing the images in the gallery.
198
  */
199
  function get_gallery($id, $order_by = 'sortorder', $order_dir = 'ASC', $exclude = 0, $limit = 0, $start = 0) {
200
 
201
+ /** @var $wpdb wpdb */
202
  global $wpdb;
203
 
204
  // init the gallery as empty array
209
 
210
  // Say no to any other value
211
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
212
+ $order_by = ( empty($order_by) ) ? 'tt.sortorder' : 'tt.'.$order_by;
213
+ if($order_by == 'tt.rand()'){
214
+ $order_by = 'rand()';
215
+ $order_dir = '';
216
+ }
217
 
218
  // Should we limit this query ?
219
  $limit_by = ( $limit > 0 ) ? 'LIMIT ' . intval($start) . ',' . intval($limit) : '';
220
 
221
  // Query database
222
  if( is_numeric($id) )
223
+ $result = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = %d {$exclude_clause} ORDER BY {$order_by} {$order_dir} {$limit_by}", $id ), OBJECT_K );
224
  else
225
+ $result = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS tt.*, t.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.name = %s {$exclude_clause} ORDER BY {$order_by} {$order_dir} {$limit_by}", $id ), OBJECT_K );
226
 
227
  // Count the number of images and calculate the pagination
228
  if ($limit > 0) {
244
 
245
  return $gallery;
246
  }
247
+
248
  /**
249
  * This function return all information about the gallery and the images inside
250
+ *
251
  * @param int|string $id or $name
252
+ * @param string $order_by
253
+ * @param string $order_dir
254
+ * @param bool|int $exclude
255
+ * @return array containing the flagImage objects representing the images in the gallery.
256
  */
257
+ static function get_ids_from_gallery($id, $order_by = 'sortorder', $order_dir = 'ASC', $exclude = 0) {
258
 
259
+ /** @var $wpdb wpdb */
260
  global $wpdb;
261
 
262
  // Check for the exclude setting
279
  *
280
  * @gid The gallery ID
281
  */
282
+ function delete_gallery($gid) {
283
+ /** @var $wpdb wpdb */
284
  global $wpdb;
285
 
286
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagpictures WHERE galleryid = %d", $gid) );
287
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flaggallery WHERE gid = %d", $gid) );
288
 
289
+ wp_cache_delete($gid, 'flag_gallery');
290
 
291
  return true;
292
  }
293
 
294
  /**
295
  * Insert an image in the database
296
+ *
297
+ * @param $gid
298
+ * @param $filename
299
+ * @param $alttext
300
+ * @param $desc
301
+ * @param int $exclude
302
+ * @return int the ID of the inserted image
303
  */
304
+ static function insert_image($gid, $filename, $alttext, $desc, $exclude = 0) {
305
+ /** @var $wpdb wpdb */
306
  global $wpdb;
307
 
308
  $result = $wpdb->query(
316
 
317
  /**
318
  * flagdb::update_image() - Insert an image in the database
319
+ *
320
  * @param int $pid id of the image
321
+ * @param bool $galleryid
322
+ * @param bool $filename
323
+ * @param bool $description
324
+ * @param bool $alttext
325
+ * @param int $exclude
326
+ * @param bool $sortorder
327
  * @return bool result of the ID of the inserted image
328
  */
329
+ static function update_image($pid, $galleryid = false, $filename = false, $description = false, $alttext = false, $exclude = 0, $sortorder = false) {
330
 
331
+ /** @var $wpdb wpdb */
332
  global $wpdb;
333
 
334
  $sql = array();
350
  // create the final string
351
  $sql = implode(', ', $sql);
352
 
353
+ $result = false;
354
  if ( !empty($sql) && $pid != 0)
355
  $result = $wpdb->query( "UPDATE $wpdb->flagpictures SET $sql WHERE pid = $pid" );
356
 
365
  * @param int $id The image ID
366
  * @return object A flagImage object representing the image (false if not found)
367
  */
368
+ static function find_image( $id ) {
369
+ /** @var $wpdb wpdb */
370
  global $wpdb;
371
 
372
  if ( $image = wp_cache_get($id, 'flag_image') )
383
 
384
  return false;
385
  }
386
+
387
  /**
388
+ * Get images given a list of IDs
389
+ *
390
  * @param $pids array of picture_ids
391
+ * @param int $exclude
392
+ * @param string $order
393
+ * @return array of flagImage objects representing the images
394
  */
395
+ static function find_images_in_list( $pids, $exclude = 0, $order = 'ASC' ) {
396
+ /** @var $wpdb wpdb */
397
  global $wpdb;
398
 
399
  $result = array();
418
  }
419
  return $result;
420
  }
421
+
422
+ /**
423
+ * Add an image to the database
424
+ *
425
+ * @param bool $id
426
+ * @param bool $filename
427
+ * @param string $description
428
+ * @param string $alttext
429
+ * @param bool $meta_data
430
+ * @param int $post_id
431
+ * @param string $imagedate
432
+ * @param int $exclude
433
+ * @param int $sortorder
434
+ * @return bool result of the ID of the inserted image
435
+ */
 
436
  function add_image( $id = false, $filename = false, $description = '', $alttext = '', $meta_data = false, $post_id = 0, $imagedate = '0000-00-00 00:00:00', $exclude = 0, $sortorder = 0 ) {
437
+ /** @var $wpdb wpdb */
438
+ global $wpdb;
439
 
440
  if ( is_array($meta_data) )
441
  $meta_data = serialize($meta_data);
458
  /**
459
  * Delete an image entry from the database
460
  */
461
+ static function delete_image($pid) {
462
+ /** @var $wpdb wpdb */
463
  global $wpdb;
464
 
465
  // Delete the image row
466
  $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagpictures WHERE pid = %d", $pid) );
467
 
468
  // Remove from cache
469
+ wp_cache_delete( $pid, 'flag_image');
470
 
471
  return $result;
472
  }
473
+
474
  /**
475
  * Get the last images registered in the database with a maximum number of $limit results
476
+ *
477
  * @param integer $page
478
  * @param integer $limit
479
+ * @param int $exclude
480
+ * @param int $galleryId Only look for images with this gallery id, or in all galleries if id is 0
481
+ * @param string $orderby
482
+ * @param string $orderby is one of "id" (default, order by pid), "date" (order by exif date), sort (order by user sort order)
483
+ * @return array
484
  */
485
  function find_last_images($page = 0, $limit = 30, $exclude = 0, $galleryId = 0, $orderby = "id") {
486
+ /** @var $wpdb wpdb */
487
  global $wpdb;
488
 
489
  // Check for the exclude setting
530
 
531
  return $result;
532
  }
533
+
534
  /**
535
  * flagdb::get_random_images() - Get an random image from one ore more gally
536
+ *
537
  * @param integer $number of images
538
  * @param integer $galleryID optional a Gallery
539
+ * @param int $exclude
540
+ * @return object flagImage representing the image (null if not found)
541
  */
542
  function get_random_images($number = 1, $galleryID = 0, $exclude = 0) {
543
+ /** @var $wpdb wpdb */
544
  global $wpdb;
545
 
546
  // Check for the exclude setting
575
  * @return Array Result of the request
576
  */
577
  function search_for_images( $request ) {
578
+ /** @var $wpdb wpdb */
579
+ global $wpdb;
580
 
581
  // If a search pattern is specified, load the posts that match
582
  if ( !empty($request) ) {
588
  $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
589
 
590
  $n = '%';
591
+ $search = '';
592
  $searchand = '';
593
+
594
  foreach( (array) $search_terms as $term) {
595
  $term = addslashes_gpc($term);
596
  $search .= "{$searchand}((tt.description LIKE '{$n}{$term}{$n}') OR (tt.alttext LIKE '{$n}{$term}{$n}') OR (tt.filename LIKE '{$n}{$term}{$n}'))";
611
 
612
  // Return the object from the query result
613
  if ($result) {
614
+ $images = array();
615
  foreach ($result as $image) {
616
  $images[] = new flagImage( $image );
617
  }
621
  return null;
622
  }
623
 
624
+ /**
625
+ * search for a filename
626
+ *
627
+ * @since 0.40
628
+ * @param string $filename
629
+ * @param bool|int $galleryID
630
+ * @return Array Result of the request
631
+ */
632
  function search_for_file( $filename, $galleryID = false ) {
633
+ /** @var $wpdb wpdb */
634
+ global $wpdb;
635
+
636
+ $where_clause = '';
637
+ // If a search pattern is specified, load the posts that match
638
  if ( !empty($filename) ) {
639
  // added slashes screw with quote grouping when done early, so done later
640
  $term = $wpdb->escape($filename);
641
 
 
642
  if ( is_numeric($galleryID) ) {
643
  $id = (int) $galleryID;
644
  $where_clause = " AND tt.galleryid = {$id}";
658
  return null;
659
  }
660
 
661
+ /**
662
+ * Update or add meta data for an image
663
+ *
664
+ * @param int $id The image ID
665
+ * @param $new_values
666
+ * @internal param array $values An array with existing or new values
667
+ * @return bool result of query
668
+ */
669
+ static function update_image_meta( $id, $new_values ) {
670
+ /** @var $wpdb wpdb */
671
+ global $wpdb;
672
 
673
  // Query database for existing values
674
  // Use cache object
lib/gallery.php CHANGED
@@ -5,6 +5,7 @@ header("content-type:text/xml;charset=utf-8");
5
  // look up for the path
6
  require_once( str_replace("\\","/", dirname(dirname(__FILE__)) . "/flag-config.php") );
7
 
 
8
  global $wpdb;
9
  $siteurl = get_option ('siteurl');
10
  // get the gallery id
@@ -57,7 +58,7 @@ foreach ( $gID as $galleryID ) {
57
  if (is_array ($thepictures) && count($thepictures)){
58
  echo " <category id='".$galleryID."'>\n";
59
  echo " <properties>\n";
60
- echo " <title>".attribute_escape(flagGallery::i18n(stripslashes($thepictures[0]->title)))."</title>\n";
61
  echo " </properties>\n";
62
  echo " <items>\n";
63
 
@@ -65,8 +66,8 @@ foreach ( $gID as $galleryID ) {
65
  foreach ($thepictures as $picture) {
66
  echo " <item id='".$picture->pid."'>\n";
67
  echo " <thumbnail>".$siteurl."/".$picture->path."/thumbs/thumbs_".$picture->filename."</thumbnail>\n";
68
- echo " <title><![CDATA[".attribute_escape(flagGallery::i18n(stripslashes($picture->alttext)))."]]></title>\n";
69
- echo " <description><![CDATA[".html_entity_decode(attribute_escape(flagGallery::i18n(stripslashes($picture->description))))."]]></description>\n";
70
  //echo " <link>".$picture->link."</link>\n";
71
  echo " <photo>".$siteurl."/".$picture->path."/".$picture->filename."</photo>\n";
72
  echo " <date>".$picture->imagedate."</date>\n";
5
  // look up for the path
6
  require_once( str_replace("\\","/", dirname(dirname(__FILE__)) . "/flag-config.php") );
7
 
8
+ /** @var $wpdb wpdb */
9
  global $wpdb;
10
  $siteurl = get_option ('siteurl');
11
  // get the gallery id
58
  if (is_array ($thepictures) && count($thepictures)){
59
  echo " <category id='".$galleryID."'>\n";
60
  echo " <properties>\n";
61
+ echo " <title>".esc_attr(flagGallery::i18n(stripslashes($thepictures[0]->title)))."</title>\n";
62
  echo " </properties>\n";
63
  echo " <items>\n";
64
 
66
  foreach ($thepictures as $picture) {
67
  echo " <item id='".$picture->pid."'>\n";
68
  echo " <thumbnail>".$siteurl."/".$picture->path."/thumbs/thumbs_".$picture->filename."</thumbnail>\n";
69
+ echo " <title><![CDATA[".esc_attr(flagGallery::i18n(stripslashes($picture->alttext)))."]]></title>\n";
70
+ echo " <description><![CDATA[".html_entity_decode(esc_attr(flagGallery::i18n(stripslashes($picture->description))))."]]></description>\n";
71
  //echo " <link>".$picture->link."</link>\n";
72
  echo " <photo>".$siteurl."/".$picture->path."/".$picture->filename."</photo>\n";
73
  echo " <date>".$picture->imagedate."</date>\n";
lib/gd.thumbnail.inc.php CHANGED
@@ -93,12 +93,15 @@ class flag_Thumbnail {
93
  */
94
  var $maxHeight;
95
 
96
- /**
97
- * Image Resource
98
- *
99
- * @var string
100
- *
101
- */
 
 
 
102
  function flag_Thumbnail($fileName,$no_ErrorImage = false) {
103
  //make sure the GD library is installed
104
  if(!function_exists("gd_info")) {
@@ -367,12 +370,13 @@ class flag_Thumbnail {
367
  imagedestroy($errImg);
368
  }
369
 
370
- /**
371
- * Resizes image to fixed Width x Height
372
- *
373
- * @param int $Width
374
- * @param int $Height
375
- */
 
376
  function resizeFix($Width = 0, $Height = 0, $deprecated = 3) {
377
  $this->newWidth = $Width;
378
  $this->newHeight = $Height;
@@ -405,12 +409,13 @@ class flag_Thumbnail {
405
  }
406
 
407
 
408
- /**
409
- * Resizes image to maxWidth x maxHeight
410
- *
411
- * @param int $maxWidth
412
- * @param int $maxHeight
413
- */
 
414
  function resize($maxWidth = 0, $maxHeight = 0, $deprecated = 3) {
415
  $this->maxWidth = $maxWidth;
416
  $this->maxHeight = $maxHeight;
93
  */
94
  var $maxHeight;
95
 
96
+ var $newWidth;
97
+ var $newHeight;
98
+
99
+ /**
100
+ * Image Resource
101
+ *
102
+ * @param $fileName
103
+ * @param bool $no_ErrorImage
104
+ */
105
  function flag_Thumbnail($fileName,$no_ErrorImage = false) {
106
  //make sure the GD library is installed
107
  if(!function_exists("gd_info")) {
370
  imagedestroy($errImg);
371
  }
372
 
373
+ /**
374
+ * Resizes image to fixed Width x Height
375
+ *
376
+ * @param int $Width
377
+ * @param int $Height
378
+ * @param int $deprecated
379
+ */
380
  function resizeFix($Width = 0, $Height = 0, $deprecated = 3) {
381
  $this->newWidth = $Width;
382
  $this->newHeight = $Height;
409
  }
410
 
411
 
412
+ /**
413
+ * Resizes image to maxWidth x maxHeight
414
+ *
415
+ * @param int $maxWidth
416
+ * @param int $maxHeight
417
+ * @param int $deprecated
418
+ */
419
  function resize($maxWidth = 0, $maxHeight = 0, $deprecated = 3) {
420
  $this->maxWidth = $maxWidth;
421
  $this->maxHeight = $maxHeight;
lib/hitcounter.php CHANGED
@@ -30,6 +30,8 @@ if( $upd['pid'] && ($upd['hit'] || $upd['vote']) ) {
30
  flag_update_counter($upd);
31
  }
32
  $pid = $upd['pid'];
 
 
33
  $result = $wpdb->get_results( "SELECT hitcounter, total_votes FROM $wpdb->flagpictures WHERE `pid` = $pid" );
34
  $rt=array(24.5, 45.7, 54.8, 59.3, 64.7, 68.9, 71.5, 73.7, 75.9, 77.1);
35
  $hits = intval($result[0]->hitcounter);
@@ -48,8 +50,7 @@ echo $hits.'~'.$like.'~'.$votes;
48
  /**
49
  * Update image hitcounter in the database
50
  *
51
- * @param int $pid id of the image
52
- * @param string | int $galleryid
53
  */
54
  function flag_update_counter($upd) {
55
  global $wpdb;
30
  flag_update_counter($upd);
31
  }
32
  $pid = $upd['pid'];
33
+ /** @var $wpdb wpdb */
34
+ global $wpdb;
35
  $result = $wpdb->get_results( "SELECT hitcounter, total_votes FROM $wpdb->flagpictures WHERE `pid` = $pid" );
36
  $rt=array(24.5, 45.7, 54.8, 59.3, 64.7, 68.9, 71.5, 73.7, 75.9, 77.1);
37
  $hits = intval($result[0]->hitcounter);
50
  /**
51
  * Update image hitcounter in the database
52
  *
53
+ * @param $upd
 
54
  */
55
  function flag_update_counter($upd) {
56
  global $wpdb;
lib/media-rss.php CHANGED
@@ -41,8 +41,9 @@ class flagMediaRss {
41
  /**
42
  * Get the XML <rss> node corresponding to the last pictures registered
43
  *
44
- * @param page The current page (defaults to 0)
45
- * @param show The number of pictures to include in one field (default 30)
 
46
  */
47
  function get_last_pictures_mrss($page = 0, $show = 30) {
48
  $images = flagdb::find_last_images($page, $show);
@@ -59,9 +60,10 @@ class flagMediaRss {
59
  /**
60
  * Get the XML <rss> node corresponding to a gallery
61
  *
62
- * @param $gallery (object) The gallery to include in RSS
63
- * @param $prev_gallery (object) The previous gallery to link in RSS (null if none)
64
- * @param $next_gallery (object) The next gallery to link in RSS (null if none)
 
65
  */
66
  function get_gallery_mrss($gallery, $prev_gallery = null, $next_gallery = null) {
67
  global $flag;
@@ -155,15 +157,17 @@ class flagMediaRss {
155
  */
156
  function get_next_link_mrss_node($link, $indent = "\t\t") {
157
  return $indent . "<atom:link rel='next' href='" . htmlspecialchars($link) . "' />\n";
158
- }
159
-
160
  /**
161
  * Get the XML <item> node corresponding to one single image
162
  *
163
- * @param $image The image object
 
 
164
  */
165
  function get_image_mrss_node($image, $indent = "\t\t" ) {
166
- global $flag;
167
  $flag_options = get_option('flag_options');
168
 
169
  $title = html_entity_decode(stripslashes($image->alttext));
41
  /**
42
  * Get the XML <rss> node corresponding to the last pictures registered
43
  *
44
+ * @param int $page The current page (defaults to 0)
45
+ * @param int $show The number of pictures to include in one field (default 30)
46
+ * @return string
47
  */
48
  function get_last_pictures_mrss($page = 0, $show = 30) {
49
  $images = flagdb::find_last_images($page, $show);
60
  /**
61
  * Get the XML <rss> node corresponding to a gallery
62
  *
63
+ * @param $gallery object The gallery to include in RSS
64
+ * @param $prev_gallery object The previous gallery to link in RSS (null if none)
65
+ * @param $next_gallery object The next gallery to link in RSS (null if none)
66
+ * @return string
67
  */
68
  function get_gallery_mrss($gallery, $prev_gallery = null, $next_gallery = null) {
69
  global $flag;
157
  */
158
  function get_next_link_mrss_node($link, $indent = "\t\t") {
159
  return $indent . "<atom:link rel='next' href='" . htmlspecialchars($link) . "' />\n";
160
+ }
161
+
162
  /**
163
  * Get the XML <item> node corresponding to one single image
164
  *
165
+ * @param object $image
166
+ * @param string $indent
167
+ * @return string
168
  */
169
  function get_image_mrss_node($image, $indent = "\t\t" ) {
170
+
171
  $flag_options = get_option('flag_options');
172
 
173
  $title = html_entity_decode(stripslashes($image->alttext));
lib/meta.php CHANGED
@@ -18,10 +18,10 @@ class flagMeta {
18
 
19
  /**
20
  * flagMeta::flagMeta()
21
- *
22
- * @param string $image path to a image
23
  * @param bool $onlyEXIF parse only exif if needed
24
- * @return
25
  */
26
  function flagMeta($pic_id, $onlyEXIF = false) {
27
 
@@ -61,8 +61,8 @@ class flagMeta {
61
 
62
  /**
63
  * return the saved meta data from the database
64
- *
65
- * @param string $object (optional)
66
  * @return array|mixed return either the complete array or the single object
67
  */
68
  function get_saved_meta($object = false) {
@@ -90,10 +90,11 @@ class flagMeta {
90
  }
91
 
92
  /**
93
- * flagMeta::get_EXIF()
94
- *
95
- * @return structured EXIF data
96
- */
 
97
  function get_EXIF($object = false) {
98
 
99
  if (!$this->exif_data)
@@ -177,11 +178,11 @@ class flagMeta {
177
  }
178
 
179
  /**
180
- * flagMeta::readIPTC() - IPTC Data Information for EXIF Display
181
- *
182
- * @param mixed $output_tag
183
- * @return IPTC-tags
184
- */
185
  function get_IPTC($object = false) {
186
  if (!$this->iptc_data)
187
  return false;
@@ -230,7 +231,7 @@ class flagMeta {
230
  * code by Pekka Saarinen http://photography-on-the.net
231
  *
232
  * @param mixed $filename
233
- * @return XML data
234
  */
235
  function extract_XMP($filename) {
236
  //TODO:Require a lot of memory, could be better
@@ -251,12 +252,12 @@ class flagMeta {
251
  }
252
 
253
  /**
254
- * flagMeta::get_XMP()
255
- *
256
- * @package Taken from http://php.net/manual/en/function.xml-parse-into-struct.php
257
- * @return XML Array or object
258
- *
259
- */
260
  function get_XMP($object = false) {
261
  if (!$this->xmp_data)
262
  return false;
@@ -348,19 +349,18 @@ class flagMeta {
348
  $key = array_shift($stack);
349
  //TODO:Review this, reports sometimes a error "Fatal error: Only variables can be passed by reference" (PHP 5.2.6)
350
  $this->setArrayValue($array [$key], $stack, $value);
351
- return $array;
352
- }
353
- else {
354
  $array = $value;
355
  }
 
356
  }
357
 
358
  /**
359
- * flagMeta::get_META() - return a meta value form the available list
360
- *
361
- * @param string $object
362
- * @return mixed $value
363
- */
364
  function get_META($object = false) {
365
  // defined order first look into database, then XMP, IPTC and EXIF.
366
  if ($value = $this->get_saved_meta($object))
@@ -379,7 +379,7 @@ class flagMeta {
379
  * flagMeta::i8n_name() - localize the tag name
380
  *
381
  * @param mixed $key
382
- * @return translated $key
383
  */
384
  function i8n_name($key) {
385
  $tagnames = array(
@@ -409,9 +409,7 @@ class flagMeta {
409
  'country_code' => __('Country code','flag'),
410
  'country' => __('Country','flag'),
411
  'headline' => __('Headline','flag'),
412
- 'credit' => __('Credit','flag'),
413
  'source' => __('Source','flag'),
414
- 'copyright' => __('Copyright Notice','flag'),
415
  'contact' => __('Contact','flag'),
416
  'last_modfied' => __('Last modified','flag'),
417
  'tool' => __('Program tool','flag'),
@@ -449,11 +447,10 @@ class flagMeta {
449
  * This function return the most common metadata, via a filter we can add more
450
  * Reason : GD manipulation removes that options
451
  *
452
- * @return void
453
  */
454
  function get_common_meta() {
455
- global $wpdb;
456
-
457
  $meta = array(
458
  'aperture' => 0,
459
  'credit' => '',
18
 
19
  /**
20
  * flagMeta::flagMeta()
21
+ *
22
+ * @param $pic_id
23
  * @param bool $onlyEXIF parse only exif if needed
24
+ * @return bool
25
  */
26
  function flagMeta($pic_id, $onlyEXIF = false) {
27
 
61
 
62
  /**
63
  * return the saved meta data from the database
64
+ *
65
+ * @param bool|string $object (optional)
66
  * @return array|mixed return either the complete array or the single object
67
  */
68
  function get_saved_meta($object = false) {
90
  }
91
 
92
  /**
93
+ * flagMeta::get_EXIF()
94
+ *
95
+ * @param bool $object
96
+ * @return string structured EXIF data
97
+ */
98
  function get_EXIF($object = false) {
99
 
100
  if (!$this->exif_data)
178
  }
179
 
180
  /**
181
+ * flagMeta::readIPTC() - IPTC Data Information for EXIF Display
182
+ *
183
+ * @param bool $object
184
+ * @return string IPTC-tags
185
+ */
186
  function get_IPTC($object = false) {
187
  if (!$this->iptc_data)
188
  return false;
231
  * code by Pekka Saarinen http://photography-on-the.net
232
  *
233
  * @param mixed $filename
234
+ * @return string XML data
235
  */
236
  function extract_XMP($filename) {
237
  //TODO:Require a lot of memory, could be better
252
  }
253
 
254
  /**
255
+ * flagMeta::get_XMP()
256
+ *
257
+ * @package Taken from http://php.net/manual/en/function.xml-parse-into-struct.php
258
+ * @param bool $object
259
+ * @return Array|object XML
260
+ */
261
  function get_XMP($object = false) {
262
  if (!$this->xmp_data)
263
  return false;
349
  $key = array_shift($stack);
350
  //TODO:Review this, reports sometimes a error "Fatal error: Only variables can be passed by reference" (PHP 5.2.6)
351
  $this->setArrayValue($array [$key], $stack, $value);
352
+ } else {
 
 
353
  $array = $value;
354
  }
355
+ return $array;
356
  }
357
 
358
  /**
359
+ * flagMeta::get_META() - return a meta value form the available list
360
+ *
361
+ * @param bool|string $object
362
+ * @return mixed $value
363
+ */
364
  function get_META($object = false) {
365
  // defined order first look into database, then XMP, IPTC and EXIF.
366
  if ($value = $this->get_saved_meta($object))
379
  * flagMeta::i8n_name() - localize the tag name
380
  *
381
  * @param mixed $key
382
+ * @return string translated $key
383
  */
384
  function i8n_name($key) {
385
  $tagnames = array(
409
  'country_code' => __('Country code','flag'),
410
  'country' => __('Country','flag'),
411
  'headline' => __('Headline','flag'),
 
412
  'source' => __('Source','flag'),
 
413
  'contact' => __('Contact','flag'),
414
  'last_modfied' => __('Last modified','flag'),
415
  'tool' => __('Program tool','flag'),
447
  * This function return the most common metadata, via a filter we can add more
448
  * Reason : GD manipulation removes that options
449
  *
450
+ * @return mixed
451
  */
452
  function get_common_meta() {
453
+
 
454
  $meta = array(
455
  'aperture' => 0,
456
  'credit' => '',
lib/shortcodes.php CHANGED
@@ -52,6 +52,7 @@ class FlAG_shortcodes {
52
  $gallerylist = $flagdb->get_album($album);
53
  $ids = explode( ',', $gallerylist );
54
  $gids = str_replace(',','_',$gallerylist);
 
55
  foreach ($ids as $id) {
56
  $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE gid = '$id' ");
57
  if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
@@ -80,7 +81,8 @@ class FlAG_shortcodes {
80
  $ids = explode( ',', $gid );
81
  $gids = str_replace(',','_',$gid);
82
 
83
- foreach ($ids as $id) {
 
84
  $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE gid = '$id' ");
85
  if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE name = '$id' ");
86
  if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
52
  $gallerylist = $flagdb->get_album($album);
53
  $ids = explode( ',', $gallerylist );
54
  $gids = str_replace(',','_',$gallerylist);
55
+ $galleryID = false;
56
  foreach ($ids as $id) {
57
  $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE gid = '$id' ");
58
  if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
81
  $ids = explode( ',', $gid );
82
  $gids = str_replace(',','_',$gid);
83
 
84
+ $galleryID = false;
85
+ foreach ($ids as $id) {
86
  $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE gid = '$id' ");
87
  if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE name = '$id' ");
88
  if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
lib/swfobject.php CHANGED
@@ -2,12 +2,19 @@
2
  /**
3
  * Return a script for the flash slideshow. Can be used in any tmeplate with <?php echo flagShowFlashAlbum($galleryID, $name, $width, $height, $skin) ? >
4
  * Require the script swfobject.js in the header or footer
5
- *
6
- * @access public
7
  * @param integer $galleryID ID of the gallery
8
- * @param integer $flashWidth Width of the flash container
9
- * @param integer $flashHeight Height of the flash container
10
- * @return the content
 
 
 
 
 
 
 
11
  */
12
  function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='', $playlist='', $wmode='', $linkto='', $fullwindow=false, $align='') {
13
  global $post;
@@ -19,10 +26,10 @@ function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='
19
  $flag_options = get_option('flag_options');
20
  $skinID = 'sid_'.mt_rand();
21
  if($skin == '') $skin = $flag_options['flashSkin'];
22
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
23
  if(!is_dir($skinpath)) {
24
  $skin = 'default';
25
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
26
  }
27
  $swfmousewheel = '';
28
  $flashBacktransparent = '';
@@ -76,9 +83,7 @@ function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='
76
  else
77
  $height = 'auto';
78
  // init the flash output
79
- $swfobject = new flag_swfobject( $flag_options['skinsDirURL'].$skin.'/gallery.swf' , $skinID, '100%', '100%', '11.0.0', FLAG_URLPATH .'skins/expressInstall.swf');
80
-
81
- $swfobject->message = '<p>'. __('The <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> and a browser with Javascript support are needed.', 'flag').'</p>';
82
 
83
  $swfobject->add_params('wmode', $wmode);
84
  $swfobject->add_params('allowfullscreen', 'true');
@@ -91,7 +96,7 @@ function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='
91
  $swfobject->add_attributes('id', $skinID);
92
 
93
  // adding the flash parameter
94
- $swfobject->add_flashvars( 'path', $flag_options['skinsDirURL'].$skin.'/' );
95
  $swfobject->add_flashvars( 'gID', $galleryID );
96
  $swfobject->add_flashvars( 'galName', $name );
97
  $swfobject->add_flashvars( 'skinID', $skinID );
@@ -145,12 +150,12 @@ function flagShowMPlayer($playlist, $width, $height, $wmode='', $skin='', $isWid
145
  require_once ( dirname(dirname(__FILE__)) . '/admin/playlist.functions.php');
146
 
147
  $flag_options = get_option('flag_options');
148
- $playlistPath = $flag_options['galleryPath'].'playlists/'.$playlist.'.xml';
149
  $playlist_data = get_playlist_data(ABSPATH.$playlistPath);
150
  if(!$skin){
151
  $skin = $playlist_data['skin'];
152
  }
153
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
154
  include_once ( $skinpath.'/'.$skin.'.php' );
155
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
156
  $args = array(
@@ -172,10 +177,10 @@ function flagShowVPlayer($playlist, $width, $height, $wmode='') {
172
  require_once ( dirname(dirname(__FILE__)) . '/admin/video.functions.php');
173
 
174
  $flag_options = get_option('flag_options');
175
- $playlistPath = $flag_options['galleryPath'].'playlists/video/'.$playlist.'.xml';
176
  $playlist_data = get_v_playlist_data(ABSPATH.$playlistPath);
177
  $skin = $playlist_data['skin'];
178
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
179
  include_once ( $skinpath.'/'.$skin.'.php' );
180
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
181
  $args = array(
@@ -245,11 +250,11 @@ function flagShowBanner($xml, $width, $height, $wmode='') {
245
  require_once ( dirname(dirname(__FILE__)) . '/admin/banner.functions.php');
246
 
247
  $flag_options = get_option('flag_options');
248
- $playlistPath = $flag_options['galleryPath'].'playlists/banner/'.$xml.'.xml';
249
  $playlist_data = get_b_playlist_data(ABSPATH.$playlistPath);
250
  $skin = $playlist_data['skin'];
251
  $items = $playlist_data['items'];
252
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
253
  include_once ( $skinpath.'/'.$skin.'.php' );
254
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
255
  $args = array(
@@ -271,13 +276,13 @@ function flagShowWidgetBanner($xml, $width, $height, $skin) {
271
  require_once ( dirname(dirname(__FILE__)) . '/admin/banner.functions.php');
272
 
273
  $flag_options = get_option('flag_options');
274
- $playlistPath = $flag_options['galleryPath'].'playlists/banner/'.$xml.'.xml';
275
  $playlist_data = get_b_playlist_data(ABSPATH.$playlistPath);
276
  if(!$skin) {
277
  $skin = $playlist_data['skin'];
278
  }
279
  $items = $playlist_data['items'];
280
- $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
281
  include_once ( $skinpath.'/'.$skin.'.php' );
282
  $args = array(
283
  'xml' => $xml,
2
  /**
3
  * Return a script for the flash slideshow. Can be used in any tmeplate with <?php echo flagShowFlashAlbum($galleryID, $name, $width, $height, $skin) ? >
4
  * Require the script swfobject.js in the header or footer
5
+ *
6
+ * @access public
7
  * @param integer $galleryID ID of the gallery
8
+ * @param string $name
9
+ * @param string $width
10
+ * @param string $height
11
+ * @param string $skin
12
+ * @param string $playlist
13
+ * @param string $wmode
14
+ * @param string $linkto
15
+ * @param bool $fullwindow
16
+ * @param string $align
17
+ * @return string the content
18
  */
19
  function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='', $playlist='', $wmode='', $linkto='', $fullwindow=false, $align='') {
20
  global $post;
26
  $flag_options = get_option('flag_options');
27
  $skinID = 'sid_'.mt_rand();
28
  if($skin == '') $skin = $flag_options['flashSkin'];
29
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
30
  if(!is_dir($skinpath)) {
31
  $skin = 'default';
32
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
33
  }
34
  $swfmousewheel = '';
35
  $flashBacktransparent = '';
83
  else
84
  $height = 'auto';
85
  // init the flash output
86
+ $swfobject = new flag_swfobject( plugins_url('flagallery-skins/'.$skin.'/gallery.swf') , $skinID, '100%', '100%', '11.0.0', FLAG_URLPATH .'skins/expressInstall.swf');
 
 
87
 
88
  $swfobject->add_params('wmode', $wmode);
89
  $swfobject->add_params('allowfullscreen', 'true');
96
  $swfobject->add_attributes('id', $skinID);
97
 
98
  // adding the flash parameter
99
+ $swfobject->add_flashvars( 'path', plugins_url('flagallery-skins/'.$skin.'/') );
100
  $swfobject->add_flashvars( 'gID', $galleryID );
101
  $swfobject->add_flashvars( 'galName', $name );
102
  $swfobject->add_flashvars( 'skinID', $skinID );
150
  require_once ( dirname(dirname(__FILE__)) . '/admin/playlist.functions.php');
151
 
152
  $flag_options = get_option('flag_options');
153
+ $playlistPath = 'wp-content/flagallery/playlists/'.$playlist.'.xml';
154
  $playlist_data = get_playlist_data(ABSPATH.$playlistPath);
155
  if(!$skin){
156
  $skin = $playlist_data['skin'];
157
  }
158
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
159
  include_once ( $skinpath.'/'.$skin.'.php' );
160
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
161
  $args = array(
177
  require_once ( dirname(dirname(__FILE__)) . '/admin/video.functions.php');
178
 
179
  $flag_options = get_option('flag_options');
180
+ $playlistPath = 'wp-content/flagallery/playlists/video/'.$playlist.'.xml';
181
  $playlist_data = get_v_playlist_data(ABSPATH.$playlistPath);
182
  $skin = $playlist_data['skin'];
183
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
184
  include_once ( $skinpath.'/'.$skin.'.php' );
185
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
186
  $args = array(
250
  require_once ( dirname(dirname(__FILE__)) . '/admin/banner.functions.php');
251
 
252
  $flag_options = get_option('flag_options');
253
+ $playlistPath = 'wp-content/flagallery/playlists/banner/'.$xml.'.xml';
254
  $playlist_data = get_b_playlist_data(ABSPATH.$playlistPath);
255
  $skin = $playlist_data['skin'];
256
  $items = $playlist_data['items'];
257
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
258
  include_once ( $skinpath.'/'.$skin.'.php' );
259
  $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']);
260
  $args = array(
276
  require_once ( dirname(dirname(__FILE__)) . '/admin/banner.functions.php');
277
 
278
  $flag_options = get_option('flag_options');
279
+ $playlistPath = 'wp-content/flagallery/playlists/banner/'.$xml.'.xml';
280
  $playlist_data = get_b_playlist_data(ABSPATH.$playlistPath);
281
  if(!$skin) {
282
  $skin = $playlist_data['skin'];
283
  }
284
  $items = $playlist_data['items'];
285
+ $skinpath = ABSPATH.'wp-content/plugins/flagallery-skins/'.$skin;
286
  include_once ( $skinpath.'/'.$skin.'.php' );
287
  $args = array(
288
  'xml' => $xml,
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === GRAND FlAGallery ===
2
  Contributors: Rattus
3
  Donate link: http://photogallerycreator.com/grand-flagallery/
4
- Tags: admin, flash, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, slider, plugin, Post, posts, slideshow, video, widget, iOS gallery
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
  Stable tag: trunk
@@ -41,6 +41,27 @@ Starting with version 1.70 and with new [PhotoBlog skin](http://photogallerycrea
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  = v2.11 - 03.11.2012 =
45
  * Updated: New system of checking license key
46
  * Changed: Skins update box.
1
  === GRAND FlAGallery ===
2
  Contributors: Rattus
3
  Donate link: http://photogallerycreator.com/grand-flagallery/
4
+ Tags: admin, flash, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, slider, plugin, Post, posts, slideshow, video, widget, iOS gallery, iphone gallery
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
  Stable tag: trunk
41
 
42
  == Changelog ==
43
 
44
+ = v2.17 - 08.01.2013 =
45
+ * Added: Sort images option: Randomly
46
+ * Changed: Alternative gallery thumbs for not square images
47
+ * Fixed: Skin name was wrong when click delete skin
48
+ * Fixed: Small fixes
49
+
50
+ = v2.16 - 17.12.2012 =
51
+ * Added: Hooks for manage images/galleries
52
+
53
+ = v2.15 - 04.12.2012 =
54
+ * Optimized: Code optimized
55
+ * Added: Hook for bulk actions dropdown
56
+ * Added: Hook after thumbnail/image created
57
+ * Fixed: Small PHP and JS fixes
58
+
59
+ = v2.14 - 20.11.2012 =
60
+ * Fixed: swfobject path was wrong on some servers
61
+
62
+ = v2.12 - 12.11.2012 =
63
+ * Fixed: XSS vulnerability in swfupload
64
+
65
  = v2.11 - 03.11.2012 =
66
  * Updated: New system of checking license key
67
  * Changed: Skins update box.
skins/default/default.php CHANGED
@@ -5,7 +5,7 @@ Skin URI:
5
  Description: Midnight skin for Flash Album Gallery. <br /><strong>Compatible:</strong><li>HitCounter</li><li>Alternate jQuery gallery for iPhone / iPad and devices without flash player.</li><li>SEO optimized and support feed RSS2.</li><li>GRAND Pages - FullWindow Mode</li><strong style="color: red;">Recommended - GRAND FlAGallery v1.7 or higher.</strong><br /><br />You can use any language you want for album name, alt/title and description in FlAGallery ;)<br /><br />Details: system font for image description, bottom thumbnails, 'FS' (full screen) button, 'SL' (slideshow) button, image description button (i)
6
  Author: PGC
7
  Author URI: http://PhotoGalleryCreator.com
8
- Version: 4.0
9
  */
10
 
11
  function flag_skin_options() {
5
  Description: Midnight skin for Flash Album Gallery. <br /><strong>Compatible:</strong><li>HitCounter</li><li>Alternate jQuery gallery for iPhone / iPad and devices without flash player.</li><li>SEO optimized and support feed RSS2.</li><li>GRAND Pages - FullWindow Mode</li><strong style="color: red;">Recommended - GRAND FlAGallery v1.7 or higher.</strong><br /><br />You can use any language you want for album name, alt/title and description in FlAGallery ;)<br /><br />Details: system font for image description, bottom thumbnails, 'FS' (full screen) button, 'SL' (slideshow) button, image description button (i)
6
  Author: PGC
7
  Author URI: http://PhotoGalleryCreator.com
8
+ Version: 4.1
9
  */
10
 
11
  function flag_skin_options() {
skins/default/gallery.php CHANGED
@@ -50,14 +50,21 @@ echo "<xml>\n"; ?>
50
  <plug data="<?php echo $url_plug; ?>"/>
51
  </color>
52
  <?php
 
 
 
 
 
 
 
53
  echo "<gallery title='".attribute_escape(stripslashes($_GET['albumname']))."'>\n";
54
  // get the pictures
55
  foreach ( $gID as $galleryID ) {
56
  $galleryID = (int) $galleryID;
57
  if ( $galleryID == 0) {
58
- $thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE 1=1 {$exclude_clause} ORDER BY tt.{$flag_options['galSort']} {$flag_options['galSortDir']} ");
59
  } else {
60
- $thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '$galleryID' {$exclude_clause} ORDER BY tt.{$flag_options['galSort']} {$flag_options['galSortDir']} ");
61
  }
62
 
63
  echo " <category id='".$galleryID."' title='".attribute_escape(flagGallery::i18n(strip_tags(stripslashes($thepictures[0]->title))))."'>\n";
50
  <plug data="<?php echo $url_plug; ?>"/>
51
  </color>
52
  <?php
53
+ $order_dir = ( $flag_options['galSortDir'] == 'DESC') ? 'DESC' : 'ASC';
54
+ $order_by = ( empty($flag_options['galSort']) ) ? 'tt.sortorder' : 'tt.'.$flag_options['galSort'];
55
+ if($order_by == 'tt.rand()'){
56
+ $order_by = 'rand()';
57
+ $order_dir = '';
58
+ }
59
+
60
  echo "<gallery title='".attribute_escape(stripslashes($_GET['albumname']))."'>\n";
61
  // get the pictures
62
  foreach ( $gID as $galleryID ) {
63
  $galleryID = (int) $galleryID;
64
  if ( $galleryID == 0) {
65
+ $thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE 1=1 {$exclude_clause} ORDER BY {$order_by} {$order_dir} ");
66
  } else {
67
+ $thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '$galleryID' {$exclude_clause} ORDER BY {$order_by} {$order_dir} ");
68
  }
69
 
70
  echo " <category id='".$galleryID."' title='".attribute_escape(flagGallery::i18n(strip_tags(stripslashes($thepictures[0]->title))))."'>\n";