Gallery – Flagallery Photo Portfolio - Version 2.76

Version Description

Download this release

Release Info

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

Code changes from version 2.72 to 2.76

admin/ajax.php CHANGED
@@ -86,7 +86,7 @@ function flagCreateNewThumb() {
86
  $thumb->resize(0,$flag_options['thumbHeight']);
87
  }
88
  } else {
89
- $thumb->resize($flag_options['thumbWidth'],$flag_options['thumbHeight'],$flag_options['thumbResampleMode']);
90
  }
91
 
92
  if ( $thumb->save($picture->thumbPath, 100)) {
86
  $thumb->resize(0,$flag_options['thumbHeight']);
87
  }
88
  } else {
89
+ $thumb->resize($flag_options['thumbWidth'],$flag_options['thumbHeight']);
90
  }
91
 
92
  if ( $thumb->save($picture->thumbPath, 100)) {
admin/banner-box.php CHANGED
@@ -16,7 +16,7 @@ require_once (dirname (__FILE__) . '/banner.functions.php');
16
 
17
  function flag_banner_controler() {
18
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
19
- if ($_POST['importfolder']){
20
  check_admin_referer('flag_addbanner');
21
  $bannerfolder = $_POST['bannerfolder'];
22
  if ( !empty($bannerfolder) ) {
16
 
17
  function flag_banner_controler() {
18
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
19
+ if (isset($_POST['importfolder']) && $_POST['importfolder']){
20
  check_admin_referer('flag_addbanner');
21
  $bannerfolder = $_POST['bannerfolder'];
22
  if ( !empty($bannerfolder) ) {
admin/css/flagadmin.css CHANGED
@@ -77,6 +77,8 @@
77
 
78
  /* SETTINGS FOR MANAGE TABLE */
79
 
 
 
80
  p#flag-inlinebutton {
81
  float:right;
82
  margin:0pt;
@@ -106,7 +108,8 @@ p#flag-inlinebutton {
106
  }
107
 
108
  .fixed .column-thumbnail img{
109
- max-height:60px;
 
110
  max-width:80px;
111
  }
112
 
@@ -126,6 +129,8 @@ p#flag-inlinebutton {
126
  .fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
127
  width: 2.2em; text-align: center;
128
  }
 
 
129
  .fixed .column-exclude input {
130
  margin-top:4px;
131
  }
@@ -139,7 +144,7 @@ p#flag-inlinebutton {
139
  .flagform .widefat thead th.cb { width: 54px; text-align: center; }
140
  .flagform .widefat tfoot th.cb { text-align: center; }
141
 
142
- .albums_table { width: 600px; position: relative; background: #ffffff; border: 1px solid #cccccc; border-radius: 4px; margin: 7px 0; padding: 1px 3px; float: left; }
143
  .albums_table .album { position: relative; background: #f8f8f8; border: 1px solid #cccccc; border-radius: 4px; margin:2px 0; padding: 3px 3px 3px 36px; }
144
  .albums_table .album form { margin: 0; padding: 0; display: inline; }
145
  .albums_table .albID { position: absolute; display: block; width: 30px; top: 6px; left: 0px; text-align: right; }
@@ -155,7 +160,7 @@ p#flag-inlinebutton {
155
  .flag-ajax-post { cursor: pointer; text-decoration: underline; }
156
  .flag-ajax-post:hover { color: #ff0000; }
157
 
158
- .all_galleries { float: left; white-space: nowrap; margin: 7px 0 0px 50px; }
159
  .all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; }
160
  .all_galleries .acat .drop { display: none; }
161
  .all_galleries .acat:hover { background-color: #FFFFEE; }
77
 
78
  /* SETTINGS FOR MANAGE TABLE */
79
 
80
+ .flag_draft, .alt.flag_draft {background-color: #FFEBE8;}
81
+
82
  p#flag-inlinebutton {
83
  float:right;
84
  margin:0pt;
108
  }
109
 
110
  .fixed .column-thumbnail img{
111
+ height:auto;
112
+ width: 100%;
113
  max-width:80px;
114
  }
115
 
129
  .fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
130
  width: 2.2em; text-align: center;
131
  }
132
+ .fixed .column-exclude { width: 70px; white-space: nowrap; }
133
+ .fixed th.column-exclude img { vertical-align: text-top; }
134
  .fixed .column-exclude input {
135
  margin-top:4px;
136
  }
144
  .flagform .widefat thead th.cb { width: 54px; text-align: center; }
145
  .flagform .widefat tfoot th.cb { text-align: center; }
146
 
147
+ .albums_table { width: 600px; position: relative; background: #ffffff; border: 1px solid #cccccc; border-radius: 4px; margin: 7px 0; padding: 1px 3px; float: left; max-height: 550px; overflow: auto; }
148
  .albums_table .album { position: relative; background: #f8f8f8; border: 1px solid #cccccc; border-radius: 4px; margin:2px 0; padding: 3px 3px 3px 36px; }
149
  .albums_table .album form { margin: 0; padding: 0; display: inline; }
150
  .albums_table .albID { position: absolute; display: block; width: 30px; top: 6px; left: 0px; text-align: right; }
160
  .flag-ajax-post { cursor: pointer; text-decoration: underline; }
161
  .flag-ajax-post:hover { color: #ff0000; }
162
 
163
+ .all_galleries { float: left; white-space: nowrap; margin: 7px 0 0px 50px; max-height: 550px; overflow: auto; padding-right: 20px; }
164
  .all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; }
165
  .all_galleries .acat .drop { display: none; }
166
  .all_galleries .acat:hover { background-color: #FFFFEE; }
admin/flag_install.php CHANGED
@@ -47,6 +47,7 @@ function flag_install () {
47
  alttext MEDIUMTEXT NULL ,
48
  link TEXT NULL ,
49
  imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
 
50
  exclude TINYINT NULL DEFAULT '0',
51
  sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
52
  location TEXT,
@@ -79,6 +80,7 @@ function flag_install () {
79
  previewpic BIGINT(20) NULL DEFAULT '0' ,
80
  sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
81
  author BIGINT(20) NOT NULL DEFAULT '0' ,
 
82
  PRIMARY KEY gid (gid)
83
  ) $charset_collate;";
84
 
@@ -132,6 +134,9 @@ function flag_install () {
132
  // if all is passed , save the VERSIONs
133
  add_option("flag_db_version", FLAG_DBVERSION);
134
  add_option("flagVersion", FLAGVERSION);
 
 
 
135
  }
136
 
137
  function flag_capabilities() {
47
  alttext MEDIUMTEXT NULL ,
48
  link TEXT NULL ,
49
  imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
50
+ modified TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP,
51
  exclude TINYINT NULL DEFAULT '0',
52
  sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
53
  location TEXT,
80
  previewpic BIGINT(20) NULL DEFAULT '0' ,
81
  sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
82
  author BIGINT(20) NOT NULL DEFAULT '0' ,
83
+ status TINYINT NULL DEFAULT '0' ,
84
  PRIMARY KEY gid (gid)
85
  ) $charset_collate;";
86
 
134
  // if all is passed , save the VERSIONs
135
  add_option("flag_db_version", FLAG_DBVERSION);
136
  add_option("flagVersion", FLAGVERSION);
137
+
138
+ include_once( dirname (__FILE__). '/tuning.php');
139
+ flag_tune();
140
  }
141
 
142
  function flag_capabilities() {
admin/functions.php CHANGED
@@ -11,17 +11,26 @@ class flagAdmin{
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
23
  get_currentuserinfo();
24
 
 
 
 
 
 
 
 
 
 
25
  //cleanup pathname
26
  $galleryname = sanitize_file_name( $gallerytitle );
27
  $galleryname = apply_filters('flag_gallery_name', $galleryname);
@@ -94,9 +103,9 @@ class flagAdmin{
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) );
100
  // and give me the new id
101
  $gallery_id = (int) $wpdb->insert_id;
102
  // here you can inject a custom function
@@ -104,7 +113,7 @@ class flagAdmin{
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) . '"]');
108
  $message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
109
  $message .= __('Edit gallery','flag');
110
  $message .= '</a>';
@@ -474,12 +483,13 @@ class flagAdmin{
474
  return $image->filename . __(' is not writeable ','flag');
475
 
476
  $thumb = new flag_Thumbnail($image->imagePath, TRUE);
 
477
 
478
  // skip if file is not there
479
  if (!$thumb->error) {
480
  if ($flag->options['thumbFix']) {
481
  // check for portrait format
482
- if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
483
  // first resize to the wanted width
484
  $thumb->resize($flag->options['thumbWidth'], 0);
485
  // get optimal y startpos
@@ -508,12 +518,12 @@ class flagAdmin{
508
 
509
  // add them to the database
510
  flagdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
511
- }
512
 
513
  $thumb->destruct();
514
 
515
  if ( !empty($thumb->errmsg) )
516
- return ' <strong>' . $image->filename . ' (Error : '.$thumb->errmsg .')</strong>';
517
 
518
  // success
519
  return '1';
11
  * create a new gallery & folder
12
  *
13
  * @class flagAdmin
14
+ * @param string $gallery
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($gallery, $defaultpath, $output = true) {
20
  global $wpdb, $user_ID;
21
 
22
  // get the current user ID
23
  get_currentuserinfo();
24
 
25
+ $description = '';
26
+ $status = 0;
27
+ if(is_array($gallery)){
28
+ $gallerytitle = $gallery['title'];
29
+ $description = $gallery['description'];
30
+ $status = intval($gallery['status']);
31
+ } else {
32
+ $gallerytitle = $gallery;
33
+ }
34
  //cleanup pathname
35
  $galleryname = sanitize_file_name( $gallerytitle );
36
  $galleryname = apply_filters('flag_gallery_name', $galleryname);
103
 
104
  if ($result) {
105
  if ($output) flagGallery::show_error( _n( 'Gallery', 'Galleries', 1, 'flag' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flag'));
106
+ return true;
107
  } else {
108
+ $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, galdesc, author, status) VALUES (%s, %s, %s, %s, %s, %d)", $galleryname, $flagpath, $gallerytitle, $description, $user_ID, $status) );
109
  // and give me the new id
110
  $gallery_id = (int) $wpdb->insert_id;
111
  // here you can inject a custom function
113
 
114
  if ($result) {
115
  $message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flag');
116
+ $message = sprintf($message, stripcslashes($gallery), '[flagallery gid=' . $gallery_id . ']');
117
  $message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
118
  $message .= __('Edit gallery','flag');
119
  $message .= '</a>';
483
  return $image->filename . __(' is not writeable ','flag');
484
 
485
  $thumb = new flag_Thumbnail($image->imagePath, TRUE);
486
+ $img_size = @getimagesize ( $image->imagePath );
487
 
488
  // skip if file is not there
489
  if (!$thumb->error) {
490
  if ($flag->options['thumbFix']) {
491
  // check for portrait format
492
+ if ( ($flag->options['thumbWidth']/$flag->options['thumbHeight'] > $img_size[0]/$img_size[1]) ) {
493
  // first resize to the wanted width
494
  $thumb->resize($flag->options['thumbWidth'], 0);
495
  // get optimal y startpos
518
 
519
  // add them to the database
520
  flagdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
521
+ }
522
 
523
  $thumb->destruct();
524
 
525
  if ( !empty($thumb->errmsg) )
526
+ return $image->filename . ' (Error : '.$thumb->errmsg .')';
527
 
528
  // success
529
  return '1';
admin/get_skin.php CHANGED
@@ -37,7 +37,7 @@ function get_skin_data( $skin_file, $type='' ) {
37
  fclose($fp);
38
 
39
  preg_match( '|^'.$type.'Skin Name:(.*)$|mi', $skin_data, $name );
40
- if($name[1]) {
41
  preg_match( '|Skin URI:(.*)$|mi', $skin_data, $uri );
42
  preg_match( '|uid:(.*)|i', $skin_data, $uid );
43
  preg_match( '|Version:(.*)|i', $skin_data, $version );
37
  fclose($fp);
38
 
39
  preg_match( '|^'.$type.'Skin Name:(.*)$|mi', $skin_data, $name );
40
+ if($name) {
41
  preg_match( '|Skin URI:(.*)$|mi', $skin_data, $uri );
42
  preg_match( '|uid:(.*)|i', $skin_data, $uid );
43
  preg_match( '|Version:(.*)|i', $skin_data, $version );
admin/jgallery.php CHANGED
@@ -68,6 +68,11 @@ if(isset($flag_options['disableViews']) && !empty($flag_options['disableViews'])
68
  } else { $disableViews = 0; }
69
  foreach ( $gID as $galID ) {
70
  $galID = (int) $galID;
 
 
 
 
 
71
  if ( $galID == 0) {
72
  $thegalleries = array();
73
  $thepictures = $wpdb->get_results("SELECT pid, galleryid, filename, description, alttext, link, imagedate, sortorder, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE 1=1 {$exclude_clause} ORDER BY {$flag_options['galSort']} {$flag_options['galSortDir']} ", ARRAY_A);
68
  } else { $disableViews = 0; }
69
  foreach ( $gID as $galID ) {
70
  $galID = (int) $galID;
71
+ $status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
72
+ if(intval($status)){
73
+ continue;
74
+ }
75
+
76
  if ( $galID == 0) {
77
  $thegalleries = array();
78
  $thepictures = $wpdb->get_results("SELECT pid, galleryid, filename, description, alttext, link, imagedate, sortorder, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE 1=1 {$exclude_clause} ORDER BY {$flag_options['galSort']} {$flag_options['galSortDir']} ", ARRAY_A);
admin/js/flag.ajax.js CHANGED
@@ -49,10 +49,12 @@ flagAjax = {
49
  index++;
50
  flagProgressBar.increase( index );
51
  // parse the whole array
52
- if (index < flagAjax.settings.ids.length)
53
  flagAjax.run( index );
54
- else
 
55
  flagProgressBar.finished();
 
56
  }
57
  });
58
  },
49
  index++;
50
  flagProgressBar.increase( index );
51
  // parse the whole array
52
+ if (index < flagAjax.settings.ids.length) {
53
  flagAjax.run( index );
54
+ }
55
+ else {
56
  flagProgressBar.finished();
57
+ }
58
  }
59
  });
60
  },
admin/js/jquery.fancybox-1.3.4.css CHANGED
@@ -19,9 +19,19 @@
19
  #fancybox-loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background-image: url('images/fancybox.png'); }
20
  #fancybox-overlay { position: absolute; top: 0; left: 0; width: 100%; z-index: 10100; display: none; }
21
  #fancybox-tmp { padding: 0; margin: 0; border: 0; overflow: auto; display: none; }
22
- #fancybox-wrap { position: absolute; top: 0; left: 0; padding: 20px; z-index: 10101; outline: none; display: none; }
 
 
 
 
 
23
  #fancybox-outer { position: relative; width: 100%; height: 100%; background: #fff; }
24
- #fancybox-content { width: 0; height: 0; padding: 0; outline: none; position: relative; overflow: hidden; z-index: 10102; border: 0px solid #fff; }
 
 
 
 
 
25
  #fancybox-hide-sel-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 10101; }
26
  #fancybox-close { position: absolute; top: -15px; right: -15px; width: 30px; height: 30px; background: transparent url('images/fancybox.png') -40px 0px; cursor: pointer; z-index: 10103; display: none; border: none; padding: 0; margin: 0; }
27
  #fancybox-error { color: #444; font: normal 12px/20px Arial; padding: 14px; margin: 0; }
19
  #fancybox-loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background-image: url('images/fancybox.png'); }
20
  #fancybox-overlay { position: absolute; top: 0; left: 0; width: 100%; z-index: 10100; display: none; }
21
  #fancybox-tmp { padding: 0; margin: 0; border: 0; overflow: auto; display: none; }
22
+ #fancybox-wrap { position: absolute; top: 0; left: 0; padding: 20px; z-index: 10101; outline: none; display: none;
23
+ -moz-box-sizing: content-box;
24
+ -webkit-box-sizing: content-box;
25
+ -o-box-sizing: content-box;
26
+ box-sizing: content-box;
27
+ }
28
  #fancybox-outer { position: relative; width: 100%; height: 100%; background: #fff; }
29
+ #fancybox-content { width: 0; height: 0; padding: 0; outline: none; position: relative; overflow: hidden; z-index: 10102; border: 0px solid #fff;
30
+ -moz-box-sizing: content-box;
31
+ -webkit-box-sizing: content-box;
32
+ -o-box-sizing: content-box;
33
+ box-sizing: content-box;
34
+ }
35
  #fancybox-hide-sel-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 10101; }
36
  #fancybox-close { position: absolute; top: -15px; right: -15px; width: 30px; height: 30px; background: transparent url('images/fancybox.png') -40px 0px; cursor: pointer; z-index: 10103; display: none; border: none; padding: 0; margin: 0; }
37
  #fancybox-error { color: #444; font: normal 12px/20px Arial; padding: 14px; margin: 0; }
admin/js/swfupload.handler.js CHANGED
@@ -90,7 +90,8 @@ function uploadComplete(fileObj) {
90
  function uploadSuccess(fileObj, server_data) {
91
  // Show any error message
92
  if (server_data != 0){
93
- jQuery("#progressbar-wrap").append("<div><strong>ERROR</strong>: " + fileObj.name + " : " + server_data + "</div>");
 
94
  }
95
  // Upload the next file until queue is empty
96
  if ( flag_swf_upload.getStats().files_queued > 0) {
@@ -141,12 +142,13 @@ function uploadError(fileObj, error_code, message) {
141
  break;
142
  }
143
  jQuery("#progressbar-wrap").append("<div><strong>ERROR " + error_name + " </strong>: " + fileObj.name + " : " + message + "</div>");
 
144
  jQuery("#" + fileObj.id).hide("slow");
145
  jQuery("#" + fileObj.id).remove();
146
  if ( flag_swf_upload.getStats().files_queued > 0) {
147
  flag_swf_upload.startUpload();
148
  } else {
149
- jQuery("#progressbar-wrap").hide()
150
  jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + error_name + "\">");
151
  jQuery("#uploadimage_form").submit();
152
  }
90
  function uploadSuccess(fileObj, server_data) {
91
  // Show any error message
92
  if (server_data != 0){
93
+ //jQuery("#progressbar-wrap").append("<div><strong>ERROR</strong>: " + fileObj.name + " : " + server_data + "</div>");
94
+ console.log('s: ' + fileObj.name + " : " + server_data);
95
  }
96
  // Upload the next file until queue is empty
97
  if ( flag_swf_upload.getStats().files_queued > 0) {
142
  break;
143
  }
144
  jQuery("#progressbar-wrap").append("<div><strong>ERROR " + error_name + " </strong>: " + fileObj.name + " : " + message + "</div>");
145
+ console.log('e: ' + error_name + " : " + fileObj.name + " : " + message);
146
  jQuery("#" + fileObj.id).hide("slow");
147
  jQuery("#" + fileObj.id).remove();
148
  if ( flag_swf_upload.getStats().files_queued > 0) {
149
  flag_swf_upload.startUpload();
150
  } else {
151
+ jQuery("#progressbar-wrap").hide();
152
  jQuery('#uploadimage_form').prepend("<input type=\"hidden\" name=\"swf_callback\" value=\"" + error_name + "\">");
153
  jQuery("#uploadimage_form").submit();
154
  }
admin/manage-galleries.php CHANGED
@@ -13,7 +13,7 @@ function flag_manage_gallery_main() {
13
 
14
  $perpage = 50;
15
  $start = ( $_GET['paged'] - 1 ) * $perpage;
16
- $gallerylist = $flagdb->find_all_galleries('gid', 'asc', TRUE, $perpage, $start, false);
17
 
18
  $page_links = paginate_links( array(
19
  'base' => add_query_arg( 'paged', '%#%' ),
@@ -160,12 +160,12 @@ function flag_manage_gallery_main() {
160
  <?php
161
  if($gallerylist) {
162
  foreach($gallerylist as $gallery) {
163
- $class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
164
  $gid = $gallery->gid;
165
  $name = (empty($gallery->title) ) ? $gallery->name : $gallery->title;
166
  $author_user = get_userdata( (int) $gallery->author );
167
  ?>
168
- <tr id="gallery-<?php echo $gid; ?>" <?php echo $class; ?> >
169
  <th scope="row" class="cb column-cb">
170
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) { ?>
171
  <input name="doaction[]" type="checkbox" value="<?php echo $gid; ?>" />
@@ -179,7 +179,8 @@ if($gallerylist) {
179
  </a>
180
  <?php } else { ?>
181
  <?php echo flagGallery::i18n($gallery->title); ?>
182
- <?php } ?>
 
183
  </td>
184
  <td><?php echo flagGallery::i18n($gallery->galdesc); ?>&nbsp;</td>
185
  <td><?php echo $author_user->display_name; ?></td>
@@ -187,6 +188,11 @@ if($gallerylist) {
187
  <td>
188
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) : ?>
189
  <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=delete&amp;gid=" . $gid, 'flag_editgallery')?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this gallery ?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
 
 
 
 
 
190
  <?php endif; ?>
191
  </td>
192
  </tr>
13
 
14
  $perpage = 50;
15
  $start = ( $_GET['paged'] - 1 ) * $perpage;
16
+ $gallerylist = $flagdb->find_all_galleries('gid', 'asc', $counter = true, $perpage, $start, $exclude = false, $draft = true);
17
 
18
  $page_links = paginate_links( array(
19
  'base' => add_query_arg( 'paged', '%#%' ),
160
  <?php
161
  if($gallerylist) {
162
  foreach($gallerylist as $gallery) {
163
+ $class = ( !isset($class) || $class == 'alt ' ) ? '' : 'alt ';
164
  $gid = $gallery->gid;
165
  $name = (empty($gallery->title) ) ? $gallery->name : $gallery->title;
166
  $author_user = get_userdata( (int) $gallery->author );
167
  ?>
168
+ <tr id="gallery-<?php echo $gid; ?>" class="<?php echo $class; echo ( $gallery->status ) ? 'flag_draft' : 'flag_public'; ?>" >
169
  <th scope="row" class="cb column-cb">
170
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) { ?>
171
  <input name="doaction[]" type="checkbox" value="<?php echo $gid; ?>" />
179
  </a>
180
  <?php } else { ?>
181
  <?php echo flagGallery::i18n($gallery->title); ?>
182
+ <?php }
183
+ if($gallery->status){ echo ' <b>- '.__('Draft', 'flag').'</b>'; }?>
184
  </td>
185
  <td><?php echo flagGallery::i18n($gallery->galdesc); ?>&nbsp;</td>
186
  <td><?php echo $author_user->display_name; ?></td>
188
  <td>
189
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) : ?>
190
  <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=delete&amp;gid=" . $gid, 'flag_editgallery')?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this gallery ?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
191
+ <?php if($gallery->status) { ?>
192
+ | <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=publish&amp;gid=" . $gid, 'flag_editgallery')?>" class="status" onclick="javascript:check=confirm( '<?php _e("Publish this gallery?",'flag')?>');if(check==false) return false;"><?php _e('Publish','flag'); ?></a>
193
+ <?php } else { ?>
194
+ | <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=draft&amp;gid=" . $gid, 'flag_editgallery')?>" class="status" onclick="javascript:check=confirm( '<?php _e("Make this gallery draft?",'flag')?>');if(check==false) return false;"><?php _e('Draft','flag'); ?></a>
195
+ <?php } ?>
196
  <?php endif; ?>
197
  </td>
198
  </tr>
admin/manage-images.php CHANGED
@@ -322,15 +322,9 @@ jQuery(document).ready( function() {
322
  </tfoot>
323
  <tbody>
324
  <?php
 
325
  if($picturelist) {
326
 
327
- $thumbsize = '';
328
- $counter = 0;
329
-
330
- if ($flag->options['thumbFix']) {
331
- $thumbsize = 'width="'.$flag->options['thumbWidth'].'" height="'.$flag->options['thumbHeight'].'"';
332
- }
333
-
334
  $rt=array(24.5, 45.7, 54.8, 59.3, 64.7, 68.9, 71.5, 73.7, 75.9, 77.1);
335
 
336
  foreach($picturelist as $picture) {
@@ -377,7 +371,7 @@ if($picturelist) {
377
  case 'thumbnail' :
378
  ?>
379
  <td <?php echo $attributes; ?>><a href="<?php echo $picture->imageURL; ?>" class="thickbox" title="<?php echo $picture->filename; ?>">
380
- <img class="thumb" src="<?php echo $picture->thumbURL; ?>" <?php echo $thumbsize; ?> id="thumb-<?php echo $pid; ?>" />
381
  </a>
382
  </td>
383
  <?php
@@ -445,7 +439,7 @@ if($picturelist) {
445
  <td <?php echo $attributes; ?>>
446
  <input name="alttext[<?php echo $pid; ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext); ?>" /><br/>
447
  <textarea name="description[<?php echo $pid; ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description); ?></textarea>
448
- <input name="link[<?php echo $pid; ?>]" type="hidden" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->link); ?>" placeholder="(optional for skin) URL for linked button" /><br/>
449
  </td>
450
  <?php
451
  break;
@@ -603,7 +597,7 @@ function flag_manage_gallery_columns() {
603
  $gallery_columns['views_likes'] = __('Views / Likes', 'flag');
604
  $gallery_columns['rating'] = __('Rating', 'flag');
605
  $gallery_columns['alt_title_desc'] = __('Alt &amp; Title Text', 'flag') . ' / ' . __('Description', 'flag');// . ' / ' . __('Link', 'flag');
606
- $gallery_columns['exclude'] = '<img src="'.FLAG_URLPATH.'admin/images/lock.png" alt="member view" title="'.__('Only for logged in users', 'flag').'" />';
607
  $gallery_columns = apply_filters('flag_manage_images_columns', $gallery_columns);
608
 
609
  return $gallery_columns;
322
  </tfoot>
323
  <tbody>
324
  <?php
325
+ $counter = 0;
326
  if($picturelist) {
327
 
 
 
 
 
 
 
 
328
  $rt=array(24.5, 45.7, 54.8, 59.3, 64.7, 68.9, 71.5, 73.7, 75.9, 77.1);
329
 
330
  foreach($picturelist as $picture) {
371
  case 'thumbnail' :
372
  ?>
373
  <td <?php echo $attributes; ?>><a href="<?php echo $picture->imageURL; ?>" class="thickbox" title="<?php echo $picture->filename; ?>">
374
+ <img class="thumb" src="<?php echo $picture->thumbURL; ?>" id="thumb-<?php echo $pid; ?>" />
375
  </a>
376
  </td>
377
  <?php
439
  <td <?php echo $attributes; ?>>
440
  <input name="alttext[<?php echo $pid; ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->alttext); ?>" /><br/>
441
  <textarea name="description[<?php echo $pid; ?>]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo stripslashes($picture->description); ?></textarea>
442
+ <input name="link[<?php echo $pid; ?>]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo stripslashes($picture->link); ?>" placeholder="(optional for skin) URL for linked button" /><br/>
443
  </td>
444
  <?php
445
  break;
597
  $gallery_columns['views_likes'] = __('Views / Likes', 'flag');
598
  $gallery_columns['rating'] = __('Rating', 'flag');
599
  $gallery_columns['alt_title_desc'] = __('Alt &amp; Title Text', 'flag') . ' / ' . __('Description', 'flag');// . ' / ' . __('Link', 'flag');
600
+ $gallery_columns['exclude'] = '<span title="'.__('Only for logged in users', 'flag').'"><img src="'.FLAG_URLPATH.'admin/images/lock.png" alt="member view" /> Private</span>';
601
  $gallery_columns = apply_filters('flag_manage_images_columns', $gallery_columns);
602
 
603
  return $gallery_columns;
admin/manage.php CHANGED
@@ -21,10 +21,10 @@ class flagManageGallery {
21
  if(isset($_GET['mode']))
22
  $this->mode = trim ($_GET['mode']);
23
  // Should be only called via manage galleries overview
24
- if ( $_POST['page'] == 'manage-galleries' )
25
  $this->post_processor_galleries();
26
  // Should be only called via a edit single gallery page
27
- if ( $_POST['page'] == 'manage-images' )
28
  $this->post_processor_images();
29
  //Look for other POST process
30
  if ( !empty($_POST) || !empty($_GET) )
@@ -98,13 +98,29 @@ class flagManageGallery {
98
  }
99
  }
100
 
101
- flagGallery::show_message( __ngettext( 'Gallery', 'Galleries', 1, 'flag' ) . ' \''.$this->gid.'\' '.__('deleted successfully','flag'));
102
 
103
  }
104
 
105
  $this->mode = 'main'; // show mainpage
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  // New Album
109
  if (isset($_POST['album_name'])) {
110
 
@@ -346,10 +362,10 @@ class flagManageGallery {
346
  $description = $_POST['description'];
347
  $alttext = $_POST['alttext'];
348
  $link = $_POST['link'];
349
- $exclude = $_POST['exclude'];
350
  $pictures = $_POST['pid'];
351
- $hitcounter = $_POST['hitcounter'];
352
- $total_votes = $_POST['total_votes'];
353
 
354
  if ( is_array($description) ) {
355
  foreach( $description as $key => $value ) {
@@ -367,6 +383,9 @@ class flagManageGallery {
367
  }
368
  if ( is_array($link) ){
369
  foreach( $link as $key => $value ) {
 
 
 
370
  $link = $wpdb->escape($value);
371
  $key =intval($key);
372
  $wpdb->query( "UPDATE $wpdb->flagpictures SET link = '$link' WHERE pid = $key");
21
  if(isset($_GET['mode']))
22
  $this->mode = trim ($_GET['mode']);
23
  // Should be only called via manage galleries overview
24
+ if (isset($_POST['page']) && $_POST['page'] == 'manage-galleries' )
25
  $this->post_processor_galleries();
26
  // Should be only called via a edit single gallery page
27
+ if (isset($_POST['page']) && $_POST['page'] == 'manage-images' )
28
  $this->post_processor_images();
29
  //Look for other POST process
30
  if ( !empty($_POST) || !empty($_GET) )
98
  }
99
  }
100
 
101
+ flagGallery::show_message( _n( 'Gallery', 'Galleries', 1, 'flag' ) . ' \''.$this->gid.'\' '.__('deleted successfully','flag'));
102
 
103
  }
104
 
105
  $this->mode = 'main'; // show mainpage
106
  }
107
 
108
+ // Draft gallery
109
+ if ($this->mode == 'draft') {
110
+ check_admin_referer('flag_editgallery');
111
+ if($wpdb->query( "UPDATE $wpdb->flaggallery SET status = 1 WHERE gid = '$this->gid'" ))
112
+ flagGallery::show_message( __( 'Gallery', 'flag' ) . ' \''.$this->gid.'\' '.__('now in draft','flag'));
113
+ $this->mode = 'main'; // show mainpage
114
+ }
115
+
116
+ // Publish gallery
117
+ if ($this->mode == 'publish') {
118
+ check_admin_referer('flag_editgallery');
119
+ if($wpdb->query( "UPDATE $wpdb->flaggallery SET status = 0 WHERE gid = '$this->gid'" ))
120
+ flagGallery::show_message( __( 'Gallery', 'flag' ) . ' \''.$this->gid.'\' '.__('now visible','flag'));
121
+ $this->mode = 'main'; // show mainpage
122
+ }
123
+
124
  // New Album
125
  if (isset($_POST['album_name'])) {
126
 
362
  $description = $_POST['description'];
363
  $alttext = $_POST['alttext'];
364
  $link = $_POST['link'];
365
+ $exclude = isset($_POST['exclude'])? $_POST['exclude'] : 0;
366
  $pictures = $_POST['pid'];
367
+ $hitcounter = isset($_POST['hitcounter'])? $_POST['hitcounter'] : 0;
368
+ $total_votes = isset($_POST['total_votes'])? $_POST['total_votes'] : 0;
369
 
370
  if ( is_array($description) ) {
371
  foreach( $description as $key => $value ) {
383
  }
384
  if ( is_array($link) ){
385
  foreach( $link as $key => $value ) {
386
+ if (!empty($value) && parse_url($value, PHP_URL_SCHEME) === null) {
387
+ $value = 'http://'.$value;
388
+ }
389
  $link = $wpdb->escape($value);
390
  $key =intval($key);
391
  $wpdb->query( "UPDATE $wpdb->flagpictures SET link = '$link' WHERE pid = $key");
admin/meta_box.php CHANGED
@@ -9,8 +9,10 @@ $flag_custom = get_post_custom($post->ID);
9
  $items_array = $flag_custom["mb_items_array"][0];
10
  $skinname = $flag_custom["mb_skinname"][0];
11
  $scode = $flag_custom["mb_scode"][0];
 
12
  $button_text = $flag_custom["mb_button"][0];
13
  $button_link = $flag_custom["mb_button_link"][0];
 
14
  if(!$button_text) $button_text = '';
15
  if(!$button_link) $button_link = '';
16
  $bg_link = $flag_custom["mb_bg_link"][0];
@@ -95,7 +97,7 @@ jQuery(document).ready(function() {
95
  });
96
  });
97
  function short_code(galleries,skin,wmode,playlist) {
98
- jQuery('#mb_scode').val('[flagallery '+galleries+' w=100% h=100%'+skin+wmode+playlist+' fullwindow=true name=Gallery]');
99
  }
100
  /*]]>*/</script>
101
  <div class="wrap">
@@ -146,12 +148,12 @@ function short_code(galleries,skin,wmode,playlist) {
146
  <tr>
147
  <td nowrap="nowrap" valign="top"><div style="padding-top: 3px;"><?php _e("Music", 'flag'); ?>: &nbsp; </div></td>
148
  <td valign="top"><select id="mb_playlist" name="mb_playlist">
149
- <option value="" selected="selected"><?php _e("choose playlist", 'flag'); ?></option>
150
  <?php
151
  foreach((array)$all_playlists as $playlist_file => $playlist_data) {
152
  $playlist_name = basename($playlist_file, '.xml');
153
  ?>
154
- <option value="<?php echo $playlist_name; ?>"><?php echo $playlist_data['title']; ?></option>
155
  <?php
156
  }
157
  ?>
9
  $items_array = $flag_custom["mb_items_array"][0];
10
  $skinname = $flag_custom["mb_skinname"][0];
11
  $scode = $flag_custom["mb_scode"][0];
12
+ $music = $flag_custom["mb_playlist"][0];
13
  $button_text = $flag_custom["mb_button"][0];
14
  $button_link = $flag_custom["mb_button_link"][0];
15
+ if(!$music) $music = '';
16
  if(!$button_text) $button_text = '';
17
  if(!$button_link) $button_link = '';
18
  $bg_link = $flag_custom["mb_bg_link"][0];
97
  });
98
  });
99
  function short_code(galleries,skin,wmode,playlist) {
100
+ jQuery('#mb_scode').val('[flagallery '+galleries+' w=100% h=100%'+skin+wmode+playlist+' fullwindow=true]');
101
  }
102
  /*]]>*/</script>
103
  <div class="wrap">
148
  <tr>
149
  <td nowrap="nowrap" valign="top"><div style="padding-top: 3px;"><?php _e("Music", 'flag'); ?>: &nbsp; </div></td>
150
  <td valign="top"><select id="mb_playlist" name="mb_playlist">
151
+ <option value="" selected="selected" <?php selected($music,''); ?>><?php _e("choose playlist", 'flag'); ?></option>
152
  <?php
153
  foreach((array)$all_playlists as $playlist_file => $playlist_data) {
154
  $playlist_name = basename($playlist_file, '.xml');
155
  ?>
156
+ <option value="<?php echo $playlist_name; ?>" <?php selected($music,$playlist_name); ?>><?php echo $playlist_data['title']; ?></option>
157
  <?php
158
  }
159
  ?>
admin/music-box.php CHANGED
@@ -15,7 +15,7 @@ require_once (dirname (__FILE__) . '/functions.php');
15
  require_once (dirname (__FILE__) . '/playlist.functions.php');
16
 
17
  function flag_music_controler() {
18
- if ($_POST['importfolder']){
19
  check_admin_referer('flag_addmp3');
20
  $mp3folder = $_POST['mp3folder'];
21
  if ( !empty($mp3folder) )
15
  require_once (dirname (__FILE__) . '/playlist.functions.php');
16
 
17
  function flag_music_controler() {
18
+ if (isset($_POST['importfolder']) && $_POST['importfolder']){
19
  check_admin_referer('flag_addmp3');
20
  $mp3folder = $_POST['mp3folder'];
21
  if ( !empty($mp3folder) )
admin/settings.php CHANGED
@@ -131,7 +131,7 @@ jQuery(document).ready(function() {
131
  <div id="imageoptions" class="cptab">
132
  <form name="generaloptions" method="post">
133
  <?php wp_nonce_field('flag_settings'); ?>
134
- <input type="hidden" name="page_options" value="galleryPath,flashWidth,flashHeight,deleteImg,deepLinks,useMediaRSS,jAlterGal,jAlterGalScript,BarsBG,CatBGColor,CatBGColorOver,CatColor,CatColorOver,ThumbBG,ThumbLoaderColor,TitleColor,DescrColor,imgResize,imgWidth,imgHeight,imgQuality,galSort,galSortDir,disableViews" />
135
  <h2><?php _e('Image Gallery Options','flag'); ?></h2>
136
  <h3><?php _e('General Options','flag'); ?></h3>
137
  <table class="form-table flag-options">
@@ -166,8 +166,7 @@ jQuery(document).ready(function() {
166
  <table class="form-table flag-options">
167
  <tr valign="top">
168
  <th scope="row" width="200"><label><?php _e('Resize Images','flag'); ?></label><br /><small>(Manage Gallery -> 'Resize Images' action)</small></th>
169
- <td><input type="hidden" name="imgResize" value="1" <?php checked('1', $flag_options['imgResize']); ?> />
170
- <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']; ?>" />
171
  <span class="setting-description"><?php _e('Width x Height (in pixel). Flash Album Gallery will keep ratio size','flag'); ?></span></td>
172
  </tr>
173
  <tr valign="top">
131
  <div id="imageoptions" class="cptab">
132
  <form name="generaloptions" method="post">
133
  <?php wp_nonce_field('flag_settings'); ?>
134
+ <input type="hidden" name="page_options" value="galleryPath,flashWidth,flashHeight,deleteImg,deepLinks,useMediaRSS,jAlterGal,jAlterGalScript,BarsBG,CatBGColor,CatBGColorOver,CatColor,CatColorOver,ThumbBG,ThumbLoaderColor,TitleColor,DescrColor,imgWidth,imgHeight,imgQuality,galSort,galSortDir,disableViews" />
135
  <h2><?php _e('Image Gallery Options','flag'); ?></h2>
136
  <h3><?php _e('General Options','flag'); ?></h3>
137
  <table class="form-table flag-options">
166
  <table class="form-table flag-options">
167
  <tr valign="top">
168
  <th scope="row" width="200"><label><?php _e('Resize Images','flag'); ?></label><br /><small>(Manage Gallery -> 'Resize Images' action)</small></th>
169
+ <td><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']; ?>" />
 
170
  <span class="setting-description"><?php _e('Width x Height (in pixel). Flash Album Gallery will keep ratio size','flag'); ?></span></td>
171
  </tr>
172
  <tr valign="top">
admin/skins.php CHANGED
@@ -371,7 +371,7 @@ $total_all_skins = count($all_skins);
371
  }
372
  } else {
373
  //$skins_xml_error = __('URL file-access is disabled in the server configuration.', 'flag');
374
- $skins_xml_error = __('cURL library is not installed on your server.','flag');
375
  }
376
 
377
 
371
  }
372
  } else {
373
  //$skins_xml_error = __('URL file-access is disabled in the server configuration.', 'flag');
374
+ $skins_xml_error = __('cURL library is not installed on your server.','flag').'<br>'.__('Download skins from http://photogallerycreator.com', 'flag');
375
  }
376
 
377
 
admin/tinymce/window.php CHANGED
@@ -238,6 +238,9 @@ if($_REQUEST['riched'] == "false") {
238
  galleryname = jQuery('#album option:selected').text();
239
  album = ' album='+album;
240
  }
 
 
 
241
  if (gallerywidth && galleryheight)
242
  gallerysize = " w=" + gallerywidth + " h=" + galleryheight;
243
  else
@@ -269,7 +272,7 @@ if($_REQUEST['riched'] == "false") {
269
  } else playlist = '';
270
 
271
  if (galleryid || album ) {
272
- tagtext = '[flagallery' + galleryid + album + gallerysize + galorderby + galorder + galexclude + skinname + skinalign + playlist + ' name=' + galleryname + ']';
273
  win.send_to_editor(tagtext);
274
  win.bind_resize();
275
  <?php if($_REQUEST['riched'] != "false") { ?>
238
  galleryname = jQuery('#album option:selected').text();
239
  album = ' album='+album;
240
  }
241
+ if (galleryname.indexOf(' ') >= 0) {
242
+ galleryname = "'"+galleryname+"'";
243
+ }
244
  if (gallerywidth && galleryheight)
245
  gallerysize = " w=" + gallerywidth + " h=" + galleryheight;
246
  else
272
  } else playlist = '';
273
 
274
  if (galleryid || album ) {
275
+ tagtext = '[flagallery' + galleryid + album + gallerysize + galorderby + galorder + galexclude + skinname + skinalign + playlist + ']';
276
  win.send_to_editor(tagtext);
277
  win.bind_resize();
278
  <?php if($_REQUEST['riched'] != "false") { ?>
admin/tuning.php CHANGED
@@ -35,7 +35,7 @@ function flag_tune($show_error=true) {
35
  flagGallery::flagFolderDelete( $skins_dir.$file );
36
  }
37
  if ( !@rename($old_skins_dir.$file, $skins_dir.$file) ) {
38
- $errors .= sprintf(__('Failed to move file %1$s to %2$s','flag'),
39
  '<strong>'.$old_skins_dir.$file.'</strong>', $skins_dir.$file).'<br />';
40
  }
41
  }
35
  flagGallery::flagFolderDelete( $skins_dir.$file );
36
  }
37
  if ( !@rename($old_skins_dir.$file, $skins_dir.$file) ) {
38
+ $errors .= sprintf(__('Failed to move files from %1$s to %2$s','flag'),
39
  '<strong>'.$old_skins_dir.$file.'</strong>', $skins_dir.$file).'<br />';
40
  }
41
  }
admin/upgrade.php CHANGED
@@ -98,6 +98,12 @@ function flag_upgrade() {
98
  flag_add_sql_column( $wpdb->flagpictures, 'link', "TEXT NULL AFTER alttext;");
99
  }
100
 
 
 
 
 
 
 
101
  // update now the database
102
  update_option( "flag_db_version", FLAG_DBVERSION );
103
  $wpdb->hide_errors();
98
  flag_add_sql_column( $wpdb->flagpictures, 'link', "TEXT NULL AFTER alttext;");
99
  }
100
 
101
+ // v2.72 -> v2.75
102
+ if (version_compare($installed_ver, '2.75 ', '<')) {
103
+ flag_add_sql_column( $wpdb->flagpictures, 'modified', "TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP AFTER imagedate;");
104
+ flag_add_sql_column( $wpdb->flaggallery, 'status', "TINYINT NULL DEFAULT '0' AFTER author;");
105
+ }
106
+
107
  // update now the database
108
  update_option( "flag_db_version", FLAG_DBVERSION );
109
  $wpdb->hide_errors();
admin/upload.php CHANGED
@@ -21,14 +21,14 @@ unset($current_user);
21
  // admin.php require a proper login cookie
22
  require_once(ABSPATH . '/wp-admin/admin.php');
23
 
24
- header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
25
 
26
  //check for correct capability
27
  if ( !is_user_logged_in() )
28
  die('Login failure. -1');
29
 
30
  //check for correct capability
31
- if ( !current_user_can('FlAG Upload images') )
32
  die('You do not have permission to upload files. -2');
33
 
34
  //check for correct nonce
@@ -37,7 +37,7 @@ check_admin_referer('flag_swfupload');
37
  //check for flag
38
  if ( !defined('FLAG_ABSPATH') )
39
  die('FlAGallery not available. -3');
40
-
41
  include_once (FLAG_ABSPATH. 'admin/functions.php');
42
 
43
  // get the gallery
21
  // admin.php require a proper login cookie
22
  require_once(ABSPATH . '/wp-admin/admin.php');
23
 
24
+ //header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
25
 
26
  //check for correct capability
27
  if ( !is_user_logged_in() )
28
  die('Login failure. -1');
29
 
30
  //check for correct capability
31
+ if ( !current_user_can('FlAG Upload images') )
32
  die('You do not have permission to upload files. -2');
33
 
34
  //check for correct nonce
37
  //check for flag
38
  if ( !defined('FLAG_ABSPATH') )
39
  die('FlAGallery not available. -3');
40
+
41
  include_once (FLAG_ABSPATH. 'admin/functions.php');
42
 
43
  // get the gallery
admin/video-box.php CHANGED
@@ -15,7 +15,7 @@ require_once (dirname (__FILE__) . '/functions.php');
15
  require_once (dirname (__FILE__) . '/video.functions.php');
16
 
17
  function flag_video_controler() {
18
- if ($_POST['importfolder']){
19
  check_admin_referer('flag_addvideo');
20
  $videofolder = $_POST['videofolder'];
21
  if ( !empty($videofolder) )
@@ -264,7 +264,7 @@ function send_to_editor(html) {
264
  <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
265
  <td><input type="text" size="35" id="videofolder" name="videofolder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...',"flag"); ?></span>
266
  <div id="file_browser"></div><br />
267
- <p><label><input type="checkbox" name="delete_files" value="delete" checked="checked" /> &nbsp;
268
  <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
269
  </td>
270
  </tr>
15
  require_once (dirname (__FILE__) . '/video.functions.php');
16
 
17
  function flag_video_controler() {
18
+ if (isset($_POST['importfolder']) && $_POST['importfolder']){
19
  check_admin_referer('flag_addvideo');
20
  $videofolder = $_POST['videofolder'];
21
  if ( !empty($videofolder) )
264
  <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
265
  <td><input type="text" size="35" id="videofolder" name="videofolder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...',"flag"); ?></span>
266
  <div id="file_browser"></div><br />
267
+ <p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
268
  <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
269
  </td>
270
  </tr>
changelog.txt CHANGED
@@ -1,6 +1,17 @@
1
  GRAND FlAGallery
2
  by CodEasily.com
3
 
 
 
 
 
 
 
 
 
 
 
 
4
  = v2.72 - 20.05.2013 =
5
  * Added: pagination on Music Box page
6
  * Fixed: small fixes for Banner Box page
1
  GRAND FlAGallery
2
  by CodEasily.com
3
 
4
+ = v2.76 - 13.06.2013 =
5
+ * Fixed: Size for thumbs on Manage Images page
6
+ * Fixed: Create New Thumbnails not working properly with fix dimensions
7
+ * Fixed: First activation of plugin do not move free skins to 'flagallery-skins' folder
8
+ * Fixed: GRAND Page do not remembers playlist option
9
+
10
+ = v2.75 - 10.06.2013 =
11
+ * Added: Link feald for image (optional for skin)
12
+ * Added: Draft for galleries
13
+ * Fixed: PHP and CSS improvements
14
+
15
  = v2.72 - 20.05.2013 =
16
  * Added: pagination on Music Box page
17
  * Fixed: small fixes for Banner Box page
flag-config.php CHANGED
@@ -28,5 +28,4 @@ if ( !defined('WP_LOAD_PATH') ) {
28
 
29
  // let's load WordPress
30
  require_once( WP_LOAD_PATH . 'wp-load.php');
31
-
32
  ?>
28
 
29
  // let's load WordPress
30
  require_once( WP_LOAD_PATH . 'wp-load.php');
 
31
  ?>
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.72
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
@@ -23,8 +23,8 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
- var $version = '2.72';
27
- var $dbversion = '2.70';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '3.0';
30
  var $flagAdminPanel;
@@ -65,7 +65,7 @@ class flagLoad {
65
  add_filter('transient_update_plugins', array(&$this, 'disable_upgrade'));
66
 
67
  //Add some message on the plugin page
68
- add_action( 'after_plugin_row', array(&$this, 'flag_check_message_version') );
69
 
70
  add_action( 'init', array(&$this, 'flag_fullwindow_page_init') );
71
  add_action( 'add_meta_boxes', array(&$this, 'flag_fullwindow_page_add_meta_box') );
@@ -105,7 +105,7 @@ class flagLoad {
105
  }
106
 
107
  function wp_flag_tune_messages() {
108
- if($this->options['flagVersion'] != $this->version) {
109
  // upgrade plugin
110
  require_once(FLAG_ABSPATH . 'admin/tuning.php');
111
  $ok = flag_tune($show_error=false);
@@ -173,7 +173,9 @@ class flagLoad {
173
  define('FLAG_DBVERSION', $this->dbversion);
174
 
175
  // required for Windows & XAMPP
176
- define('WINABSPATH', str_replace("\\", "/", ABSPATH) );
 
 
177
 
178
  // define URL
179
  define('FLAGFOLDER', plugin_basename( dirname(__FILE__)) );
@@ -182,12 +184,14 @@ class flagLoad {
182
  define('FLAG_URLPATH', WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/' );
183
 
184
  // get value for safe mode
185
- if ( (gettype( ini_get('safe_mode') ) == 'string') ) {
186
- // if sever did in in a other way
187
- if ( ini_get('safe_mode') == 'off' ) define('SAFE_MODE', FALSE);
188
- else define( 'SAFE_MODE', ini_get('safe_mode') );
189
- } else
190
- define( 'SAFE_MODE', ini_get('safe_mode') );
 
 
191
 
192
  }
193
 
@@ -395,7 +399,7 @@ class flagLoad {
395
  // verify this came from the our screen and with proper authorization,
396
  // because save_post can be triggered at other times
397
 
398
- if ( !wp_verify_nonce( $_POST['flag_meta_box'], plugin_basename( __FILE__ ) ) )
399
  return;
400
 
401
  // Check permissions
@@ -435,7 +439,7 @@ class flagLoad {
435
  function flag_fullwindow_page_template_redirect() {
436
  global $wp;
437
  global $wp_query;
438
- if ($wp->query_vars["post_type"] == "flagallery")
439
  {
440
  // Let's look for the full_window_template.php template file
441
  if (have_posts())
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.76
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
+ var $version = '2.76';
27
+ var $dbversion = '2.75';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '3.0';
30
  var $flagAdminPanel;
65
  add_filter('transient_update_plugins', array(&$this, 'disable_upgrade'));
66
 
67
  //Add some message on the plugin page
68
+ //add_action( 'after_plugin_row', array(&$this, 'flag_check_message_version') );
69
 
70
  add_action( 'init', array(&$this, 'flag_fullwindow_page_init') );
71
  add_action( 'add_meta_boxes', array(&$this, 'flag_fullwindow_page_add_meta_box') );
105
  }
106
 
107
  function wp_flag_tune_messages() {
108
+ if(get_option('flagVersion') != $this->version) {
109
  // upgrade plugin
110
  require_once(FLAG_ABSPATH . 'admin/tuning.php');
111
  $ok = flag_tune($show_error=false);
173
  define('FLAG_DBVERSION', $this->dbversion);
174
 
175
  // required for Windows & XAMPP
176
+ if ( !defined('WINABSPATH') ) {
177
+ define('WINABSPATH', str_replace("\\", "/", ABSPATH) );
178
+ }
179
 
180
  // define URL
181
  define('FLAGFOLDER', plugin_basename( dirname(__FILE__)) );
184
  define('FLAG_URLPATH', WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/' );
185
 
186
  // get value for safe mode
187
+ if ( !defined('SAFE_MODE') ) {
188
+ if ( (gettype( ini_get('safe_mode') ) == 'string') ) {
189
+ // if sever did in in a other way
190
+ if ( ini_get('safe_mode') == 'off' ) define('SAFE_MODE', FALSE);
191
+ else define( 'SAFE_MODE', ini_get('safe_mode') );
192
+ } else
193
+ define( 'SAFE_MODE', ini_get('safe_mode') );
194
+ }
195
 
196
  }
197
 
399
  // verify this came from the our screen and with proper authorization,
400
  // because save_post can be triggered at other times
401
 
402
+ if ( !isset($_POST['flag_meta_box']) || !wp_verify_nonce( $_POST['flag_meta_box'], plugin_basename( __FILE__ ) ) )
403
  return;
404
 
405
  // Check permissions
439
  function flag_fullwindow_page_template_redirect() {
440
  global $wp;
441
  global $wp_query;
442
+ if (isset($wp->query_vars["post_type"]) && $wp->query_vars["post_type"] == "flagallery")
443
  {
444
  // Let's look for the full_window_template.php template file
445
  if (have_posts())
flagshow.php CHANGED
@@ -6,7 +6,6 @@ if ( !defined('ABSPATH') )
6
  // reference thumbnail class
7
  include_once( flagGallery::graphic_library() );
8
  include_once('lib/core.php');
9
-
10
  // get the plugin options
11
  $flag_options = get_option('flag_options');
12
 
6
  // reference thumbnail class
7
  include_once( flagGallery::graphic_library() );
8
  include_once('lib/core.php');
 
9
  // get the plugin options
10
  $flag_options = get_option('flag_options');
11
 
full_window_template.php CHANGED
@@ -3,6 +3,7 @@ preg_match('|^(.*?/)(wp-content)/|i', str_replace('\\', '/', __FILE__), $_m);
3
  require_once( $_m[1] . 'wp-load.php');
4
  global $post;
5
  $flag_custom = get_post_custom($post->ID);
 
6
  ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7
  <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
8
  <head profile="http://gmpg.org/xfn/11">
@@ -16,9 +17,14 @@ div#page, .flashalbum { width: 100%; height: 100%; position: relative; z-index:
16
  div.flashalbum { background-image: url(<?php echo $flag_custom['mb_bg_link'][0]; ?>); background-position: <?php echo $flag_custom['mb_bg_pos'][0]; ?>; background-repeat: <?php echo $flag_custom['mb_bg_repeat'][0]; ?>; }
17
  <?php } ?>
18
  </style>
19
- <script language="JavaScript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/jquery.js'); ?>" type="text/javascript"></script>
20
- <script language="JavaScript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/swfobject.js'); ?>" type="text/javascript"></script>
21
- <script language="JavaScript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/swfaddress.js'); ?>" type="text/javascript"></script>
 
 
 
 
 
22
  </head>
23
  <body id="fullwindow">
24
  <div id="page">
@@ -26,11 +32,10 @@ div.flashalbum { background-image: url(<?php echo $flag_custom['mb_bg_link'][0];
26
  if ( post_password_required( $post ) ) {
27
  the_content();
28
  } else {
29
- $scode = $flag_custom["mb_scode"][0];
30
  echo do_shortcode($scode);
31
  } ?>
32
  </div>
33
- <script language="JavaScript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/flagscroll.js'); ?>" type="text/javascript"></script>
34
- <script language="JavaScript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/script.js'); ?>" type="text/javascript"></script>
35
  </body>
36
  </html>
3
  require_once( $_m[1] . 'wp-load.php');
4
  global $post;
5
  $flag_custom = get_post_custom($post->ID);
6
+ $scode = $flag_custom["mb_scode"][0];
7
  ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
8
  <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
9
  <head profile="http://gmpg.org/xfn/11">
17
  div.flashalbum { background-image: url(<?php echo $flag_custom['mb_bg_link'][0]; ?>); background-position: <?php echo $flag_custom['mb_bg_pos'][0]; ?>; background-repeat: <?php echo $flag_custom['mb_bg_repeat'][0]; ?>; }
18
  <?php } ?>
19
  </style>
20
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/jquery.js'); ?>"></script>
21
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/swfobject.js'); ?>"></script>
22
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/swfaddress.js'); ?>"></script>
23
+ <?php $atts = shortcode_parse_atts($scode);
24
+ if( isset($atts['skin']) && in_array($atts['skin'], array('slider_gallery', 'slider_gallery_demo', 'slider', 'slider_demo')) ) { ?>
25
+ <style type="text/css">@import url("<?php echo plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.css'); ?>");</style>
26
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.pack.js'); ?>"></script>
27
+ <?php } ?>
28
  </head>
29
  <body id="fullwindow">
30
  <div id="page">
32
  if ( post_password_required( $post ) ) {
33
  the_content();
34
  } else {
 
35
  echo do_shortcode($scode);
36
  } ?>
37
  </div>
38
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/flagscroll.js'); ?>"></script>
39
+ <script language="JavaScript" type="text/javascript" src="<?php echo plugins_url('/flash-album-gallery/admin/js/script.js'); ?>"></script>
40
  </body>
41
  </html>
lib/app.php CHANGED
@@ -2,4 +2,113 @@
2
  // include the flag function
3
  @ require_once (dirname(dirname(__FILE__)). '/flag-config.php');
4
 
5
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  // include the flag function
3
  @ require_once (dirname(dirname(__FILE__)). '/flag-config.php');
4
 
5
+ //$account_data='{"status":"KO"}';
6
+
7
+ if(isset($_REQUEST['account'])){
8
+ global $wpdb, $flagdb;
9
+ $account = json_decode(stripslashes($_REQUEST['account']));
10
+ $flag_options = get_option ('flag_options');
11
+ if($account->access_key != $flag_options['access_key']){ die('{"status":"key_error"}'); }
12
+ if(isset($account->gid)){
13
+ $gid = $wpdb->get_var($wpdb->prepare("SELECT gid FROM $wpdb->flaggallery WHERE gid = %d", $account->gid));
14
+ if(!$gid){ die('{"status":"gallery_error"}'); }
15
+ if(isset($account->delete_item_id)){
16
+ $pid = intval($account->delete_item_id);
17
+ $image = $flagdb->find_image( $pid );
18
+ if ($image) {
19
+ @unlink($image->imagePath);
20
+ @unlink($image->thumbPath);
21
+ $wpdb->query("DELETE FROM $wpdb->flagpictures WHERE pid = '{$image->pid}'");
22
+ }
23
+ }
24
+ if(isset($_GET['account']) && isset($GLOBALS[ 'HTTP_RAW_POST_DATA' ])){
25
+ $path = $wpdb->get_var("SELECT path FROM $wpdb->flaggallery WHERE gid = $gid");
26
+ $file = ABSPATH . trailingslashit($path) . str_replace(' ', '_', current_time('mysql')) . '.jpg';
27
+ $filename = basename($file);
28
+ // Open temp file
29
+ $out = fopen( $file, "wb" );
30
+ if ( $out ) {
31
+ if(fwrite( $out, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] )){
32
+
33
+ $alttext = isset($_GET['alttext'])? $wpdb->escape(flagallery_utf8_urldecode($_GET['alttext'])) : '';
34
+ $description = isset($_GET['description'])? $wpdb->escape(flagallery_utf8_urldecode($_GET['description'])) : '';
35
+ $exclude = intval($account->exclude);
36
+ $location = $wpdb->escape($account->location);
37
+
38
+ $wpdb->query( "INSERT INTO `{$wpdb->flagpictures}` (`galleryid`, `filename`, `alttext`, `description`, `exclude`, `location`) VALUES ('$gid', '$filename', '$alttext', '$description', '$exclude', '$location')" );
39
+
40
+ // and give me the new id
41
+ $pic_id = (int) $wpdb->insert_id;
42
+
43
+ @ require_once (dirname(dirname(__FILE__)). '/admin/functions.php');
44
+ // add the metadata
45
+ flagAdmin::import_MetaData($pic_id);
46
+
47
+ // action hook for post process after the image is added to the database
48
+ $image = array( 'id' => $pic_id, 'filename' => $filename, 'galleryID' => $gid);
49
+ do_action('flag_added_new_image', $image);
50
+
51
+ $thumb = flagAdmin::create_thumbnail($pic_id);
52
+ if($thumb == '1') {
53
+ do_action('flag_thumbnail_created', $picture);
54
+ } else {
55
+ fclose( $out );
56
+ die('{"status":"thumb_error: '.$thumb.'"}');
57
+ }
58
+
59
+ } else {
60
+ @unlink($file);
61
+ fclose( $out );
62
+ die('{"status":"fwrite_error"}');
63
+ }
64
+ fclose( $out );
65
+ } else {
66
+ die('{"status":"fopen_error"}');
67
+ }
68
+ }
69
+ $r['data'] = $wpdb->get_results("SELECT pid, galleryid, filename, description, alttext, link, UNIX_TIMESTAMP(imagedate) AS imagedate, UNIX_TIMESTAMP(modified) AS modified, sortorder, exclude, location, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE galleryid = '{$gid}' ORDER BY pid DESC");
70
+ echo json_encode($r);
71
+ die();
72
+ } elseif(isset($account->updated_item)){
73
+ $args = get_object_vars($account->updated_item);
74
+ $pid = intval($args['pid']);
75
+ $image = $flagdb->find_image( $pid );
76
+ if ($image) {
77
+ $flagdb->update_picture($args);
78
+ $gid = intval($args['galleryid']);
79
+ $r['data'] = $wpdb->get_results("SELECT pid, galleryid, filename, description, alttext, link, UNIX_TIMESTAMP(imagedate) AS imagedate, UNIX_TIMESTAMP(modified) AS modified, sortorder, exclude, location, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE galleryid = '{$gid}' ORDER BY pid DESC");
80
+ echo json_encode($r);
81
+ die();
82
+ }
83
+ die('{"status":"item_error"}');
84
+ } elseif(isset($account->add_category)){
85
+ $args = get_object_vars($account->add_category);
86
+ $args['title'] = esc_attr( trim($args['title']) );
87
+ if ( empty($args['title']) ) {
88
+ $args['title'] = str_replace(' ', '_', current_time('mysql'));
89
+ }
90
+ @ require_once (dirname(dirname(__FILE__)). '/admin/functions.php');
91
+ $defaultpath = $flag->options['galleryPath'];
92
+ if(!flagAdmin::create_gallery($args, $defaultpath, $output = false)) {
93
+ die('{"status":"gallery_error"}');
94
+ }
95
+ }
96
+
97
+ //$account_data='{"status":"OK"}';
98
+ $gallerylist = $wpdb->get_results( "SELECT * FROM $wpdb->flaggallery ORDER BY gid DESC", ARRAY_A );
99
+ $r['data'] = array();
100
+ if(count($gallerylist)){
101
+ foreach($gallerylist as $gallery){
102
+ $gid = (int) $gallery['gid'];
103
+ $thepictures = $wpdb->get_var("SELECT filename FROM $wpdb->flagpictures WHERE galleryid = '{$gid}' ORDER BY pid DESC");
104
+ $r['data'][] = $gallery + array( 'thumbnail' => $thepictures );
105
+ }
106
+ }
107
+ echo json_encode($r);
108
+ die();
109
+ }
110
+
111
+ function flagallery_utf8_urldecode($str) {
112
+ $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
113
+ return html_entity_decode($str,null,'UTF-8');
114
+ }
lib/flag-db.php CHANGED
@@ -73,20 +73,22 @@ class flagdb {
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 ' : '';
 
83
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
84
  if( !in_array($order_by, array('title','rand')) ) {
85
  $order_by = 'gid';
86
  }
87
  if( $order_by == 'rand') $order_by = 'RAND()';
88
  $limit_by = ( $limit > 0 ) ? 'LIMIT ' . intval($start) . ',' . intval($limit) : '';
89
- $this->galleries = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->flaggallery ORDER BY {$order_by} {$order_dir} {$limit_by}", OBJECT_K );
90
 
91
  // Count the number of galleries and calculate the pagination
92
  if ($limit > 0) {
@@ -545,16 +547,17 @@ class flagdb {
545
 
546
  // Check for the exclude setting
547
  $exclude_clause = ($exclude) ? ' AND tt.exclude != 1 ' : '';
548
-
 
549
  $number = (int) $number;
550
  $galleryID = (int) $galleryID;
551
  $images = array();
552
 
553
  // Query database
554
  if ($galleryID == 0)
555
- $result = $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 rand() limit $number");
556
  else
557
- $result = $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 rand() limit {$number}");
558
 
559
  // Return the object from the query result
560
  if ($result) {
@@ -684,6 +687,21 @@ class flagdb {
684
  return $result;
685
  }
686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  }
688
  endif;
689
 
@@ -693,6 +711,6 @@ if ( ! isset($GLOBALS['flagdb']) ) {
693
  * @global object $flagdb Creates a new flagdb object
694
  */
695
  unset($GLOBALS['flagdb']);
696
- $GLOBALS['flagdb'] =& new flagdb();
697
  }
698
  ?>
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
+ * @param bool|int $draft
77
  * @return array $galleries
78
  */
79
+ function find_all_galleries($order_by = 'gid', $order_dir = 'ASC', $counter = false, $limit = 0, $start = 0, $exclude = 0, $draft = false) {
80
  /** @var $wpdb wpdb */
81
+ global $wpdb;
82
 
83
+ $exclude_clause = ($exclude) ? ' AND exclude<>1 ' : '';
84
+ $draft_clause = ($draft) ? '' : 'WHERE status=0';
85
  $order_dir = ( $order_dir == 'DESC') ? 'DESC' : 'ASC';
86
  if( !in_array($order_by, array('title','rand')) ) {
87
  $order_by = 'gid';
88
  }
89
  if( $order_by == 'rand') $order_by = 'RAND()';
90
  $limit_by = ( $limit > 0 ) ? 'LIMIT ' . intval($start) . ',' . intval($limit) : '';
91
+ $this->galleries = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->flaggallery {$draft_clause} ORDER BY {$order_by} {$order_dir} {$limit_by}", OBJECT_K );
92
 
93
  // Count the number of galleries and calculate the pagination
94
  if ($limit > 0) {
547
 
548
  // Check for the exclude setting
549
  $exclude_clause = ($exclude) ? ' AND tt.exclude != 1 ' : '';
550
+ $draft_clause = ' AND t.status == 0 ';
551
+
552
  $number = (int) $number;
553
  $galleryID = (int) $galleryID;
554
  $images = array();
555
 
556
  // Query database
557
  if ($galleryID == 0)
558
+ $result = $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 {$draft_clause} {$exclude_clause} ORDER by rand() limit {$number}");
559
  else
560
+ $result = $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 rand() limit {$number}");
561
 
562
  // Return the object from the query result
563
  if ($result) {
687
  return $result;
688
  }
689
 
690
+ function update_picture($args) {
691
+ global $wpdb;
692
+
693
+ $pid =intval($args['pid']);
694
+ $alttext = $wpdb->escape($args['alttext']);
695
+ $desc = $wpdb->escape($args['description']);
696
+ $link = $wpdb->escape($args['link']);
697
+ $sortorder = intval($args['sortorder']);
698
+ $exclude = intval($args['exclude']);
699
+
700
+ $result = $wpdb->query( "UPDATE $wpdb->flagpictures SET alttext = '$alttext', description = '$desc', link = '$link', sortorder = $sortorder, exclude = $exclude WHERE pid = $pid");
701
+
702
+ return $result;
703
+ }
704
+
705
  }
706
  endif;
707
 
711
  * @global object $flagdb Creates a new flagdb object
712
  */
713
  unset($GLOBALS['flagdb']);
714
+ $GLOBALS['flagdb'] = new flagdb();
715
  }
716
  ?>
lib/gallery.php CHANGED
@@ -49,6 +49,10 @@ else
49
  // get the pictures
50
  foreach ( $gID as $galleryID ) {
51
  $galleryID = (int) $galleryID;
 
 
 
 
52
  if ( $galleryID == 0) {
53
  $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']} ");
54
  } else {
49
  // get the pictures
50
  foreach ( $gID as $galleryID ) {
51
  $galleryID = (int) $galleryID;
52
+ $status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galleryID}");
53
+ if(intval($status)){
54
+ continue;
55
+ }
56
  if ( $galleryID == 0) {
57
  $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']} ");
58
  } else {
lib/shortcodes.php CHANGED
@@ -50,50 +50,52 @@ class FlAG_shortcodes {
50
 
51
  $out = '';
52
  // make an array out of the ids
53
- if($album) {
54
- $gallerylist = $flagdb->get_album($album);
55
- $ids = explode( ',', $gallerylist );
56
- $gids = str_replace(',','_',$gallerylist);
57
- $galleryID = false;
58
- foreach ($ids as $id) {
59
- $galleryID = $wpdb->get_var($wpdb->prepare("SELECT gid FROM $wpdb->flaggallery WHERE gid = %d", $id));
60
- if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
61
- }
 
62
 
63
- if( $galleryID )
64
- $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
65
 
66
- } elseif($gid == "all") {
67
  if(!in_array($orderby, array('title','rand'))) $orderby='gid';
68
  if(!$order) $order='DESC';
69
- $gallerylist = $flagdb->find_all_galleries($orderby, $order);
70
- if(is_array($gallerylist)) {
71
  $excludelist = explode(',',$exclude);
72
  foreach($gallerylist as $gallery) {
73
  if (in_array($gallery->gid, $excludelist))
74
  continue;
75
  $gids.='_'.$gallery->gid;
76
  }
77
- $gids = ltrim($gids,'_');
78
- $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
79
  } else {
80
- $out = __('[Gallery not found]','flag');
81
  }
82
- } else {
83
- $ids = explode( ',', $gid );
84
- $gids = str_replace(',','_',$gid);
85
 
86
- $galleryID = false;
87
  foreach ($ids as $id) {
88
- $galleryID = $wpdb->get_var($wpdb->prepare("SELECT gid FROM $wpdb->flaggallery WHERE gid = %d", $id));
89
- if(!$galleryID) $galleryID = $wpdb->get_var($wpdb->prepare("SELECT gid FROM $wpdb->flaggallery WHERE name = %s", $id));
90
- if(!$galleryID) return $out = sprintf(__('[Gallery %s not found]','flag'),$id);
91
- }
 
 
 
 
92
 
93
- if( $galleryID )
94
- $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
95
- else
96
- $out = __('[Gallery not found]','flag');
97
  }
98
 
99
  $flag_options = get_option('flag_options');
@@ -117,7 +119,7 @@ class FlAG_shortcodes {
117
  }
118
  if($swfmousewheel == 'true') $this->flag_add_mousewheel = true;
119
 
120
- return $out;
121
  }
122
 
123
  function add_script() {
50
 
51
  $out = '';
52
  // make an array out of the ids
53
+ if($album) {
54
+ $gallerylist = $flagdb->get_album($album);
55
+ $ids = explode( ',', $gallerylist );
56
+ $galleryIDs = array();
57
+ foreach ($ids as $id) {
58
+ $galleryIDs[] = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->flaggallery} WHERE status = 0 AND gid = %d", $id));
59
+ }
60
+ $galleryIDs = array_filter($galleryIDs);
61
+ if(empty($galleryIDs))
62
+ return $out = sprintf(__('[Gallery %s not found]','flag'),$gallerylist);
63
 
64
+ $gids = implode('_',$galleryIDs);
65
+ $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
66
 
67
+ } elseif($gid == "all") {
68
  if(!in_array($orderby, array('title','rand'))) $orderby='gid';
69
  if(!$order) $order='DESC';
70
+ $gallerylist = $flagdb->find_all_galleries($orderby, $order);
71
+ if(is_array($gallerylist)) {
72
  $excludelist = explode(',',$exclude);
73
  foreach($gallerylist as $gallery) {
74
  if (in_array($gallery->gid, $excludelist))
75
  continue;
76
  $gids.='_'.$gallery->gid;
77
  }
78
+ $gids = ltrim($gids,'_');
79
+ $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
80
  } else {
81
+ $out = __('[Galleries not found]','flag');
82
  }
83
+ } else {
84
+ $ids = explode( ',', $gid );
 
85
 
86
+ $galleryIDs = array();
87
  foreach ($ids as $id) {
88
+ $id = intval($id);
89
+ $galleryIDs[] = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->flaggallery} WHERE status = 0 AND gid = %d", $id));
90
+ }
91
+ $galleryIDs = array_filter($galleryIDs);
92
+ if(empty($galleryIDs)){
93
+ $out = sprintf(__('[Galleries %s not found]','flag'),$gid);
94
+ return $out;
95
+ }
96
 
97
+ $gids = implode('_',$galleryIDs);
98
+ $out = flagShowFlashAlbum($gids, $name, $w, $h, $skin, $playlist, $wmode, false, $fullwindow, $align);
 
 
99
  }
100
 
101
  $flag_options = get_option('flag_options');
119
  }
120
  if($swfmousewheel == 'true') $this->flag_add_mousewheel = true;
121
 
122
+ return $out;
123
  }
124
 
125
  function add_script() {
lib/swfobject.php CHANGED
@@ -16,7 +16,7 @@
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;
21
  require_once ( dirname(__FILE__) . '/class.swfobject.php' );
22
 
@@ -34,6 +34,7 @@ function flagShowFlashAlbum($galleryID, $name='', $width='', $height='', $skin='
34
  $swfmousewheel = '';
35
  $flashBacktransparent = '';
36
  $flashBackcolor = '';
 
37
  if (empty($width) ) $width = $flag_options['flashWidth'];
38
  if (empty($height)) $height = (int) $flag_options['flashHeight'];
39
  $data = '';
16
  * @param string $align
17
  * @return string the content
18
  */
19
+ function flagShowFlashAlbum($galleryID, $name='Gallery', $width='', $height='', $skin='', $playlist='', $wmode='', $linkto='', $fullwindow=false, $align='') {
20
  global $post;
21
  require_once ( dirname(__FILE__) . '/class.swfobject.php' );
22
 
34
  $swfmousewheel = '';
35
  $flashBacktransparent = '';
36
  $flashBackcolor = '';
37
+ if (empty($name) ) $name = 'Gallery';
38
  if (empty($width) ) $width = $flag_options['flashWidth'];
39
  if (empty($height)) $height = (int) $flag_options['flashHeight'];
40
  $data = '';
readme.txt CHANGED
@@ -6,11 +6,11 @@ Requires at least: 3.0
6
  Tested up to: 3.5.1
7
  Stable tag: trunk
8
 
9
- GRAND Flash Album Gallery is a Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your media content
10
 
11
  == Description ==
12
 
13
- GRAND Flash Album Gallery - powerfull flash & jQuery media content plugin. It provides a comprehensive interface for handling image galleries, audio and video.
14
 
15
  Edit your media content the way you want: upload images, import music and video, create photo gallery, music playlists, group pictures in slideshow and add descriptions for each image, mp3 or video - GRAND FlAGallery is the smart choice when showing the best of your product or describing in brief any event. GRAND FlAGallery can easily beautify your site with **image gallery, mp3 player, video player, banner rotator, nivo slider or nice widgets**. SEO optimized, compatibility with Google Reader, FeedBerner, etc.
16
 
@@ -19,13 +19,12 @@ Edit your media content the way you want: upload images, import music and video,
19
  * Widgets for Banner Rotator, Photo Gallery and Video Gallery.
20
  * Background music in gallery for desktop browsers.
21
 
22
- New plugin:
23
- > Try our **new plugin** called [Gmedia Gallery](http://wordpress.org/extend/plugins/grand-media/). Help me make it best gallery plugin: test it and write suggestions how I can improve it in feature versions.
24
-
25
  **[How to add gallery to your Wordpress site](http://mypgc.co/how-add-gallery-to-wordpress-website-or-blog)** - full HowTo guide.
26
 
27
  For more information read **[Review, Tutorials, FAQ](http://codeasily.com/wordpress-plugins/flag "GRAND FlAGallery Home Page")** and see demos created with "GRAND FlAGallery" WordPress Plugin.
28
 
 
 
29
  Responsive Banner Rotator! Full support of iPhone/iPad. Ideal for mobile themes. [See demo](http://skins.mypgc.co) in the site's header.
30
 
31
  Music/Video Player: Each instance (player copy) can play different file. All instances are connected between, so as soon as one start playing the previous is stopped automatically. Playlists also available.
@@ -45,9 +44,23 @@ Now you can see "Views" of each photo in the gallery and visitors can "Like" ima
45
  * Demo [Widgets](http://photogallerycreator.com/widgets-for-wordpress/)
46
  * Demo [Facebook Integration](http://www.facebook.com/#!/PhotoGalleryCreator?sk=app_206659789371708)
47
 
 
 
 
48
 
49
  == Changelog ==
50
 
 
 
 
 
 
 
 
 
 
 
 
51
  = v2.72 - 20.05.2013 =
52
  * Added: pagination on Music Box page
53
  * Fixed: small fixes for Banner Box page
@@ -559,8 +572,8 @@ You should have received a copy of the GNU General Public License along with thi
559
  2. Activate the plugin.
560
  3. Be sure that after activation 'wp-content/plugins/flagallery-skins' folder (chmod 755) created successfully. If not, create it manually and install skins through admin Skins page or via ftp.
561
  3. Add a gallery and upload some images (the main gallery folder must have write permission).
562
- 4. Go to your post/page an enter the tag '[flagallery gid=X name="ALBUM TITLE"]', where X - gallery IDs separated by comma; ALBUM TITLE - title of your album (default 'Gallery'). Easy way is click FlAGallery button on the Editor panel.
563
- 5. If you would like to use additional Flash Skins (only a option), go to <a href="http://photogallerycreator.com/grand-flagallery/" title="Flash Skins">Flash Skins</a>, download the skin and upload the file through Skins page in Wordpress admin panel.
564
 
565
  See more tags in the FAQ section
566
 
@@ -610,9 +623,9 @@ It's because your theme use some function different from <?php the_content('Read
610
 
611
  = How to create a categories in flash album? I only have one category, which is the name of the gallery. =
612
 
613
- You can do it easily with FlAGallery button on editor panel, when you edit post. In trhe popup window hold down 'Ctrl' button and choose galleries left mouse button. Or just write gallery IDs separated by comma in "gid" attribute: [flagallery gid=7,3,5,2 name="My Galleries"]
614
 
615
- To display ALL galleries as categories: [flagallery gid=all name="My Galleries"]
616
 
617
  = How can I set it to auto slideshow when open the page? =
618
 
@@ -629,9 +642,9 @@ Make sure that you have equal number of images in Manage Gallery and in ftp fold
629
 
630
  = How do I set a specific category as the first one that is displayed? =
631
 
632
- if you have three galleries and shortcode like: [flagallery gid=3,1,2 name=Gallery]
633
  first gallery will be with ID=3, then ID=1, and then ID=2
634
- if you have: [flagallery gid=all name=Gallery orderby=title order=ASC exclude=1]
635
  it will display all galleries except ID=1 sorted by title of gallery.
636
 
637
  = [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"] =
6
  Tested up to: 3.5.1
7
  Stable tag: trunk
8
 
9
+ GRAND Flagallery is a Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your media content
10
 
11
  == Description ==
12
 
13
+ GRAND Flagallery - powerfull media content plugin. It provides a comprehensive interface for handling image galleries, audio and video.
14
 
15
  Edit your media content the way you want: upload images, import music and video, create photo gallery, music playlists, group pictures in slideshow and add descriptions for each image, mp3 or video - GRAND FlAGallery is the smart choice when showing the best of your product or describing in brief any event. GRAND FlAGallery can easily beautify your site with **image gallery, mp3 player, video player, banner rotator, nivo slider or nice widgets**. SEO optimized, compatibility with Google Reader, FeedBerner, etc.
16
 
19
  * Widgets for Banner Rotator, Photo Gallery and Video Gallery.
20
  * Background music in gallery for desktop browsers.
21
 
 
 
 
22
  **[How to add gallery to your Wordpress site](http://mypgc.co/how-add-gallery-to-wordpress-website-or-blog)** - full HowTo guide.
23
 
24
  For more information read **[Review, Tutorials, FAQ](http://codeasily.com/wordpress-plugins/flag "GRAND FlAGallery Home Page")** and see demos created with "GRAND FlAGallery" WordPress Plugin.
25
 
26
+ Image Link support now available in skins. [See Slider Skin demo](http://photogallerycreator.com/grand-flagallery/slider-gallery-skin-for-wordpress/).
27
+
28
  Responsive Banner Rotator! Full support of iPhone/iPad. Ideal for mobile themes. [See demo](http://skins.mypgc.co) in the site's header.
29
 
30
  Music/Video Player: Each instance (player copy) can play different file. All instances are connected between, so as soon as one start playing the previous is stopped automatically. Playlists also available.
44
  * Demo [Widgets](http://photogallerycreator.com/widgets-for-wordpress/)
45
  * Demo [Facebook Integration](http://www.facebook.com/#!/PhotoGalleryCreator?sk=app_206659789371708)
46
 
47
+ New plugin:
48
+ > Try our **new plugin** called [Gmedia Gallery](http://wordpress.org/extend/plugins/grand-media/). Help me make it best gallery plugin: test it and write suggestions how I can improve it in feature versions.
49
+
50
 
51
  == Changelog ==
52
 
53
+ = v2.76 - 13.06.2013 =
54
+ * Fixed: Size for thumbs on Manage Images page
55
+ * Fixed: Create New Thumbnails not working properly with fix dimensions
56
+ * Fixed: First activation of plugin do not move free skins to 'flagallery-skins' folder
57
+ * Fixed: GRAND Page do not remembers playlist option
58
+
59
+ = v2.75 - 10.06.2013 =
60
+ * Added: Link feald for image (optional for skin)
61
+ * Added: Draft for galleries
62
+ * Fixed: PHP and CSS improvements
63
+
64
  = v2.72 - 20.05.2013 =
65
  * Added: pagination on Music Box page
66
  * Fixed: small fixes for Banner Box page
572
  2. Activate the plugin.
573
  3. Be sure that after activation 'wp-content/plugins/flagallery-skins' folder (chmod 755) created successfully. If not, create it manually and install skins through admin Skins page or via ftp.
574
  3. Add a gallery and upload some images (the main gallery folder must have write permission).
575
+ 4. Go to your post/page an enter the tag '[flagallery gid=X]', where X - gallery IDs separated by comma. Easy way is click FlAGallery button on the Editor panel.
576
+ 5. If you would like to use additional Skins (only a option), go to <a href="http://photogallerycreator.com/grand-flagallery/" title="Skins">Skins</a>, download the skin and upload the file through Skins page in Wordpress admin panel.
577
 
578
  See more tags in the FAQ section
579
 
623
 
624
  = How to create a categories in flash album? I only have one category, which is the name of the gallery. =
625
 
626
+ You can do it easily with FlAGallery button on editor panel, when you edit post. In trhe popup window hold down 'Ctrl' button and choose galleries left mouse button. Or just write gallery IDs separated by comma in "gid" attribute: [flagallery gid=7,3,5,2]
627
 
628
+ To display ALL galleries as categories: [flagallery gid=all]
629
 
630
  = How can I set it to auto slideshow when open the page? =
631
 
642
 
643
  = How do I set a specific category as the first one that is displayed? =
644
 
645
+ if you have three galleries and shortcode like: [flagallery gid=3,1,2]
646
  first gallery will be with ID=3, then ID=1, and then ID=2
647
+ if you have: [flagallery gid=all orderby=title order=ASC exclude=1]
648
  it will display all galleries except ID=1 sorted by title of gallery.
649
 
650
  = [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"] =
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file
screenshot-7.png DELETED
Binary file
screenshot-8.png DELETED
Binary file
screenshot-9.png DELETED
Binary file
widgets/widgets.php CHANGED
@@ -31,10 +31,16 @@ class flagSlideshowWidget extends WP_Widget {
31
  $flag_custom = get_post_custom($gp_ID);
32
  $gal_array = array_filter( array_map ( 'intval', explode( ',', $flag_custom["mb_items_array"][0] ) ) );
33
  $gid = $gal_array[0];
34
- if($gid)
 
 
 
 
 
35
  $imageList[$gp_ID] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$gid} ORDER by rand() LIMIT 1");
 
36
  else if ($gid == 0) {
37
- $imageList[$gp_ID] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 ORDER by rand() LIMIT 1");
38
  } else {
39
  return false;
40
  }
@@ -362,19 +368,25 @@ class flagWidget extends WP_Widget {
362
 
363
  extract( $args );
364
 
365
- $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
366
 
367
  $album = $instance['album'];
368
 
369
- $gallerylist = $flagdb->get_album($album);
370
- $ids = explode( ',', $gallerylist );
371
- $gids = str_replace(',','_',$gallerylist);
372
- foreach ($ids as $id) {
373
- if ( $instance['type'] == 'random' )
 
 
 
 
374
  $imageList[$id] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$id} ORDER by rand() LIMIT 1");
375
- else
 
376
  $imageList[$id] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$id} ORDER by tt.sortorder ASC LIMIT 1");
377
- }
 
378
  echo $before_widget . $before_title . $title . $after_title;
379
  echo "\n" . '<div class="flag-widget">'. "\n";
380
 
31
  $flag_custom = get_post_custom($gp_ID);
32
  $gal_array = array_filter( array_map ( 'intval', explode( ',', $flag_custom["mb_items_array"][0] ) ) );
33
  $gid = $gal_array[0];
34
+ if($gid){
35
+ $galID = (int) $gid;
36
+ $status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
37
+ if(intval($status)){
38
+ continue;
39
+ }
40
  $imageList[$gp_ID] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$gid} ORDER by rand() LIMIT 1");
41
+ }
42
  else if ($gid == 0) {
43
+ $imageList[$gp_ID] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.status = 0 ORDER by rand() LIMIT 1");
44
  } else {
45
  return false;
46
  }
368
 
369
  extract( $args );
370
 
371
+ $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
372
 
373
  $album = $instance['album'];
374
 
375
+ $gallerylist = $flagdb->get_album($album);
376
+ $ids = explode( ',', $gallerylist );
377
+ foreach ($ids as $id) {
378
+ $galID = (int) $id;
379
+ $status = $wpdb->get_var("SELECT status FROM $wpdb->flaggallery WHERE gid={$galID}");
380
+ if(intval($status)){
381
+ continue;
382
+ }
383
+ if ( $instance['type'] == 'random' ){
384
  $imageList[$id] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$id} ORDER by rand() LIMIT 1");
385
+ }
386
+ else {
387
  $imageList[$id] = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->flaggallery AS t INNER JOIN $wpdb->flagpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 AND t.gid = {$id} ORDER by tt.sortorder ASC LIMIT 1");
388
+ }
389
+ }
390
  echo $before_widget . $before_title . $title . $after_title;
391
  echo "\n" . '<div class="flag-widget">'. "\n";
392