Gallery – Flagallery Photo Portfolio - Version 4.30

Version Description

Download this release

Release Info

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

Code changes from version 4.29 to 4.30

admin/addgallery.php CHANGED
@@ -86,7 +86,7 @@ function flag_admin_add_gallery(){
86
  /* ]]> */
87
  </script>
88
  <?php } ?>
89
- <div id="slider" class="wrap">
90
 
91
  <ul id="tabs" class="tabs">
92
  <li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?></a></li>
@@ -132,7 +132,7 @@ function flag_admin_add_gallery(){
132
 
133
  <form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
134
  <?php wp_nonce_field('flag_upload'); ?>
135
- <table class="form-table">
136
  <tr valign="top">
137
  <td style="width: 216px;">
138
  <label for="galleryselect"><?php _e('Upload images in', 'flag'); ?> *</label>
@@ -173,9 +173,9 @@ function flag_admin_add_gallery(){
173
  <div class="submit">
174
  <span class="useflashupload">
175
  <?php if($flag->options['swfUpload']){ ?>
176
- <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload via Plupload, disable it if you have problems', 'flag'); ?>" value="<?php _e('Switch to Browser Upload', 'flag'); ?>"/>
177
  <?php } else{ ?>
178
- <input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag'); ?>" value="<?php _e('Switch to Plupload based Upload', 'flag'); ?>"/>
179
  <?php } ?>
180
  </span>
181
 
86
  /* ]]> */
87
  </script>
88
  <?php } ?>
89
+ <div id="slider" class="flag-wrap">
90
 
91
  <ul id="tabs" class="tabs">
92
  <li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?></a></li>
132
 
133
  <form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8">
134
  <?php wp_nonce_field('flag_upload'); ?>
135
+ <table class="flag-form-table">
136
  <tr valign="top">
137
  <td style="width: 216px;">
138
  <label for="galleryselect"><?php _e('Upload images in', 'flag'); ?> *</label>
173
  <div class="submit">
174
  <span class="useflashupload">
175
  <?php if($flag->options['swfUpload']){ ?>
176
+ <input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload via Plupload, disable it if you have problems', 'flag'); ?>" value="<?php _e('Switch to Browser Upload', 'flag'); ?>"/>
177
  <?php } else{ ?>
178
+ <input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag'); ?>" value="<?php _e('Switch to Plupload based Upload', 'flag'); ?>"/>
179
  <?php } ?>
180
  </span>
181
 
admin/admin.php CHANGED
@@ -235,24 +235,24 @@ class flagAdminPanel {
235
  if(isset($_GET['page'])){
236
  switch($_GET['page']){
237
  case 'flag-overview' :
238
- wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '2.8.1', 'screen');
239
  wp_admin_css('css/dashboard');
240
  break;
241
  case "flag-options" :
242
  wp_enqueue_style('farbtastic');
243
  case "flag-manage-gallery" :
244
- wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '1.0.0', 'screen');
245
  case "flag-music-box" :
246
  case "flag-video-box" :
247
  case "flag-banner-box" :
248
  wp_enqueue_style('thickbox');
249
- wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '2.8.1', 'screen');
250
  break;
251
  case "flag-skins" :
252
  wp_enqueue_style('thickbox');
253
  wp_enqueue_style('farbtastic');
254
- wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '1.0.0', 'screen');
255
- wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '2.8.1', 'screen');
256
  wp_admin_css('css/dashboard');
257
  break;
258
  }
235
  if(isset($_GET['page'])){
236
  switch($_GET['page']){
237
  case 'flag-overview' :
238
+ wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
239
  wp_admin_css('css/dashboard');
240
  break;
241
  case "flag-options" :
242
  wp_enqueue_style('farbtastic');
243
  case "flag-manage-gallery" :
244
+ wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen');
245
  case "flag-music-box" :
246
  case "flag-video-box" :
247
  case "flag-banner-box" :
248
  wp_enqueue_style('thickbox');
249
+ wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
250
  break;
251
  case "flag-skins" :
252
  wp_enqueue_style('thickbox');
253
  wp_enqueue_style('farbtastic');
254
+ wp_enqueue_style('flagtabs', FLAG_URLPATH . 'admin/css/tabs.css', false, '4.3.0', 'screen');
255
+ wp_enqueue_style('flagadmin', FLAG_URLPATH . 'admin/css/flagadmin.css', false, '4.3.0', 'screen');
256
  wp_admin_css('css/dashboard');
257
  break;
258
  }
admin/ajax.php CHANGED
@@ -124,6 +124,8 @@ function flag_save_album() {
124
  die('-1');
125
 
126
  $g = array();
 
 
127
  if(isset($_POST['form']))
128
  parse_str($_POST['form']);
129
  $result = false;
@@ -134,7 +136,7 @@ function flag_save_album() {
134
  $galstring = implode(',', $g);
135
  else
136
  $galstring = '';
137
- $result = $wpdb->query( $wpdb->prepare("UPDATE `{$wpdb->flagalbum}` SET `name` = %s, `categories` = %s WHERE `id` = %s", $album_name, $galstring, $album_id) );
138
  }
139
 
140
  if($result) {
@@ -160,7 +162,7 @@ function flag_delete_album() {
160
 
161
  $result = false;
162
  if(isset($_POST['post'])) {
163
- $result = $wpdb->query( $wpdb->prepare( "DELETE FROM `{$wpdb->flagalbum}` WHERE `id` = %d", $_POST['post']) );
164
  }
165
 
166
  if($result) {
124
  die('-1');
125
 
126
  $g = array();
127
+ $album_id = 0;
128
+ $album_name = '';
129
  if(isset($_POST['form']))
130
  parse_str($_POST['form']);
131
  $result = false;
136
  $galstring = implode(',', $g);
137
  else
138
  $galstring = '';
139
+ $result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->flagalbum} SET name = %s, categories = %s WHERE id = %s", $album_name, $galstring, $album_id) );
140
  }
141
 
142
  if($result) {
162
 
163
  $result = false;
164
  if(isset($_POST['post'])) {
165
+ $result = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->flagalbum} WHERE id = %d", $_POST['post']) );
166
  }
167
 
168
  if($result) {
admin/banner-box.php CHANGED
@@ -1,552 +1,573 @@
1
  <?php
2
 
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
 
 
4
 
5
  // check for correct capability
6
- if ( !is_user_logged_in() )
7
  die('-1');
 
8
 
9
  // check for correct FlAG capability
10
- if ( !current_user_can('FlAG Manage banners') )
11
- die('-1');
 
12
 
13
 
14
- require_once (dirname (__FILE__) . '/functions.php');
15
- require_once (dirname (__FILE__) . '/banner.functions.php');
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) AND false === strpos($bannerfolder, '..') ) {
23
  $crunch_list = flagAdmin::import_banner($bannerfolder);
24
  $mode = 'import';
25
  }
26
  }
27
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
28
- if($action == 'no_action') {
29
  $action = false;
30
  }
31
- switch($mode) {
32
  case 'sort':
33
  check_admin_referer('flag_sort');
34
- include_once (dirname (__FILE__) . '/banner-sort.php');
35
  flag_b_playlist_order();
36
- break;
37
  case 'edit':
38
  $file = sanitize_flagname($_GET['playlist']);
39
- if(isset($_POST['updatePlaylist'])) {
40
  check_admin_referer('flag_update');
41
  $title = esc_html($_POST['playlist_title']);
42
  $descr = esc_html($_POST['playlist_descr']);
43
  $data = array();
44
- foreach($_POST['item_a'] as $item_id => $item) {
45
- if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
46
  continue;
 
47
  $data[] = $item_id;
48
  }
49
  flagGallery::flagSaveWpMedia();
50
- flagSave_bPlaylist($title,$descr,$data,$file);
51
  }
52
- if(isset($_POST['updatePlaylistSkin'])) {
53
  check_admin_referer('flag_update');
54
  flagSave_bPlaylistSkin($file);
55
  }
56
- include_once (dirname (__FILE__) . '/manage-banner.php');
57
  flag_b_playlist_edit($file);
58
- break;
59
  case 'save':
60
- if(isset($_POST['items_array'])) {
61
  check_admin_referer('flag_update');
62
  $title = esc_html($_POST['playlist_title']);
63
  $descr = esc_html($_POST['playlist_descr']);
64
  $data = $_POST['items_array'];
65
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
66
  flagGallery::flagSaveWpMedia();
67
- flagSave_bPlaylist($title,$descr,$data, $file);
68
  }
69
- if(isset($_GET['playlist'])) {
70
- include_once (dirname (__FILE__) . '/manage-banner.php');
71
  flag_b_playlist_edit();
72
- } else {
73
  flag_created_b_playlists();
74
  flag_banner_wp_media_lib();
75
  }
76
- break;
77
- case 'add':
78
  check_admin_referer('flag_add');
79
  if(isset($_POST['items']) && isset($_GET['playlist'])){
80
  $added = $_POST['items'];
81
- } elseif(isset($_GET['playlist'])) {
82
- $added = $_COOKIE['bannerboxplaylist_'.sanitize_flagname($_GET['playlist'])];
83
- } else {
84
  $added = false;
85
  }
86
  flag_banner_wp_media_lib($added);
87
- break;
88
  case 'delete':
89
  check_admin_referer('flag_delete');
90
  flag_b_playlist_delete(sanitize_flagname($_GET['playlist']));
91
- case 'import':
92
  flag_crunch($crunch_list);
93
- case 'main':
94
- if(isset($_POST['updateMedia'])) {
95
  check_admin_referer('flag_update');
96
  flagGallery::flagSaveWpMedia();
97
- flagGallery::show_message( __('Media updated','flag') );
98
  }
99
  default:
100
  flag_created_b_playlists();
101
  flag_banner_wp_media_lib();
102
- break;
103
  }
104
 
105
  }
106
- function flag_crunch($crunch_list) {
107
- if(!$crunch_list) {
 
108
  return;
109
  }
110
  $crunch_string = implode(',', $crunch_list);
111
- $folder = str_replace(array('../','\'','"','<','>','$','%','='),'', $_POST['bannerfolder']);
112
  $folder = rtrim($folder, '/');
113
- $path = WINABSPATH . $folder.'/';
114
- ?>
115
- <script type="text/javascript">
116
- <!--
117
- jQuery(document).ready(function(){
118
- var crunch_string = '<?php echo $crunch_string; ?>';
119
- var bannerfolder = '<?php echo $path; ?>';
120
- var crunch_list = crunch_string.split(',');
121
- var parts = crunch_list.length;
122
- function flag_crunch() {
123
- if(crunch_list.length) {
124
- jQuery.post(
125
- ajaxurl,
126
- {
127
- action: "flag_banner_crunch",
128
- _wpnonce: "<?php echo wp_create_nonce( 'flag-ajax' ); ?>",
129
- path: encodeURI(bannerfolder + crunch_list[0])
130
- },
131
- function( response ) {
132
- crunch_list.shift();
133
- var parts_done = parts - crunch_list.length;
134
- jQuery(".flag_crunching .flag_progress .flag_complete").animate({width:parts_done*(100/parts)+'%'}, 400);
135
- jQuery(".flag_crunching").append(response);
136
- flag_crunch();
 
 
 
 
 
 
 
 
137
  }
138
- );
139
- } else {
140
- var refpage = window.location.href;
141
- jQuery(".flag_crunching .txt").html('<a href="'+refpage+'"><?php _e("Import folder is complete. The page reloads after 5 seconds.", "flag"); ?></a>');
142
- //alert('<?php _e("Import folder complete. Refresh page.", "flag"); ?>');
143
- setTimeout(function(){ window.location.href=window.location.href }, 5000);
144
- }
145
- }
146
- flag_crunch();
147
- });
148
- //-->
149
- </script>
150
 
151
  <?php }
152
 
153
- function flag_created_b_playlists() {
154
 
155
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
156
 
157
  $all_playlists = get_b_playlists();
158
  $total_all_playlists = count($all_playlists);
159
- $flag_options = get_option ('flag_options');
160
 
161
- ?>
162
- <div class="wrap">
163
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
164
- <table class="widefat" cellspacing="0">
165
  <thead>
166
  <tr>
167
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
168
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
169
- <th scope="col" ><?php _e('Quantity', 'flag'); ?></th>
170
- <th scope="col" ><?php _e('Shortcode', 'flag'); ?></th>
171
- <th scope="col" ><?php _e('Action', 'flag'); ?></th>
172
  </tr>
173
  </thead>
174
  <tbody>
175
- <?php
176
- if($all_playlists) {
177
- foreach((array)$all_playlists as $playlist_file => $playlist_data) {
178
- $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
179
- $class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
180
- $playlist_name = basename($playlist_file, '.xml');
181
- if(count($query_m) != count($playlist_data['items'])) {
182
- flagSave_bPlaylist($playlist_data['title'],$playlist_data['description'],$playlist_data['items'],$playlist_name);
183
- }
184
- ?>
185
- <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
186
- <td>
187
- <a href="<?php echo esc_url($filepath.'&playlist='.$playlist_name.'&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>" >
188
- <?php echo esc_html($playlist_data['title']); ?>
189
- </a>
190
- </td>
191
- <td><?php echo esc_html($playlist_data['description']); echo '&nbsp;('.__("player", "flag").': <strong>'.esc_html($playlist_data['skin']).'</strong>)' ?></td>
192
- <td><?php echo count($query_m); ?></td>
193
- <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandbanner xml=<?php echo $playlist_name; ?>]" /></td>
194
- <td>
195
- <a href="<?php echo wp_nonce_url($filepath.'&playlist='.$playlist_name."&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
196
- </td>
197
- </tr>
198
- <?php
199
- }
200
- } else {
201
- echo '<tr><td colspan="5" align="center"><strong>'.__('No playlists found','flag').'</strong></td></tr>';
202
- }
203
- ?>
 
 
204
  </tbody>
205
  </table>
206
  </div>
207
 
208
- <?php } ?>
 
209
 
210
- <?php // *** show media list
211
- function flag_banner_wp_media_lib($added=false) {
212
  global $wpdb;
213
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
214
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
215
- $exclude = array();
216
- if($added!==false) {
217
  $added = preg_replace('/[^\d,]+/', '', $added);
218
- $filepath .= '&playlist='.sanitize_flagname($_GET['playlist']).'&mode=save';
219
  $flag_options = get_option('flag_options');
220
- $playlistPath = $flag_options['galleryPath'].'playlists/banner/'.sanitize_flagname($_GET['playlist']).'.xml';
221
- $playlist = get_b_playlist_data(ABSPATH.$playlistPath);
222
  $exclude = explode(',', $added);
223
  $exclude = array_filter($exclude, 'intval');
224
- } else {
225
  $items_array_default = isset($_COOKIE['bannerboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['bannerboxplaylist_default']) : '';
226
  $exclude = explode(',', $items_array_default);
227
  $exclude = array_filter($exclude, 'intval');
228
  }
229
  if(isset($_GET['playlist'])){
230
  $playlist_cookie = sanitize_flagname($_GET['playlist']);
231
- } else {
232
  $playlist_cookie = 'default';
233
  }
234
  $filepath = esc_url($filepath);
235
- ?>
236
- <script type="text/javascript">
237
- <!--
238
- jQuery(document).ready(function(){
239
- var storedData = getStorage('bannerboxplaylist_');
240
- <?php if(isset($_POST['items'])){
241
  ?>
242
- storedData.set('<?php echo $playlist_cookie; ?>', '<?php echo preg_replace('/[^\d,]+/', '', $_POST['items']); ?>');
243
- <?php } ?>
244
- jQuery('.cb :checkbox').click(function() {
245
- var cur, arr, del;
246
- if(jQuery(this).is(':checked')){
247
- cur = jQuery(this).val();
248
- arr = jQuery('#items_array').val();
249
- if(arr) { del = ','; } else { del = ''; }
250
- jQuery('#items_array').val(arr+del+cur);
251
- jQuery(this).closest('tr').css('background-color','#DDFFBB');
252
- } else {
253
- cur = jQuery(this).val();
254
- arr = jQuery('#items_array').val().split(',');
255
- arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
256
- jQuery('#items_array').val(arr);
257
- jQuery(this).closest('tr').removeAttr('style');
258
- }
259
- storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
260
- });
261
- jQuery('.clear_selected').click(function(){
262
- jQuery('#items_array').val('');
263
- jQuery('.cb :checkbox').each(function(){
264
- jQuery(this).prop('checked', false).closest('tr').removeAttr('style');
265
- });
266
- storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
267
- });
268
- });
269
- function getStorage(key_prefix) {
270
- return {
271
- set: function (id, data) {
272
- document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
273
- },
274
- get: function (id, data) {
275
- var cookies = document.cookie, parsed = {};
276
- cookies.replace(/([^=]+)=([^;]*);?\s*/g, function (whole, key, value) {
277
- parsed[key] = decodeURIComponent(value);
278
  });
279
- return parsed[key_prefix + id];
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  }
281
- };
282
- }
283
 
284
- function checkAll(form) {
285
- for (i = 0, n = form.elements.length; i < n; i++) {
286
- if(form.elements[i].type == "checkbox") {
287
- if(form.elements[i].name == "doaction[]") {
288
- if(form.elements[i].checked == true)
289
- form.elements[i].checked = false;
290
- else
291
- form.elements[i].checked = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
  }
294
- }
295
- var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
296
- jQuery('#items_array').val(arr);
297
- }
298
- // this function check for a the number of selected images, sumbmit false when no one selected
299
- function checkSelected() {
300
- if(!jQuery('#items_array').val()) {
301
- alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
302
- return false;
303
- }
304
- var actionId = jQuery('#bulkaction').val();
305
- switch (actionId) {
306
- case "new_playlist":
307
- showDialog('new_playlist', 160);
308
- return false;
309
- break;
310
- }
311
- }
312
 
313
- function showDialog( windowId, height ) {
314
- jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
315
- jQuery("#" + windowId + "_banid").val(jQuery('#items_array').val());
316
- tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
317
- }
318
- //-->
319
- </script>
320
- <div class="wrap">
321
- <?php if($added===false) { ?>
322
- <?php if( current_user_can('FlAG Import folder') ) {
323
- $defaultpath = basename(WP_CONTENT_DIR).'/';
324
- ?>
325
- <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css" />
326
- <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
327
- <script type="text/javascript">
328
- /* <![CDATA[ */
329
- jQuery(function() {
330
- jQuery("span.browsefiles").show().click(function(){
331
- jQuery("#file_browser").fileTree({
332
- script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
333
- root: jQuery("#bannerfolder").val()
334
- }, function(file) {
335
- //var path = file.replace("<?php echo WINABSPATH; ?>", "");
336
- jQuery("#bannerfolder").val(file);
337
- });
338
 
339
- jQuery("#file_browser").show("slide");
340
- });
341
- });
342
- /* ]]> */
343
- </script>
344
-
345
- <!-- import folder -->
346
- <div id="importfolder">
347
- <h2><?php _e('Import banners from folder', 'flag'); ?></h2>
348
- <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
349
- <?php wp_nonce_field('flag_addbanner'); ?>
350
- <table class="form-table">
351
- <tr valign="top">
352
- <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
353
- <td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...',"flag"); ?></span>
354
- <div id="file_browser"></div><br />
355
- <p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
356
- <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
357
- </td>
358
- </tr>
359
- </table>
360
- <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
361
- </form>
362
- </div>
363
- <?php } ?>
364
- <?php } ?>
 
 
 
365
 
366
  <h2><?php _e('WordPress Image Library', 'flag'); ?></h2>
367
 
368
- <?php
369
- // look for pagination
370
- if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
371
- $_GET['paged'] = 1;
372
-
373
- $_GET['paged'] = intval($_GET['paged']);
374
- $objects_per_page = 25;
375
- $start = ( $_GET['paged'] - 1 ) * $objects_per_page;
376
- $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` LIKE 'image/%' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
377
- $bannerlist = get_posts( $args = array(
378
- 'numberposts' => $objects_per_page,
379
- 'offset' => $start,
380
- 'orderby' => 'ID',
381
- 'order' => 'DESC',
382
- 'post_type' => 'attachment',
383
- 'post_mime_type' => array('image') )
384
- );
385
-
386
- // build pagination
387
- $page_links = paginate_links( array(
388
- 'base' => add_query_arg( 'paged', '%#%' ),
389
- 'format' => '',
390
- 'prev_text' => __('&laquo;'),
391
- 'next_text' => __('&raquo;'),
392
- 'total' => ceil( $img_total_count / $objects_per_page),
393
- 'current' => intval($_GET['paged']),
394
- 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))
395
- ));
396
- ?>
397
- <div class="tablenav" style="overflow: hidden; height: auto;">
398
- <?php if($added===false) { ?>
399
- <div class="alignleft"><b><?php _e('Selected Media','flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>" /> <span class="clear_selected button"><?php _e('Clear Selected','flag'); ?></span></div>
400
- <?php } ?>
401
- <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
402
- number_format_i18n( ( $_GET['paged'] - 1 ) * $objects_per_page + 1 ),
403
- number_format_i18n( min( $_GET['paged'] * $objects_per_page, $img_total_count ) ),
404
- number_format_i18n( $img_total_count ),
405
- $page_links
406
- ); echo $page_links_text; ?></div>
407
- </div>
408
  <form id="bannerlib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
409
- <?php wp_nonce_field('flag_update'); ?>
410
- <input type="hidden" name="page" value="banner-box" />
411
-
412
- <div class="tablenav">
413
-
414
- <div class="actions">
415
- <?php if($added===false) { ?>
416
- <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media','flag'); ?>" />
417
- <?php if ( function_exists('json_encode') ) { ?>
418
- <select name="bulkaction" id="bulkaction">
419
- <option value="no_action" ><?php _e("No action",'flag'); ?></option>
420
- <option value="new_playlist" ><?php _e("Create new playlist",'flag'); ?></option>
421
- </select>
422
- <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
423
- <?php } ?>
424
- <a href="<?php echo admin_url( 'media-new.php'); ?>" class="button"><?php _e('Upload Banner(s)','flag'); ?></a>
425
- <input type="hidden" id="items_array" name="items_array" value="" />
426
- <?php } else { ?>
427
- <input type="hidden" name="mode" value="save" />
428
- <input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>" />
429
- <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>" />
430
- <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
431
- <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
432
- <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
433
- <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist','flag'); ?>" />
434
- <?php } ?>
 
 
 
435
  </div>
436
-
437
- </div>
438
- <table class="widefat" cellspacing="0">
439
- <thead>
440
- <tr>
441
- <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
442
- <th class="id" width="64" scope="col"><div><?php _e('ID', 'flag'); ?></div></th>
443
- <th class="thumb" width="110" scope="col"><div><?php _e('Thumbnail', 'flag'); ?></div></th>
444
- <th class="title_filename" scope="col"><div><?php _e('Filename / Title / Link', 'flag'); ?></div></th>
445
- <th class="description" scope="col"><div><?php _e('Description', 'flag'); ?></div></th>
446
- </tr>
447
- </thead>
448
- <tfoot>
449
- <tr>
450
- <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
451
- <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
452
- <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
453
- <th class="title_filename" scope="col"><?php _e('Filename / Title / Link', 'flag'); ?></th>
454
- <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
455
- </tr>
456
- </tfoot>
457
- <tbody>
458
- <?php
459
- $uploads = wp_upload_dir();
460
- $flag_options = get_option('flag_options');
461
- if($bannerlist) {
462
- foreach($bannerlist as $ban) {
463
- $list[] = $ban->ID;
464
- }
465
- $class = ' class="alternate"';
466
- foreach($bannerlist as $ban) {
467
- $class = ( empty($class) ) ? ' class="alternate"' : '';
468
- $class2 = ( empty($class) ) ? '' : ' alternate';
469
- $ex = $checked = '';
470
- if( ($added!==false || !empty($items_array_default)) && in_array($ban->ID, $exclude) ) {
471
- $ex = ' style="background-color:#DDFFBB;" title="'.__("Already Added", "flag").'"';
472
- $checked = ' checked="checked"';
473
- }
474
- $bg = ( !isset($class) || $class == 'class="alternate"' ) ? 'f9f9f9' : 'ffffff';
475
- $thumb = $banthumb = get_post_meta($ban->ID, 'thumbnail', true);
476
- $link = get_post_meta($ban->ID, 'link', true);
477
- if(empty($thumb)) {
478
- $thumb = wp_get_attachment_thumb_url($ban->ID);
479
- $banthumb = '';
480
- }
481
- $url = wp_get_attachment_url($ban->ID);
482
- ?>
483
- <tr id="ban-<?php echo $ban->ID; ?>"<?php echo $class.$ex; ?>>
484
- <td class="cb"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $ban->ID; ?>" /></td>
485
- <td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $ban->ID; ?></p></td>
486
- <td class="thumb">
487
- <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="100" height="100" alt="" /></a>
488
- </td>
489
- <td class="title_filename">
490
- <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
491
- <textarea title="Title" name="item_a[<?php echo $ban->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($ban->post_title)); ?></textarea><br />
492
- <?php _e('URL', 'flag'); ?>: <input id="banlink-<?php echo $ban->ID; ?>" name="item_a[<?php echo $ban->ID; ?>][link]" style="width:50%;" type="text" value="<?php echo esc_url($link); ?>" /><br />
493
- </td>
494
- <td class="description">
495
- <textarea name="item_a[<?php echo $ban->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1" ><?php echo esc_html(stripslashes($ban->post_content)); ?></textarea>
496
- </td>
497
- </tr>
498
- <?php
499
- }
500
- } else {
501
- echo '<tr><td colspan="5" align="center"><strong>'.__('No images in WordPress Media Library.','flag').'</strong></td></tr>';
502
- }
503
- ?>
504
- </tbody>
505
- </table>
 
 
 
 
506
  </form>
507
  </div>
508
 
509
  <!-- #new_playlist -->
510
- <div id="new_playlist" style="display: none;" >
511
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
512
- <?php wp_nonce_field('flag_update'); ?>
513
- <input type="hidden" id="new_playlist_banid" name="items_array" value="" />
514
- <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value="" />
515
- <input type="hidden" name="mode" value="save" />
516
- <input type="hidden" name="page" value="banner-box" />
517
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
518
- <tr valign="top">
519
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title','flag'); ?></th>
520
- <td><input type="text" class="alignleft" name="playlist_title" value="" />
521
- <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
522
- <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
523
- <?php require_once (dirname(__FILE__) . '/get_skin.php');
524
- $all_skins = get_skins($skin_folder='', $type='b');
525
- if(count($all_skins)) {
526
- foreach ( (array)$all_skins as $skin_file => $skin_data) {
527
- echo '<option value="'.dirname($skin_file).'">'.$skin_data['Name'].'</option>'."\n";
528
- }
529
- } else {
530
- echo '<option value="rotator_default">'.__("No Skins", "flag").'</option>';
531
- }
532
- ?>
533
- </select>
534
- </div>
535
- </td>
536
- </tr>
537
- <tr valign="top">
538
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description','flag'); ?></th>
539
- <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
540
- </tr>
541
- <tr>
542
- <td>&nbsp;</td>
543
- <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
544
- &nbsp; &nbsp; &nbsp;
545
- <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>" />
546
- </td>
547
- </tr>
548
- </table>
 
549
  </form>
550
  </div>
551
- <!-- /#new_playlist -->
552
  <?php }
1
  <?php
2
 
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
4
+ die('You are not allowed to call this page directly.');
5
+ }
6
 
7
  // check for correct capability
8
+ if(!is_user_logged_in()){
9
  die('-1');
10
+ }
11
 
12
  // check for correct FlAG capability
13
+ if(!current_user_can('FlAG Manage banners')){
14
+ die('-1');
15
+ }
16
 
17
 
18
+ require_once(dirname(__FILE__) . '/functions.php');
19
+ require_once(dirname(__FILE__) . '/banner.functions.php');
20
 
21
+ function flag_banner_controler(){
22
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
23
+ if(isset($_POST['importfolder']) && $_POST['importfolder']){
24
  check_admin_referer('flag_addbanner');
25
  $bannerfolder = $_POST['bannerfolder'];
26
+ if(!empty($bannerfolder) AND false === strpos($bannerfolder, '..')){
27
  $crunch_list = flagAdmin::import_banner($bannerfolder);
28
  $mode = 'import';
29
  }
30
  }
31
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
32
+ if($action == 'no_action'){
33
  $action = false;
34
  }
35
+ switch($mode){
36
  case 'sort':
37
  check_admin_referer('flag_sort');
38
+ include_once(dirname(__FILE__) . '/banner-sort.php');
39
  flag_b_playlist_order();
40
+ break;
41
  case 'edit':
42
  $file = sanitize_flagname($_GET['playlist']);
43
+ if(isset($_POST['updatePlaylist'])){
44
  check_admin_referer('flag_update');
45
  $title = esc_html($_POST['playlist_title']);
46
  $descr = esc_html($_POST['playlist_descr']);
47
  $data = array();
48
+ foreach($_POST['item_a'] as $item_id => $item){
49
+ if($action == 'delete_items' && in_array($item_id, $_POST['doaction'])){
50
  continue;
51
+ }
52
  $data[] = $item_id;
53
  }
54
  flagGallery::flagSaveWpMedia();
55
+ flagSave_bPlaylist($title, $descr, $data, $file);
56
  }
57
+ if(isset($_POST['updatePlaylistSkin'])){
58
  check_admin_referer('flag_update');
59
  flagSave_bPlaylistSkin($file);
60
  }
61
+ include_once(dirname(__FILE__) . '/manage-banner.php');
62
  flag_b_playlist_edit($file);
63
+ break;
64
  case 'save':
65
+ if(isset($_POST['items_array'])){
66
  check_admin_referer('flag_update');
67
  $title = esc_html($_POST['playlist_title']);
68
  $descr = esc_html($_POST['playlist_descr']);
69
  $data = $_POST['items_array'];
70
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
71
  flagGallery::flagSaveWpMedia();
72
+ flagSave_bPlaylist($title, $descr, $data, $file);
73
  }
74
+ if(isset($_GET['playlist'])){
75
+ include_once(dirname(__FILE__) . '/manage-banner.php');
76
  flag_b_playlist_edit();
77
+ } else{
78
  flag_created_b_playlists();
79
  flag_banner_wp_media_lib();
80
  }
81
+ break;
82
+ case 'add':
83
  check_admin_referer('flag_add');
84
  if(isset($_POST['items']) && isset($_GET['playlist'])){
85
  $added = $_POST['items'];
86
+ } elseif(isset($_GET['playlist'])){
87
+ $added = $_COOKIE['bannerboxplaylist_' . sanitize_flagname($_GET['playlist'])];
88
+ } else{
89
  $added = false;
90
  }
91
  flag_banner_wp_media_lib($added);
92
+ break;
93
  case 'delete':
94
  check_admin_referer('flag_delete');
95
  flag_b_playlist_delete(sanitize_flagname($_GET['playlist']));
96
+ case 'import':
97
  flag_crunch($crunch_list);
98
+ case 'main':
99
+ if(isset($_POST['updateMedia'])){
100
  check_admin_referer('flag_update');
101
  flagGallery::flagSaveWpMedia();
102
+ flagGallery::show_message(__('Media updated', 'flag'));
103
  }
104
  default:
105
  flag_created_b_playlists();
106
  flag_banner_wp_media_lib();
107
+ break;
108
  }
109
 
110
  }
111
+
112
+ function flag_crunch($crunch_list){
113
+ if(!$crunch_list){
114
  return;
115
  }
116
  $crunch_string = implode(',', $crunch_list);
117
+ $folder = str_replace(array('../', '\'', '"', '<', '>', '$', '%', '='), '', $_POST['bannerfolder']);
118
  $folder = rtrim($folder, '/');
119
+ $path = WINABSPATH . $folder . '/';
120
+ ?>
121
+ <script type="text/javascript">
122
+ <!--
123
+ jQuery(document).ready(function(){
124
+ var crunch_string = '<?php echo $crunch_string; ?>';
125
+ var bannerfolder = '<?php echo $path; ?>';
126
+ var crunch_list = crunch_string.split(',');
127
+ var parts = crunch_list.length;
128
+
129
+ function flag_crunch(){
130
+ if(crunch_list.length){
131
+ jQuery.post(
132
+ ajaxurl,
133
+ {
134
+ action: "flag_banner_crunch",
135
+ _wpnonce: "<?php echo wp_create_nonce( 'flag-ajax' ); ?>",
136
+ path: encodeURI(bannerfolder + crunch_list[0])
137
+ },
138
+ function(response){
139
+ crunch_list.shift();
140
+ var parts_done = parts - crunch_list.length;
141
+ jQuery(".flag_crunching .flag_progress .flag_complete").animate({width: parts_done * (100 / parts) + '%'}, 400);
142
+ jQuery(".flag_crunching").append(response);
143
+ flag_crunch();
144
+ }
145
+ );
146
+ } else{
147
+ var refpage = window.location.href;
148
+ jQuery(".flag_crunching .txt").html('<a href="' + refpage + '"><?php _e("Import folder is complete. The page reloads after 5 seconds.", "flag"); ?></a>');
149
+ //alert('<?php _e("Import folder complete. Refresh page.", "flag"); ?>');
150
+ setTimeout(function(){ window.location.href = window.location.href }, 5000);
151
  }
152
+ }
153
+
154
+ flag_crunch();
155
+ });
156
+ //-->
157
+ </script>
 
 
 
 
 
 
158
 
159
  <?php }
160
 
161
+ function flag_created_b_playlists(){
162
 
163
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
164
 
165
  $all_playlists = get_b_playlists();
166
  $total_all_playlists = count($all_playlists);
167
+ $flag_options = get_option('flag_options');
168
 
169
+ ?>
170
+ <div class="flag-wrap">
171
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
172
+ <table class="widefat flag-table" cellspacing="0">
173
  <thead>
174
  <tr>
175
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
176
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
177
+ <th scope="col"><?php _e('Quantity', 'flag'); ?></th>
178
+ <th scope="col"><?php _e('Shortcode', 'flag'); ?></th>
179
+ <th scope="col"><?php _e('Action', 'flag'); ?></th>
180
  </tr>
181
  </thead>
182
  <tbody>
183
+ <?php
184
+ if($all_playlists){
185
+ foreach((array) $all_playlists as $playlist_file => $playlist_data){
186
+ $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => - 1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
187
+ $class = (!isset($class) || $class == 'class="alternate"')? '' : 'class="alternate"';
188
+ $playlist_name = basename($playlist_file, '.xml');
189
+ if(count($query_m) != count($playlist_data['items'])){
190
+ flagSave_bPlaylist($playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name);
191
+ }
192
+ ?>
193
+ <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
194
+ <td>
195
+ <a href="<?php echo esc_url($filepath . '&playlist=' . $playlist_name . '&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>">
196
+ <?php echo esc_html($playlist_data['title']); ?>
197
+ </a>
198
+ </td>
199
+ <td><?php echo esc_html($playlist_data['description']);
200
+ echo '&nbsp;(' . __("player", "flag") . ': <strong>' . esc_html($playlist_data['skin']) . '</strong>)' ?></td>
201
+ <td><?php echo count($query_m); ?></td>
202
+ <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandbanner xml=<?php echo $playlist_name; ?>]"/></td>
203
+ <td>
204
+ <a href="<?php echo wp_nonce_url($filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?", 'flag') ?>');if(check==false) {return false;
205
+ }"><?php _e('Delete', 'flag'); ?></a>
206
+ </td>
207
+ </tr>
208
+ <?php
209
+ }
210
+ } else{
211
+ echo '<tr><td colspan="5" align="center"><strong>' . __('No playlists found', 'flag') . '</strong></td></tr>';
212
+ }
213
+ ?>
214
  </tbody>
215
  </table>
216
  </div>
217
 
218
+ <?php }
219
+
220
 
221
+ // *** show media list
222
+ function flag_banner_wp_media_lib($added = false){
223
  global $wpdb;
224
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
225
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
226
+ if($added !== false){
 
227
  $added = preg_replace('/[^\d,]+/', '', $added);
228
+ $filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
229
  $flag_options = get_option('flag_options');
230
+ $playlistPath = $flag_options['galleryPath'] . 'playlists/banner/' . sanitize_flagname($_GET['playlist']) . '.xml';
231
+ $playlist = get_b_playlist_data(ABSPATH . $playlistPath);
232
  $exclude = explode(',', $added);
233
  $exclude = array_filter($exclude, 'intval');
234
+ } else{
235
  $items_array_default = isset($_COOKIE['bannerboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['bannerboxplaylist_default']) : '';
236
  $exclude = explode(',', $items_array_default);
237
  $exclude = array_filter($exclude, 'intval');
238
  }
239
  if(isset($_GET['playlist'])){
240
  $playlist_cookie = sanitize_flagname($_GET['playlist']);
241
+ } else{
242
  $playlist_cookie = 'default';
243
  }
244
  $filepath = esc_url($filepath);
 
 
 
 
 
 
245
  ?>
246
+ <script type="text/javascript">
247
+ <!--
248
+ jQuery(document).ready(function(){
249
+ var storedData = getStorage('bannerboxplaylist_');
250
+ <?php if(isset($_POST['items'])){
251
+ ?>
252
+ storedData.set('<?php echo $playlist_cookie; ?>', '<?php echo preg_replace('/[^\d,]+/', '', $_POST['items']); ?>');
253
+ <?php } ?>
254
+ jQuery('.cb :checkbox').click(function(){
255
+ var cur, arr, del;
256
+ if(jQuery(this).is(':checked')){
257
+ cur = jQuery(this).val();
258
+ arr = jQuery('#items_array').val();
259
+ if(arr){ del = ','; } else{ del = ''; }
260
+ jQuery('#items_array').val(arr + del + cur);
261
+ jQuery(this).closest('tr').addClass('already-added');
262
+ } else{
263
+ cur = jQuery(this).val();
264
+ arr = jQuery('#items_array').val().split(',');
265
+ arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
266
+ jQuery('#items_array').val(arr);
267
+ jQuery(this).closest('tr').removeClass('already-added');
268
+ }
269
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
270
+ });
271
+ jQuery('.clear_selected').click(function(){
272
+ jQuery('#items_array').val('');
273
+ jQuery('.cb :checkbox').each(function(){
274
+ jQuery(this).prop('checked', false).closest('tr').removeClass('already-added');
275
+ });
276
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
 
 
 
 
 
277
  });
278
+ });
279
+ function getStorage(key_prefix){
280
+ return {
281
+ set: function(id, data){
282
+ document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
283
+ },
284
+ get: function(id, data){
285
+ var cookies = document.cookie, parsed = {};
286
+ cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value){
287
+ parsed[key] = decodeURIComponent(value);
288
+ });
289
+ return parsed[key_prefix + id];
290
+ }
291
+ };
292
  }
 
 
293
 
294
+ function checkAll(form){
295
+ for(i = 0, n = form.elements.length; i < n; i++){
296
+ if(form.elements[i].type == "checkbox"){
297
+ if(form.elements[i].name == "doaction[]"){
298
+ if(form.elements[i].checked == true){
299
+ form.elements[i].checked = false;
300
+ } else{
301
+ form.elements[i].checked = true;
302
+ }
303
+ jQuery(form.elements[i]).closest('tr').toggleClass('already-added');
304
+ }
305
+ }
306
+ }
307
+ var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
308
+ jQuery('#items_array').val(arr);
309
+ }
310
+ // this function check for a the number of selected images, sumbmit false when no one selected
311
+ function checkSelected(){
312
+ if(!jQuery('#items_array').val()){
313
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
314
+ return false;
315
+ }
316
+ var actionId = jQuery('#bulkaction').val();
317
+ switch(actionId){
318
+ case "new_playlist":
319
+ showDialog('new_playlist', 160);
320
+ return false;
321
+ break;
322
  }
323
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
 
325
+ function showDialog(windowId, height){
326
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
327
+ jQuery("#" + windowId + "_banid").val(jQuery('#items_array').val());
328
+ tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
329
+ }
330
+ //-->
331
+ </script>
332
+ <div class="flag-wrap">
333
+ <?php if($added === false){ ?>
334
+ <?php if(current_user_can('FlAG Import folder')){
335
+ $defaultpath = basename(WP_CONTENT_DIR) . '/';
336
+ ?>
337
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
338
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
339
+ <script type="text/javascript">
340
+ /* <![CDATA[ */
341
+ jQuery(function(){
342
+ jQuery("span.browsefiles").show().click(function(){
343
+ jQuery("#file_browser").fileTree({
344
+ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
345
+ root: jQuery("#bannerfolder").val()
346
+ }, function(file){
347
+ //var path = file.replace("<?php echo WINABSPATH; ?>", "");
348
+ jQuery("#bannerfolder").val(file);
349
+ });
350
 
351
+ jQuery("#file_browser").show("slide");
352
+ });
353
+ });
354
+ /* ]]> */
355
+ </script>
356
+
357
+ <!-- import folder -->
358
+ <div id="importfolder">
359
+ <h2><?php _e('Import banners from folder', 'flag'); ?></h2>
360
+
361
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
362
+ <?php wp_nonce_field('flag_addbanner'); ?>
363
+ <table class="form-table">
364
+ <tr valign="top">
365
+ <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
366
+ <td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e('Browse...', "flag"); ?></span>
367
+
368
+ <div id="file_browser"></div>
369
+ <br/>
370
+ <p><label><input type="checkbox" name="delete_files" value="delete"/> &nbsp;
371
+ <?php _e('delete files after import in WordPress Media Library', 'flag'); ?></label></p>
372
+ </td>
373
+ </tr>
374
+ </table>
375
+ <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
376
+ </form>
377
+ </div>
378
+ <?php } ?>
379
+ <?php } ?>
380
 
381
  <h2><?php _e('WordPress Image Library', 'flag'); ?></h2>
382
 
383
+ <?php
384
+ // look for pagination
385
+ if(!isset($_GET['paged']) || $_GET['paged'] < 1){
386
+ $_GET['paged'] = 1;
387
+ }
388
+
389
+ $_GET['paged'] = intval($_GET['paged']);
390
+ $objects_per_page = 25;
391
+ $start = ($_GET['paged'] - 1) * $objects_per_page;
392
+ $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` LIKE 'image/%' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
393
+ $bannerlist = get_posts($args = array(
394
+ 'numberposts' => $objects_per_page,
395
+ 'offset' => $start,
396
+ 'orderby' => 'ID',
397
+ 'order' => 'DESC',
398
+ 'post_type' => 'attachment',
399
+ 'post_mime_type' => array('image')
400
+ ));
401
+
402
+ // build pagination
403
+ $page_links = paginate_links(array(
404
+ 'base' => add_query_arg('paged', '%#%'),
405
+ 'format' => '',
406
+ 'prev_text' => __('&laquo;'),
407
+ 'next_text' => __('&raquo;'),
408
+ 'total' => ceil($img_total_count / $objects_per_page),
409
+ 'current' => intval($_GET['paged']),
410
+ 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))
411
+ ));
412
+ ?>
413
+ <div class="tablenav" style="overflow: hidden; height: auto;">
414
+ <?php if($added === false){ ?>
415
+ <div class="alignleft"><b><?php _e('Selected Media', 'flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>"/>
416
+ <span class="clear_selected button"><?php _e('Clear Selected', 'flag'); ?></span></div>
417
+ <?php } ?>
418
+ <div class="tablenav-pages"><?php $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $objects_per_page + 1), number_format_i18n(min($_GET['paged'] * $objects_per_page, $img_total_count)), number_format_i18n($img_total_count), $page_links);
419
+ echo $page_links_text; ?></div>
420
+ </div>
 
 
421
  <form id="bannerlib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
422
+ <?php wp_nonce_field('flag_update'); ?>
423
+ <input type="hidden" name="page" value="banner-box"/>
424
+
425
+ <div class="tablenav">
426
+
427
+ <div class="actions">
428
+ <?php if($added === false){ ?>
429
+ <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media', 'flag'); ?>"/>
430
+ <?php if(function_exists('json_encode')){ ?>
431
+ <select name="bulkaction" id="bulkaction">
432
+ <option value="no_action"><?php _e("No action", 'flag'); ?></option>
433
+ <option value="new_playlist"><?php _e("Create new playlist", 'flag'); ?></option>
434
+ </select>
435
+ <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply', 'flag'); ?>" onclick="if ( !checkSelected() ) {return false;
436
+ }"/>
437
+ <?php } ?>
438
+ <a href="<?php echo admin_url('media-new.php'); ?>" class="button"><?php _e('Upload Banner(s)', 'flag'); ?></a>
439
+ <input type="hidden" id="items_array" name="items_array" value=""/>
440
+ <?php } else{ ?>
441
+ <input type="hidden" name="mode" value="save"/>
442
+ <input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>"/>
443
+ <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>"/>
444
+ <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
445
+ <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
446
+ <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
447
+ <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist', 'flag'); ?>"/>
448
+ <?php } ?>
449
+ </div>
450
+
451
  </div>
452
+ <table class="widefat flag-table" cellspacing="0">
453
+ <thead>
454
+ <tr>
455
+ <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
456
+ <th class="id" width="64" scope="col">
457
+ <div><?php _e('ID', 'flag'); ?></div>
458
+ </th>
459
+ <th class="thumb" width="110" scope="col">
460
+ <div><?php _e('Thumbnail', 'flag'); ?></div>
461
+ </th>
462
+ <th class="title_filename" scope="col">
463
+ <div><?php _e('Filename / Title / Link', 'flag'); ?></div>
464
+ </th>
465
+ <th class="description" scope="col">
466
+ <div><?php _e('Description', 'flag'); ?></div>
467
+ </th>
468
+ </tr>
469
+ </thead>
470
+ <tfoot>
471
+ <tr>
472
+ <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
473
+ <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
474
+ <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
475
+ <th class="title_filename" scope="col"><?php _e('Filename / Title / Link', 'flag'); ?></th>
476
+ <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
477
+ </tr>
478
+ </tfoot>
479
+ <tbody>
480
+ <?php
481
+ $uploads = wp_upload_dir();
482
+ $flag_options = get_option('flag_options');
483
+ if($bannerlist){
484
+ foreach($bannerlist as $ban){
485
+ $list[] = $ban->ID;
486
+ }
487
+ $class = 'alternate';
488
+ foreach($bannerlist as $ban){
489
+ $class = (empty($class))? 'alternate' : '';
490
+ $ex = $checked = '';
491
+ if(($added !== false || !empty($items_array_default)) && in_array($ban->ID, $exclude)){
492
+ $class .= ' already-added';
493
+ $ex = ' title="' . __("Already Added", "flag") . '"';
494
+ $checked = ' checked="checked"';
495
+ }
496
+ $thumb = get_post_meta($ban->ID, 'thumbnail', true);
497
+ $link = get_post_meta($ban->ID, 'link', true);
498
+ if(empty($thumb)){
499
+ $thumb = wp_get_attachment_thumb_url($ban->ID);
500
+ }
501
+ $url = wp_get_attachment_url($ban->ID);
502
+ ?>
503
+ <tr id="ban-<?php echo $ban->ID; ?>" class="<?php echo $class; ?>"<?php echo $ex; ?>>
504
+ <td class="cb"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $ban->ID; ?>"/></td>
505
+ <td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $ban->ID; ?></p></td>
506
+ <td class="thumb">
507
+ <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="100" height="100" alt=""/></a>
508
+ </td>
509
+ <td class="title_filename">
510
+ <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br/>
511
+ <textarea title="Title" name="item_a[<?php echo $ban->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($ban->post_title)); ?></textarea><br/>
512
+ <?php _e('URL', 'flag'); ?>: <input id="banlink-<?php echo $ban->ID; ?>" name="item_a[<?php echo $ban->ID; ?>][link]" style="width:50%;" type="text" value="<?php echo esc_url($link); ?>"/><br/>
513
+ </td>
514
+ <td class="description">
515
+ <textarea name="item_a[<?php echo $ban->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php echo esc_html(stripslashes($ban->post_content)); ?></textarea>
516
+ </td>
517
+ </tr>
518
+ <?php
519
+ }
520
+ } else{
521
+ echo '<tr><td colspan="5" align="center"><strong>' . __('No images in WordPress Media Library.', 'flag') . '</strong></td></tr>';
522
+ }
523
+ ?>
524
+ </tbody>
525
+ </table>
526
  </form>
527
  </div>
528
 
529
  <!-- #new_playlist -->
530
+ <div id="new_playlist" style="display: none;">
531
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
532
+ <?php wp_nonce_field('flag_update'); ?>
533
+ <input type="hidden" id="new_playlist_banid" name="items_array" value=""/>
534
+ <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
535
+ <input type="hidden" name="mode" value="save"/>
536
+ <input type="hidden" name="page" value="banner-box"/>
537
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
538
+ <tr valign="top">
539
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title', 'flag'); ?></th>
540
+ <td><input type="text" class="alignleft" name="playlist_title" value=""/>
541
+
542
+ <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
543
+ <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
544
+ <?php require_once(dirname(__FILE__) . '/get_skin.php');
545
+ $all_skins = get_skins($skin_folder = '', $type = 'b');
546
+ if(count($all_skins)){
547
+ foreach((array) $all_skins as $skin_file => $skin_data){
548
+ echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
549
+ }
550
+ } else{
551
+ echo '<option value="rotator_default">' . __("No Skins", "flag") . '</option>';
552
+ }
553
+ ?>
554
+ </select>
555
+ </div>
556
+ </td>
557
+ </tr>
558
+ <tr valign="top">
559
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description', 'flag'); ?></th>
560
+ <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
561
+ </tr>
562
+ <tr>
563
+ <td>&nbsp;</td>
564
+ <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
565
+ &nbsp; &nbsp; &nbsp;
566
+ <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>"/>
567
+ </td>
568
+ </tr>
569
+ </table>
570
  </form>
571
  </div>
572
+ <!-- /#new_playlist -->
573
  <?php }
admin/banner-sort.php CHANGED
@@ -14,7 +14,7 @@ function flag_b_playlist_order($playlist = 'deprecated'){
14
  ?>
15
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
16
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
17
- <div class="wrap">
18
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
19
 
20
  <div class="alignright tablenav" style="margin-bottom: -36px;">
@@ -59,22 +59,22 @@ jQuery(document).ready(function($) {
59
  });
60
  /*]]>*/
61
  </script>
62
- <table id="flag-listitems" class="widefat fixed" cellspacing="0" >
63
 
64
  <thead>
65
  <tr>
66
  <th class="header" width="54"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
67
- <th width="50"><div><?php _e('Thumb', 'flag'); ?></div></th>
68
  <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
69
  <th class="header"><p><?php _e('Title', 'flag'); ?></p></th>
70
  </tr>
71
  </thead>
72
  <tfoot>
73
  <tr>
74
- <th><?php _e('ID', 'flag'); ?></th>
75
- <th><?php _e('Thumb', 'flag'); ?></th>
76
- <th><?php _e('Filename', 'flag'); ?></th>
77
- <th><?php _e('Title', 'flag'); ?></th>
78
  </tr>
79
  </tfoot>
80
  <tbody id="listitems">
@@ -94,7 +94,7 @@ if(count($items_a)) {
94
  ?>
95
  <tr id="$ban-<?php echo $ban->ID; ?>" class="<?php echo $alternate; ?> iedit" valign="top">
96
  <td scope="row"><input type="hidden" name="item_a[<?php echo $ban->ID; ?>][ID]" value="<?php echo $ban->ID; ?>" /><strong><?php echo $ban->ID; ?></strong></td>
97
- <td width="50"><a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="40" height="40" alt="" /></a></td>
98
  <td><?php echo basename($url); ?></td>
99
  <td><?php echo esc_html(stripslashes($ban->post_title)); ?></td>
100
  </tr>
14
  ?>
15
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
16
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
17
+ <div class="flag-wrap">
18
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
19
 
20
  <div class="alignright tablenav" style="margin-bottom: -36px;">
59
  });
60
  /*]]>*/
61
  </script>
62
+ <table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >
63
 
64
  <thead>
65
  <tr>
66
  <th class="header" width="54"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
67
+ <th width="50"><p><?php _e('Thumb', 'flag'); ?></p></th>
68
  <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
69
  <th class="header"><p><?php _e('Title', 'flag'); ?></p></th>
70
  </tr>
71
  </thead>
72
  <tfoot>
73
  <tr>
74
+ <th><p><?php _e('ID', 'flag'); ?></p></th>
75
+ <th><p><?php _e('Thumb', 'flag'); ?></p></th>
76
+ <th><p><?php _e('Filename', 'flag'); ?></p></th>
77
+ <th><p><?php _e('Title', 'flag'); ?></p></th>
78
  </tr>
79
  </tfoot>
80
  <tbody id="listitems">
94
  ?>
95
  <tr id="$ban-<?php echo $ban->ID; ?>" class="<?php echo $alternate; ?> iedit" valign="top">
96
  <td scope="row"><input type="hidden" name="item_a[<?php echo $ban->ID; ?>][ID]" value="<?php echo $ban->ID; ?>" /><strong><?php echo $ban->ID; ?></strong></td>
97
+ <td width="100"><a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo $url; ?>"><img id="thumb-<?php echo $ban->ID; ?>" src="<?php echo $thumb; ?>" width="80" style="height:auto" alt="" /></a></td>
98
  <td><?php echo basename($url); ?></td>
99
  <td><?php echo esc_html(stripslashes($ban->post_title)); ?></td>
100
  </tr>
admin/css/flagadmin.css CHANGED
@@ -24,6 +24,8 @@
24
 
25
 
26
  /* SETTINGS FOR Overview Gallery */
 
 
27
  .has-sidebar {
28
  clear:left;
29
  float:left;
@@ -60,6 +62,12 @@
60
  #photogallerycreator .theme .txt > *:first-child { display: block; margin: 0 0 -20px; padding: 0; text-align: center; position: relative; top: -204px; }
61
 
62
  /* SETTING FOR UPLOAD PAGE */
 
 
 
 
 
 
63
  .useflashupload {float:left;}
64
  .swfupload {
65
  position:absolute;
@@ -74,9 +82,9 @@
74
  .flag-options th {
75
  width:30%;
76
  }
 
77
 
78
  /* SETTINGS FOR MANAGE TABLE */
79
-
80
  .flag_draft, .alt.flag_draft {background-color: #FFEBE8;}
81
 
82
  p#flag-inlinebutton {
@@ -138,11 +146,10 @@ p#flag-inlinebutton {
138
  width: 4em; text-align: center;
139
  }
140
 
141
- .flagform .widefat thead th { padding: 7px 0 8px; }
142
- .flagform .widefat tfoot th { padding: 7px 0 8px; }
143
- .flagform .widefat thead th > div, .flagform .widefat thead th > p { margin-left: 7px; padding: 0; }
144
- .flagform .widefat thead th.cb { width: 54px; text-align: center; }
145
- .flagform .widefat tfoot th.cb { text-align: center; }
146
 
147
  #flag-listmusic tbody td { height: 50px; }
148
 
@@ -162,8 +169,8 @@ p#flag-inlinebutton {
162
  .flag-ajax-post { cursor: pointer; text-decoration: underline; }
163
  .flag-ajax-post:hover { color: #ff0000; }
164
 
165
- .all_galleries { float: left; white-space: nowrap; margin: 7px 0 0px 50px; max-height: 550px; overflow: auto; padding-right: 20px; }
166
- .all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; }
167
  .all_galleries .acat .drop { display: none; }
168
  .all_galleries .acat:hover { background-color: #FFFFEE; }
169
 
@@ -267,4 +274,7 @@ div#license div p { font-size: 13px; }
267
  .highlight_new { background-color: #E4F2FD; color: #000000; font-weight: bold; }
268
  .success { background-color: #CCFFCC; border: 1px solid darkgreen; border-radius: 3px; margin: 5px 15px; padding: 3px 7px; }
269
 
270
- #gmUpload table td { font-size: 11px !important; }
 
 
 
24
 
25
 
26
  /* SETTINGS FOR Overview Gallery */
27
+ .flag-wrap {margin:20px 20px 0 2px}
28
+ .flag-wrap h2.overview-title {margin:0}
29
  .has-sidebar {
30
  clear:left;
31
  float:left;
62
  #photogallerycreator .theme .txt > *:first-child { display: block; margin: 0 0 -20px; padding: 0; text-align: center; position: relative; top: -204px; }
63
 
64
  /* SETTING FOR UPLOAD PAGE */
65
+ .flag-form-table {
66
+ border-collapse: collapse;
67
+ clear: both;
68
+ margin-top: 0.5em;
69
+ width: 100%;
70
+ }
71
  .useflashupload {float:left;}
72
  .swfupload {
73
  position:absolute;
82
  .flag-options th {
83
  width:30%;
84
  }
85
+ .cptab h3 {margin-top:0; padding-top:20px;}
86
 
87
  /* SETTINGS FOR MANAGE TABLE */
 
88
  .flag_draft, .alt.flag_draft {background-color: #FFEBE8;}
89
 
90
  p#flag-inlinebutton {
146
  width: 4em; text-align: center;
147
  }
148
 
149
+ .flag-table td,
150
+ .flag-table th {padding:4px 7px; text-align:left;}
151
+ .flag-table th {font-weight:bold; padding:8px 7px;}
152
+ .flag-table th p {margin:0;}
 
153
 
154
  #flag-listmusic tbody td { height: 50px; }
155
 
169
  .flag-ajax-post { cursor: pointer; text-decoration: underline; }
170
  .flag-ajax-post:hover { color: #ff0000; }
171
 
172
+ .all_galleries { float: left; white-space: nowrap; margin: 7px 0 0px 50px; max-height: 550px; overflow: auto; padding-right: 20px; min-width:30%; }
173
+ .all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; min-width:15%; }
174
  .all_galleries .acat .drop { display: none; }
175
  .all_galleries .acat:hover { background-color: #FFFFEE; }
176
 
274
  .highlight_new { background-color: #E4F2FD; color: #000000; font-weight: bold; }
275
  .success { background-color: #CCFFCC; border: 1px solid darkgreen; border-radius: 3px; margin: 5px 15px; padding: 3px 7px; }
276
 
277
+ #gmUpload { padding-top:10px }
278
+ #gmUpload table td { font-size: 11px !important; }
279
+
280
+ .already-added {background-color:#DDFFBB;}
admin/css/tabs.css CHANGED
@@ -18,11 +18,11 @@
18
  display: none;
19
  padding:0 15px;
20
  }
21
- .cptab h2 {margin-top:-85px; margin-bottom:65px;}
22
 
23
  #tabs{
24
  display: block;
25
- background:#F1F1F1 none repeat scroll 0%;
26
  font-size:14px;
27
  overflow:hidden;
28
 
18
  display: none;
19
  padding:0 15px;
20
  }
21
+ .cptab h2 {margin-top:-65px; margin-bottom:45px;}
22
 
23
  #tabs{
24
  display: block;
25
+ background:#dedede none repeat scroll 0%;
26
  font-size:14px;
27
  overflow:hidden;
28
 
admin/flagframe-tool.php CHANGED
@@ -140,9 +140,8 @@ function fb_url(galleries,skin,h,l) {
140
  jQuery('#fb1_url0').val(url+galleries+skin+h+l);
141
  }
142
  /*]]>*/</script>
143
- <div class="wrap">
144
  <h2><?php _e('Flagallery iFrame', 'flag'); ?></h2>
145
- <br /><br />
146
  <form id="flagframe_copy" name="flagframe_copy" method="POST" class="alignright">
147
  <p>Optional: &nbsp; <input type="submit" name="copy_file" class="button-primary" value="<?php _e('Copy flagframe.php file to root directory', 'flag'); ?>" /><br />
148
  (makes iframe url shorter)</p>
140
  jQuery('#fb1_url0').val(url+galleries+skin+h+l);
141
  }
142
  /*]]>*/</script>
143
+ <div class="flag-wrap">
144
  <h2><?php _e('Flagallery iFrame', 'flag'); ?></h2>
 
145
  <form id="flagframe_copy" name="flagframe_copy" method="POST" class="alignright">
146
  <p>Optional: &nbsp; <input type="submit" name="copy_file" class="button-primary" value="<?php _e('Copy flagframe.php file to root directory', 'flag'); ?>" /><br />
147
  (makes iframe url shorter)</p>
admin/js/selectize/selectize.css ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * selectize.bootstrap3.css (v0.8.5) - Bootstrap 3 Theme
3
+ * Copyright (c) 2013 Brian Reavis & contributors
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
+ * file except in compliance with the License. You may obtain a copy of the License at:
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ * ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ *
14
+ * @author Brian Reavis <brian@thirdroute.com>
15
+ */
16
+ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
17
+ visibility: visible !important;
18
+ background: #f2f2f2 !important;
19
+ background: rgba(0, 0, 0, 0.06) !important;
20
+ border: 0 none !important;
21
+ -webkit-box-shadow: inset 0 0 12px 4px #ffffff;
22
+ box-shadow: inset 0 0 12px 4px #ffffff;
23
+ }
24
+ .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
25
+ content: '!';
26
+ visibility: hidden;
27
+ }
28
+ .selectize-control.plugin-drag_drop .ui-sortable-helper {
29
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
30
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
31
+ }
32
+ .selectize-dropdown-header {
33
+ position: relative;
34
+ padding: 3px 12px;
35
+ border-bottom: 1px solid #d0d0d0;
36
+ background: #f8f8f8;
37
+ -webkit-border-radius: 4px 4px 0 0;
38
+ -moz-border-radius: 4px 4px 0 0;
39
+ border-radius: 4px 4px 0 0;
40
+ }
41
+ .selectize-dropdown-header-close {
42
+ position: absolute;
43
+ right: 12px;
44
+ top: 50%;
45
+ color: #333333;
46
+ opacity: 0.4;
47
+ margin-top: -12px;
48
+ line-height: 20px;
49
+ font-size: 20px !important;
50
+ }
51
+ .selectize-dropdown-header-close:hover {
52
+ color: #000000;
53
+ }
54
+ .selectize-dropdown.plugin-optgroup_columns .optgroup {
55
+ border-right: 1px solid #f2f2f2;
56
+ border-top: 0 none;
57
+ float: left;
58
+ -webkit-box-sizing: border-box;
59
+ -moz-box-sizing: border-box;
60
+ box-sizing: border-box;
61
+ }
62
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
63
+ border-right: 0 none;
64
+ }
65
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:before {
66
+ display: none;
67
+ }
68
+ .selectize-dropdown.plugin-optgroup_columns .optgroup-header {
69
+ border-top: 0 none;
70
+ }
71
+ .selectize-control.plugin-remove_button [data-value] {
72
+ position: relative;
73
+ padding-right: 24px !important;
74
+ }
75
+ .selectize-control.plugin-remove_button [data-value] .remove {
76
+ position: absolute;
77
+ top: 0;
78
+ right: 0;
79
+ bottom: 0;
80
+ width: 17px;
81
+ text-align: center;
82
+ font-weight: bold;
83
+ font-size: 12px;
84
+ color: inherit;
85
+ text-decoration: none;
86
+ vertical-align: middle;
87
+ display: inline-block;
88
+ padding: 1px 0 0 0;
89
+ border-left: 1px solid rgba(0, 0, 0, 0);
90
+ -webkit-border-radius: 0 2px 2px 0;
91
+ -moz-border-radius: 0 2px 2px 0;
92
+ border-radius: 0 2px 2px 0;
93
+ -webkit-box-sizing: border-box;
94
+ -moz-box-sizing: border-box;
95
+ box-sizing: border-box;
96
+ }
97
+ .selectize-control.plugin-remove_button [data-value] .remove:hover {
98
+ background: rgba(0, 0, 0, 0.05);
99
+ }
100
+ .selectize-control.plugin-remove_button [data-value].active .remove {
101
+ border-left-color: rgba(0, 0, 0, 0);
102
+ }
103
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
104
+ background: none;
105
+ }
106
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove {
107
+ border-left-color: rgba(77, 77, 77, 0);
108
+ }
109
+ .selectize-control {
110
+ position: relative;
111
+ }
112
+ .selectize-dropdown,
113
+ .selectize-input,
114
+ .selectize-input input {
115
+ color: #333333;
116
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
117
+ font-size: 14px;
118
+ line-height: 20px;
119
+ -webkit-font-smoothing: inherit;
120
+ }
121
+ .selectize-input,
122
+ .selectize-control.single .selectize-input.input-active {
123
+ background: #ffffff;
124
+ cursor: text;
125
+ display: inline-block;
126
+ }
127
+ .selectize-input {
128
+ border: 1px solid #cccccc;
129
+ padding: 6px 12px;
130
+ display: inline-block;
131
+ width: 100%;
132
+ overflow: hidden;
133
+ position: relative;
134
+ z-index: 1;
135
+ -webkit-box-sizing: border-box;
136
+ -moz-box-sizing: border-box;
137
+ box-sizing: border-box;
138
+ -webkit-box-shadow: none;
139
+ box-shadow: none;
140
+ -webkit-border-radius: 4px;
141
+ -moz-border-radius: 4px;
142
+ border-radius: 4px;
143
+ }
144
+ .selectize-control.multi .selectize-input.has-items {
145
+ padding: 5px 12px 2px;
146
+ }
147
+ .selectize-input.full {
148
+ background-color: #ffffff;
149
+ }
150
+ .selectize-input.disabled,
151
+ .selectize-input.disabled * {
152
+ cursor: default !important;
153
+ }
154
+ .selectize-input.focus {
155
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
156
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
157
+ }
158
+ .selectize-input.dropdown-active {
159
+ -webkit-border-radius: 4px 4px 0 0;
160
+ -moz-border-radius: 4px 4px 0 0;
161
+ border-radius: 4px 4px 0 0;
162
+ }
163
+ .selectize-input > * {
164
+ vertical-align: baseline;
165
+ display: -moz-inline-stack;
166
+ display: inline-block;
167
+ zoom: 1;
168
+ *display: inline;
169
+ }
170
+ .selectize-control.multi .selectize-input > div {
171
+ cursor: pointer;
172
+ margin: 0 3px 3px 0;
173
+ padding: 1px 3px;
174
+ background:#dddddd;
175
+ color: #333333;
176
+ border: 0 solid rgba(0, 0, 0, 0);
177
+ }
178
+ .selectize-control.multi .selectize-input > div.active {
179
+ background: #428bca;
180
+ color: #ffffff;
181
+ border: 0 solid rgba(0, 0, 0, 0);
182
+ }
183
+ .selectize-control.multi .selectize-input.disabled > div,
184
+ .selectize-control.multi .selectize-input.disabled > div.active {
185
+ color: #808080;
186
+ background: #ffffff;
187
+ border: 0 solid rgba(77, 77, 77, 0);
188
+ }
189
+ .selectize-input > input {
190
+ padding: 0 !important;
191
+ min-height: 0 !important;
192
+ max-height: none !important;
193
+ max-width: 100% !important;
194
+ margin: 0 !important;
195
+ text-indent: 0 !important;
196
+ border: 0 none !important;
197
+ background: none !important;
198
+ line-height: inherit !important;
199
+ -webkit-user-select: auto !important;
200
+ -webkit-box-shadow: none !important;
201
+ box-shadow: none !important;
202
+ }
203
+ .selectize-input > input:focus {
204
+ outline: none !important;
205
+ }
206
+ .selectize-input::after {
207
+ content: ' ';
208
+ display: block;
209
+ clear: left;
210
+ }
211
+ .selectize-input.dropdown-active::before {
212
+ content: ' ';
213
+ display: block;
214
+ position: absolute;
215
+ background: #ffffff;
216
+ height: 1px;
217
+ bottom: 0;
218
+ left: 0;
219
+ right: 0;
220
+ }
221
+ .selectize-dropdown {
222
+ position: absolute;
223
+ z-index: 10;
224
+ border: 1px solid #cccccc;
225
+ background: #ffffff;
226
+ margin: -1px 0 0 0;
227
+ border-top: 0 none;
228
+ -webkit-box-sizing: border-box;
229
+ -moz-box-sizing: border-box;
230
+ box-sizing: border-box;
231
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
232
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
233
+ -webkit-border-radius: 0 0 4px 4px;
234
+ -moz-border-radius: 0 0 4px 4px;
235
+ border-radius: 0 0 4px 4px;
236
+ }
237
+ .selectize-dropdown [data-selectable] {
238
+ cursor: pointer;
239
+ overflow: hidden;
240
+ }
241
+ .selectize-dropdown [data-selectable] .highlight {
242
+ background: rgba(255, 237, 40, 0.4);
243
+ -webkit-border-radius: 1px;
244
+ -moz-border-radius: 1px;
245
+ border-radius: 1px;
246
+ }
247
+ .selectize-dropdown [data-selectable],
248
+ .selectize-dropdown .optgroup-header {
249
+ padding: 3px 12px;
250
+ }
251
+ .selectize-dropdown .optgroup:first-child .optgroup-header {
252
+ border-top: 0 none;
253
+ }
254
+ .selectize-dropdown .optgroup-header {
255
+ color: #999999;
256
+ background: #ffffff;
257
+ cursor: default;
258
+ }
259
+ .selectize-dropdown .active {
260
+ background-color:#428bca;
261
+ color: #ffffff;
262
+ }
263
+ .selectize-dropdown .active.create {
264
+ background-color:#f5f5f5;
265
+ color: #262626;
266
+ }
267
+ .selectize-dropdown .create {
268
+ background-color:#f5f5f5;
269
+ color: rgba(51, 51, 51, 0.5);
270
+ }
271
+ .selectize-dropdown-content {
272
+ overflow-y: auto;
273
+ overflow-x: hidden;
274
+ max-height: 200px;
275
+ }
276
+ .selectize-control.single .selectize-input,
277
+ .selectize-control.single .selectize-input input {
278
+ cursor: pointer;
279
+ }
280
+ .selectize-control.single .selectize-input.input-active,
281
+ .selectize-control.single .selectize-input.input-active input {
282
+ cursor: text;
283
+ }
284
+ .selectize-control.single .selectize-input:after {
285
+ content: ' ';
286
+ display: block;
287
+ position: absolute;
288
+ top: 50%;
289
+ right: 17px;
290
+ margin-top: -3px;
291
+ width: 0;
292
+ height: 0;
293
+ border-style: solid;
294
+ border-width: 5px 5px 0 5px;
295
+ border-color: #333333 transparent transparent transparent;
296
+ }
297
+ .selectize-control.single .selectize-input.dropdown-active:after {
298
+ margin-top: -4px;
299
+ border-width: 0 5px 5px 5px;
300
+ border-color: transparent transparent #333333 transparent;
301
+ }
302
+ .selectize-control.rtl.single .selectize-input:after {
303
+ left: 17px;
304
+ right: auto;
305
+ }
306
+ .selectize-control.rtl .selectize-input > input {
307
+ margin: 0 4px 0 -2px !important;
308
+ }
309
+ .selectize-control .selectize-input.disabled {
310
+ opacity: 0.5;
311
+ background-color: #ffffff;
312
+ }
313
+ .selectize-dropdown,
314
+ .selectize-dropdown.form-control {
315
+ height: auto;
316
+ padding: 0;
317
+ margin: 2px 0 0 0;
318
+ z-index: 1000;
319
+ background: #ffffff;
320
+ border: 1px solid #cccccc;
321
+ border: 1px solid rgba(0, 0, 0, 0.15);
322
+ -webkit-border-radius: 4px;
323
+ -moz-border-radius: 4px;
324
+ border-radius: 4px;
325
+ -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
326
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
327
+ }
328
+ .selectize-dropdown .optgroup-header {
329
+ font-size: 12px;
330
+ line-height: 1.42857143;
331
+ }
332
+ .selectize-dropdown .optgroup:first-child:before {
333
+ display: none;
334
+ }
335
+ .selectize-dropdown .optgroup:before {
336
+ content: ' ';
337
+ display: block;
338
+ height: 1px;
339
+ margin: 9px 0;
340
+ overflow: hidden;
341
+ background-color: #e5e5e5;
342
+ margin-left: -12px;
343
+ margin-right: -12px;
344
+ }
345
+ .selectize-dropdown-content {
346
+ padding: 5px 0;
347
+ }
348
+ .selectize-dropdown-header {
349
+ padding: 6px 12px;
350
+ }
351
+ .selectize-input {
352
+ min-height: 34px;
353
+ }
354
+ .selectize-input.dropdown-active {
355
+ -webkit-border-radius: 4px;
356
+ -moz-border-radius: 4px;
357
+ border-radius: 4px;
358
+ }
359
+ .selectize-input.dropdown-active::before {
360
+ display: none;
361
+ }
362
+ .selectize-input.focus {
363
+ border-color: #66afe9;
364
+ outline: 0;
365
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
366
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);
367
+ }
368
+ .selectize-control.multi .selectize-input.has-items {
369
+ padding-left: 9px;
370
+ padding-right: 9px;
371
+ }
372
+ .selectize-control.multi .selectize-input > div {
373
+ -webkit-border-radius: 3px;
374
+ -moz-border-radius: 3px;
375
+ border-radius: 3px;
376
+ }
377
+ .form-control.selectize-control {
378
+ padding: 0;
379
+ height: auto;
380
+ border: none;
381
+ background: none;
382
+ -webkit-box-shadow: none;
383
+ box-shadow: none;
384
+ -webkit-border-radius: 0;
385
+ -moz-border-radius: 0;
386
+ border-radius: 0;
387
+ }
admin/js/selectize/selectize.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! selectize.js - v0.8.5 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
2
+ !function(a,b){"function"==typeof define&&define.amd?define("sifter",b):"object"==typeof exports?module.exports=b():a.Sifter=b()}(this,function(){var a=function(a,b){this.items=a,this.settings=b||{diacritics:!0}};a.prototype.tokenize=function(a){if(a=d(String(a||"").toLowerCase()),!a||!a.length)return[];var b,c,f,h,i=[],j=a.split(/ +/);for(b=0,c=j.length;c>b;b++){if(f=e(j[b]),this.settings.diacritics)for(h in g)g.hasOwnProperty(h)&&(f=f.replace(new RegExp(h,"g"),g[h]));i.push({string:j[b],regex:new RegExp(f,"i")})}return i},a.prototype.iterator=function(a,b){var c;c=f(a)?Array.prototype.forEach||function(a){for(var b=0,c=this.length;c>b;b++)a(this[b],b,this)}:function(a){for(var b in this)this.hasOwnProperty(b)&&a(this[b],b,this)},c.apply(a,[b])},a.prototype.getScoreFunction=function(a,b){var c,d,e,f;c=this,a=c.prepareSearch(a,b),e=a.tokens,d=a.options.fields,f=e.length;var g=function(a,b){var c,d;return a?(a=String(a||""),d=a.search(b.regex),-1===d?0:(c=b.string.length/a.length,0===d&&(c+=.5),c)):0},h=function(){var a=d.length;return a?1===a?function(a,b){return g(b[d[0]],a)}:function(b,c){for(var e=0,f=0;a>e;e++)f+=g(c[d[e]],b);return f/a}:function(){return 0}}();return f?1===f?function(a){return h(e[0],a)}:"and"===a.options.conjunction?function(a){for(var b,c=0,d=0;f>c;c++){if(b=h(e[c],a),0>=b)return 0;d+=b}return d/f}:function(a){for(var b=0,c=0;f>b;b++)c+=h(e[b],a);return c/f}:function(){return 0}},a.prototype.getSortFunction=function(a,c){var d,e,f,g,h,i,j,k,l,m,n;if(f=this,a=f.prepareSearch(a,c),n=!a.query&&c.sort_empty||c.sort,l=function(a,b){return"$score"===a?b.score:f.items[b.id][a]},h=[],n)for(d=0,e=n.length;e>d;d++)(a.query||"$score"!==n[d].field)&&h.push(n[d]);if(a.query){for(m=!0,d=0,e=h.length;e>d;d++)if("$score"===h[d].field){m=!1;break}m&&h.unshift({field:"$score",direction:"desc"})}else for(d=0,e=h.length;e>d;d++)if("$score"===h[d].field){h.splice(d,1);break}for(k=[],d=0,e=h.length;e>d;d++)k.push("desc"===h[d].direction?-1:1);return i=h.length,i?1===i?(g=h[0].field,j=k[0],function(a,c){return j*b(l(g,a),l(g,c))}):function(a,c){var d,e,f;for(d=0;i>d;d++)if(f=h[d].field,e=k[d]*b(l(f,a),l(f,c)))return e;return 0}:null},a.prototype.prepareSearch=function(a,b){if("object"==typeof a)return a;b=c({},b);var d=b.fields,e=b.sort,g=b.sort_empty;return d&&!f(d)&&(b.fields=[d]),e&&!f(e)&&(b.sort=[e]),g&&!f(g)&&(b.sort_empty=[g]),{options:b,query:String(a||"").toLowerCase(),tokens:this.tokenize(a),total:0,items:[]}},a.prototype.search=function(a,b){var c,d,e,f,g=this;return d=this.prepareSearch(a,b),b=d.options,a=d.query,f=b.score||g.getScoreFunction(d),a.length?g.iterator(g.items,function(a,e){c=f(a),(b.filter===!1||c>0)&&d.items.push({score:c,id:e})}):g.iterator(g.items,function(a,b){d.items.push({score:1,id:b})}),e=g.getSortFunction(d,b),e&&d.items.sort(e),d.total=d.items.length,"number"==typeof b.limit&&(d.items=d.items.slice(0,b.limit)),d};var b=function(a,b){return"number"==typeof a&&"number"==typeof b?a>b?1:b>a?-1:0:(a=String(a||"").toLowerCase(),b=String(b||"").toLowerCase(),a>b?1:b>a?-1:0)},c=function(a){var b,c,d,e;for(b=1,c=arguments.length;c>b;b++)if(e=arguments[b])for(d in e)e.hasOwnProperty(d)&&(a[d]=e[d]);return a},d=function(a){return(a+"").replace(/^\s+|\s+$|/g,"")},e=function(a){return(a+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},f=Array.isArray||$&&$.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},g={a:"[aÀÁÂÃÄÅàáâãäå]",c:"[cÇçćĆčČ]",d:"[dđĐ]",e:"[eÈÉÊËèéêë]",i:"[iÌÍÎÏìíîï]",n:"[nÑñ]",o:"[oÒÓÔÕÕÖØòóôõöø]",s:"[sŠš]",u:"[uÙÚÛÜùúûü]",y:"[yŸÿý]",z:"[zŽž]"};return a}),function(a,b){"function"==typeof define&&define.amd?define("microplugin",b):"object"==typeof exports?module.exports=b():a.MicroPlugin=b()}(this,function(){var a={};a.mixin=function(a){a.plugins={},a.prototype.initializePlugins=function(a){var c,d,e,f=this,g=[];if(f.plugins={names:[],settings:{},requested:{},loaded:{}},b.isArray(a))for(c=0,d=a.length;d>c;c++)"string"==typeof a[c]?g.push(a[c]):(f.plugins.settings[a[c].name]=a[c].options,g.push(a[c].name));else if(a)for(e in a)a.hasOwnProperty(e)&&(f.plugins.settings[e]=a[e],g.push(e));for(;g.length;)f.require(g.shift())},a.prototype.loadPlugin=function(b){var c=this,d=c.plugins,e=a.plugins[b];if(!a.plugins.hasOwnProperty(b))throw new Error('Unable to find "'+b+'" plugin');d.requested[b]=!0,d.loaded[b]=e.fn.apply(c,[c.plugins.settings[b]||{}]),d.names.push(b)},a.prototype.require=function(a){var b=this,c=b.plugins;if(!b.plugins.loaded.hasOwnProperty(a)){if(c.requested[a])throw new Error('Plugin has circular dependency ("'+a+'")');b.loadPlugin(a)}return c.loaded[a]},a.define=function(b,c){a.plugins[b]={name:b,fn:c}}};var b={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}};return a}),function(a,b){"function"==typeof define&&define.amd?define("selectize",["jquery","sifter","microplugin"],b):a.Selectize=b(a.jQuery,a.Sifter,a.MicroPlugin)}(this,function(a,b,c){"use strict";var d=function(a,b){if("string"!=typeof b||b.length){var c="string"==typeof b?new RegExp(b,"i"):b,d=function(a){var b=0;if(3===a.nodeType){var e=a.data.search(c);if(e>=0&&a.data.length>0){var f=a.data.match(c),g=document.createElement("span");g.className="highlight";var h=a.splitText(e);h.splitText(f[0].length);var i=h.cloneNode(!0);g.appendChild(i),h.parentNode.replaceChild(g,h),b=1}}else if(1===a.nodeType&&a.childNodes&&!/(script|style)/i.test(a.tagName))for(var j=0;j<a.childNodes.length;++j)j+=d(a.childNodes[j]);return b};return a.each(function(){d(this)})}},e=function(){};e.prototype={on:function(a,b){this._events=this._events||{},this._events[a]=this._events[a]||[],this._events[a].push(b)},off:function(a,b){var c=arguments.length;return 0===c?delete this._events:1===c?delete this._events[a]:(this._events=this._events||{},a in this._events!=!1&&this._events[a].splice(this._events[a].indexOf(b),1),void 0)},trigger:function(a){if(this._events=this._events||{},a in this._events!=!1)for(var b=0;b<this._events[a].length;b++)this._events[a][b].apply(this,Array.prototype.slice.call(arguments,1))}},e.mixin=function(a){for(var b=["on","off","trigger"],c=0;c<b.length;c++)a.prototype[b[c]]=e.prototype[b[c]]};var f=/Mac/.test(navigator.userAgent),g=65,h=13,i=27,j=37,k=38,l=39,m=40,n=8,o=46,p=16,q=f?91:17,r=f?18:17,s=9,t=1,u=2,v=function(a){return"undefined"!=typeof a},w=function(a){return"undefined"==typeof a||null===a?"":"boolean"==typeof a?a?"1":"0":a+""},x=function(a){return(a+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},y=function(a){return(a+"").replace(/\$/g,"$$$$")},z={};z.before=function(a,b,c){var d=a[b];a[b]=function(){return c.apply(a,arguments),d.apply(a,arguments)}},z.after=function(a,b,c){var d=a[b];a[b]=function(){var b=d.apply(a,arguments);return c.apply(a,arguments),b}};var A=function(b,c){if(!a.isArray(c))return c;var d,e,f={};for(d=0,e=c.length;e>d;d++)c[d].hasOwnProperty(b)&&(f[c[d][b]]=c[d]);return f},B=function(a){var b=!1;return function(){b||(b=!0,a.apply(this,arguments))}},C=function(a,b){var c;return function(){var d=this,e=arguments;window.clearTimeout(c),c=window.setTimeout(function(){a.apply(d,e)},b)}},D=function(a,b,c){var d,e=a.trigger,f={};a.trigger=function(){var c=arguments[0];return-1===b.indexOf(c)?e.apply(a,arguments):(f[c]=arguments,void 0)},c.apply(a,[]),a.trigger=e;for(d in f)f.hasOwnProperty(d)&&e.apply(a,f[d])},E=function(a,b,c,d){a.on(b,c,function(b){for(var c=b.target;c&&c.parentNode!==a[0];)c=c.parentNode;return b.currentTarget=c,d.apply(this,[b])})},F=function(a){var b={};if("selectionStart"in a)b.start=a.selectionStart,b.length=a.selectionEnd-b.start;else if(document.selection){a.focus();var c=document.selection.createRange(),d=document.selection.createRange().text.length;c.moveStart("character",-a.value.length),b.start=c.text.length-d,b.length=d}return b},G=function(a,b,c){var d,e,f={};if(c)for(d=0,e=c.length;e>d;d++)f[c[d]]=a.css(c[d]);else f=a.css();b.css(f)},H=function(b,c){var d=a("<test>").css({position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}).text(b).appendTo("body");G(c,d,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]);var e=d.width();return d.remove(),e},I=function(a){var b=function(b){var c,d,e,f,g,h,i,j;b=b||window.event||{},b.metaKey||b.altKey||a.data("grow")!==!1&&(c=a.val(),b.type&&"keydown"===b.type.toLowerCase()&&(d=b.keyCode,e=d>=97&&122>=d||d>=65&&90>=d||d>=48&&57>=d||32===d,d===o||d===n?(j=F(a[0]),j.length?c=c.substring(0,j.start)+c.substring(j.start+j.length):d===n&&j.start?c=c.substring(0,j.start-1)+c.substring(j.start+1):d===o&&"undefined"!=typeof j.start&&(c=c.substring(0,j.start)+c.substring(j.start+1))):e&&(h=b.shiftKey,i=String.fromCharCode(b.keyCode),i=h?i.toUpperCase():i.toLowerCase(),c+=i)),f=a.attr("placeholder")||"",!c.length&&f.length&&(c=f),g=H(c,a)+4,g!==a.width()&&(a.width(g),a.triggerHandler("resize")))};a.on("keydown keyup update blur",b),b()},J=function(c,d){var e,f,g=this;f=c[0],f.selectize=g,e=window.getComputedStyle?window.getComputedStyle(f,null).getPropertyValue("direction"):f.currentStyle&&f.currentStyle.direction,e=e||c.parents("[dir]:first").attr("dir")||"",a.extend(g,{settings:d,$input:c,tagType:"select"===f.tagName.toLowerCase()?t:u,rtl:/rtl/i.test(e),eventNS:".selectize"+ ++J.count,highlightedValue:null,isOpen:!1,isDisabled:!1,isRequired:c.is("[required]"),isInvalid:!1,isLocked:!1,isFocused:!1,isInputHidden:!1,isSetup:!1,isShiftDown:!1,isCmdDown:!1,isCtrlDown:!1,ignoreFocus:!1,ignoreHover:!1,hasOptions:!1,currentResults:null,lastValue:"",caretPos:0,loading:0,loadedSearches:{},$activeOption:null,$activeItems:[],optgroups:{},options:{},userOptions:{},items:[],renderCache:{},onSearchChange:C(g.onSearchChange,d.loadThrottle)}),g.sifter=new b(this.options,{diacritics:d.diacritics}),a.extend(g.options,A(d.valueField,d.options)),delete g.settings.options,a.extend(g.optgroups,A(d.optgroupValueField,d.optgroups)),delete g.settings.optgroups,g.settings.mode=g.settings.mode||(1===g.settings.maxItems?"single":"multi"),"boolean"!=typeof g.settings.hideSelected&&(g.settings.hideSelected="multi"===g.settings.mode),g.initializePlugins(g.settings.plugins),g.setupCallbacks(),g.setupTemplates(),g.setup()};return e.mixin(J),c.mixin(J),a.extend(J.prototype,{setup:function(){var b,c,d,e,g,h,i,j,k,l,m=this,n=m.settings,o=m.eventNS,s=a(window),u=a(document);i=m.settings.mode,j=m.$input.attr("tabindex")||"",k=m.$input.attr("class")||"",b=a("<div>").addClass(n.wrapperClass).addClass(k).addClass(i),c=a("<div>").addClass(n.inputClass).addClass("items").appendTo(b),d=a('<input type="text" autocomplete="off">').appendTo(c).attr("tabindex",j),h=a(n.dropdownParent||b),e=a("<div>").addClass(n.dropdownClass).addClass(k).addClass(i).hide().appendTo(h),g=a("<div>").addClass(n.dropdownContentClass).appendTo(e),b.css({width:m.$input[0].style.width}),m.plugins.names.length&&(l="plugin-"+m.plugins.names.join(" plugin-"),b.addClass(l),e.addClass(l)),(null===n.maxItems||n.maxItems>1)&&m.tagType===t&&m.$input.attr("multiple","multiple"),m.settings.placeholder&&d.attr("placeholder",n.placeholder),m.$wrapper=b,m.$control=c,m.$control_input=d,m.$dropdown=e,m.$dropdown_content=g,e.on("mouseenter","[data-selectable]",function(){return m.onOptionHover.apply(m,arguments)}),e.on("mousedown","[data-selectable]",function(){return m.onOptionSelect.apply(m,arguments)}),E(c,"mousedown","*:not(input)",function(){return m.onItemSelect.apply(m,arguments)}),I(d),c.on({mousedown:function(){return m.onMouseDown.apply(m,arguments)},click:function(){return m.onClick.apply(m,arguments)}}),d.on({mousedown:function(a){a.stopPropagation()},keydown:function(){return m.onKeyDown.apply(m,arguments)},keyup:function(){return m.onKeyUp.apply(m,arguments)},keypress:function(){return m.onKeyPress.apply(m,arguments)},resize:function(){m.positionDropdown.apply(m,[])},blur:function(){return m.onBlur.apply(m,arguments)},focus:function(){return m.onFocus.apply(m,arguments)}}),u.on("keydown"+o,function(a){m.isCmdDown=a[f?"metaKey":"ctrlKey"],m.isCtrlDown=a[f?"altKey":"ctrlKey"],m.isShiftDown=a.shiftKey}),u.on("keyup"+o,function(a){a.keyCode===r&&(m.isCtrlDown=!1),a.keyCode===p&&(m.isShiftDown=!1),a.keyCode===q&&(m.isCmdDown=!1)}),u.on("mousedown"+o,function(a){if(m.isFocused){if(a.target===m.$dropdown[0]||a.target.parentNode===m.$dropdown[0])return!1;m.$control.has(a.target).length||a.target===m.$control[0]||m.blur()}}),s.on(["scroll"+o,"resize"+o].join(" "),function(){m.isOpen&&m.positionDropdown.apply(m,arguments)}),s.on("mousemove"+o,function(){m.ignoreHover=!1}),this.revertSettings={$children:m.$input.children().detach(),tabindex:m.$input.attr("tabindex")},m.$input.attr("tabindex",-1).hide().after(m.$wrapper),a.isArray(n.items)&&(m.setValue(n.items),delete n.items),m.$input[0].validity&&m.$input.on("invalid"+o,function(a){a.preventDefault(),m.isInvalid=!0,m.refreshState()}),m.updateOriginalInput(),m.refreshItems(),m.refreshState(),m.updatePlaceholder(),m.isSetup=!0,m.$input.is(":disabled")&&m.disable(),m.on("change",this.onChange),m.trigger("initialize"),n.preload&&m.onSearchChange("")},setupTemplates:function(){var b=this,c=b.settings.labelField,d=b.settings.optgroupLabelField,e={optgroup:function(a){return'<div class="optgroup">'+a.html+"</div>"},optgroup_header:function(a,b){return'<div class="optgroup-header">'+b(a[d])+"</div>"},option:function(a,b){return'<div class="option">'+b(a[c])+"</div>"},item:function(a,b){return'<div class="item">'+b(a[c])+"</div>"},option_create:function(a,b){return'<div class="create">Add <strong>'+b(a.input)+"</strong>&hellip;</div>"}};b.settings.render=a.extend({},e,b.settings.render)},setupCallbacks:function(){var a,b,c={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType"};for(a in c)c.hasOwnProperty(a)&&(b=this.settings[c[a]],b&&this.on(a,b))},onClick:function(a){var b=this;b.isFocused||(b.focus(),a.preventDefault())},onMouseDown:function(b){var c=this,d=b.isDefaultPrevented();if(a(b.target),c.isFocused){if(b.target!==c.$control_input[0])return"single"===c.settings.mode?c.isOpen?c.close():c.open():d||c.setActiveItem(null),!1}else d||window.setTimeout(function(){c.focus()},0)},onChange:function(){this.$input.trigger("change")},onKeyPress:function(a){if(this.isLocked)return a&&a.preventDefault();var b=String.fromCharCode(a.keyCode||a.which);return this.settings.create&&b===this.settings.delimiter?(this.createItem(),a.preventDefault(),!1):void 0},onKeyDown:function(a){a.target===this.$control_input[0];var b=this;if(b.isLocked)return a.keyCode!==s&&a.preventDefault(),void 0;switch(a.keyCode){case g:if(b.isCmdDown)return b.selectAll(),void 0;break;case i:return b.close(),void 0;case m:if(!b.isOpen&&b.hasOptions)b.open();else if(b.$activeOption){b.ignoreHover=!0;var c=b.getAdjacentOption(b.$activeOption,1);c.length&&b.setActiveOption(c,!0,!0)}return a.preventDefault(),void 0;case k:if(b.$activeOption){b.ignoreHover=!0;var d=b.getAdjacentOption(b.$activeOption,-1);d.length&&b.setActiveOption(d,!0,!0)}return a.preventDefault(),void 0;case h:return b.isOpen&&b.$activeOption&&b.onOptionSelect({currentTarget:b.$activeOption}),a.preventDefault(),void 0;case j:return b.advanceSelection(-1,a),void 0;case l:return b.advanceSelection(1,a),void 0;case s:return b.settings.create&&b.createItem()&&a.preventDefault(),void 0;case n:case o:return b.deleteSelection(a),void 0}return b.isFull()||b.isInputHidden?(a.preventDefault(),void 0):void 0},onKeyUp:function(a){var b=this;if(b.isLocked)return a&&a.preventDefault();var c=b.$control_input.val()||"";b.lastValue!==c&&(b.lastValue=c,b.onSearchChange(c),b.refreshOptions(),b.trigger("type",c))},onSearchChange:function(a){var b=this,c=b.settings.load;c&&(b.loadedSearches.hasOwnProperty(a)||(b.loadedSearches[a]=!0,b.load(function(d){c.apply(b,[a,d])})))},onFocus:function(a){var b=this;return b.isFocused=!0,b.isDisabled?(b.blur(),a&&a.preventDefault(),!1):(b.ignoreFocus||("focus"===b.settings.preload&&b.onSearchChange(""),b.$activeItems.length||(b.showInput(),b.setActiveItem(null),b.refreshOptions(!!b.settings.openOnFocus)),b.refreshState()),void 0)},onBlur:function(){var a=this;a.isFocused=!1,a.ignoreFocus||(a.settings.create&&a.settings.createOnBlur&&a.createItem(),a.close(),a.setTextboxValue(""),a.setActiveItem(null),a.setActiveOption(null),a.setCaret(a.items.length),a.refreshState())},onOptionHover:function(a){this.ignoreHover||this.setActiveOption(a.currentTarget,!1)},onOptionSelect:function(b){var c,d,e=this;b.preventDefault&&(b.preventDefault(),b.stopPropagation()),d=a(b.currentTarget),d.hasClass("create")?e.createItem():(c=d.attr("data-value"),c&&(e.lastQuery=null,e.setTextboxValue(""),e.addItem(c),!e.settings.hideSelected&&b.type&&/mouse/.test(b.type)&&e.setActiveOption(e.getOption(c))))},onItemSelect:function(a){var b=this;b.isLocked||"multi"===b.settings.mode&&(a.preventDefault(),b.setActiveItem(a.currentTarget,a))},load:function(a){var b=this,c=b.$wrapper.addClass("loading");b.loading++,a.apply(b,[function(a){b.loading=Math.max(b.loading-1,0),a&&a.length&&(b.addOption(a),b.refreshOptions(b.isFocused&&!b.isInputHidden)),b.loading||c.removeClass("loading"),b.trigger("load",a)}])},setTextboxValue:function(a){this.$control_input.val(a).triggerHandler("update"),this.lastValue=a},getValue:function(){return this.tagType===t&&this.$input.attr("multiple")?this.items:this.items.join(this.settings.delimiter)},setValue:function(b){D(this,["change"],function(){this.clear();for(var c=a.isArray(b)?b:[b],d=0,e=c.length;e>d;d++)this.addItem(c[d])})},setActiveItem:function(b,c){var d,e,f,g,h,i,j,k,l=this;if("single"!==l.settings.mode){if(b=a(b),!b.length)return a(l.$activeItems).removeClass("active"),l.$activeItems=[],l.isFocused&&l.showInput(),void 0;if(d=c&&c.type.toLowerCase(),"mousedown"===d&&l.isShiftDown&&l.$activeItems.length){for(k=l.$control.children(".active:last"),g=Array.prototype.indexOf.apply(l.$control[0].childNodes,[k[0]]),h=Array.prototype.indexOf.apply(l.$control[0].childNodes,[b[0]]),g>h&&(j=g,g=h,h=j),e=g;h>=e;e++)i=l.$control[0].childNodes[e],-1===l.$activeItems.indexOf(i)&&(a(i).addClass("active"),l.$activeItems.push(i));c.preventDefault()}else"mousedown"===d&&l.isCtrlDown||"keydown"===d&&this.isShiftDown?b.hasClass("active")?(f=l.$activeItems.indexOf(b[0]),l.$activeItems.splice(f,1),b.removeClass("active")):l.$activeItems.push(b.addClass("active")[0]):(a(l.$activeItems).removeClass("active"),l.$activeItems=[b.addClass("active")[0]]);l.hideInput(),this.isFocused||l.focus()}},setActiveOption:function(b,c,d){var e,f,g,h,i,j=this;j.$activeOption&&j.$activeOption.removeClass("active"),j.$activeOption=null,b=a(b),b.length&&(j.$activeOption=b.addClass("active"),(c||!v(c))&&(e=j.$dropdown_content.height(),f=j.$activeOption.outerHeight(!0),c=j.$dropdown_content.scrollTop()||0,g=j.$activeOption.offset().top-j.$dropdown_content.offset().top+c,h=g,i=g-e+f,g+f>e+c?j.$dropdown_content.stop().animate({scrollTop:i},d?j.settings.scrollDuration:0):c>g&&j.$dropdown_content.stop().animate({scrollTop:h},d?j.settings.scrollDuration:0)))},selectAll:function(){var a=this;"single"!==a.settings.mode&&(a.$activeItems=Array.prototype.slice.apply(a.$control.children(":not(input)").addClass("active")),a.$activeItems.length&&(a.hideInput(),a.close()),a.focus())},hideInput:function(){var a=this;a.setTextboxValue(""),a.$control_input.css({opacity:0,position:"absolute",left:a.rtl?1e4:-1e4}),a.isInputHidden=!0},showInput:function(){this.$control_input.css({opacity:1,position:"relative",left:0}),this.isInputHidden=!1},focus:function(){var a=this;a.isDisabled||(a.ignoreFocus=!0,a.$control_input[0].focus(),window.setTimeout(function(){a.ignoreFocus=!1,a.onFocus()},0))},blur:function(){this.$control_input.trigger("blur")},getScoreFunction:function(a){return this.sifter.getScoreFunction(a,this.getSearchOptions())},getSearchOptions:function(){var a=this.settings,b=a.sortField;return"string"==typeof b&&(b={field:b}),{fields:a.searchField,conjunction:a.searchConjunction,sort:b}},search:function(b){var c,d,e,f=this,g=f.settings,h=this.getSearchOptions();if(g.score&&(e=f.settings.score.apply(this,[b]),"function"!=typeof e))throw new Error('Selectize "score" setting must be a function that returns a function');if(b!==f.lastQuery?(f.lastQuery=b,d=f.sifter.search(b,a.extend(h,{score:e})),f.currentResults=d):d=a.extend(!0,{},f.currentResults),g.hideSelected)for(c=d.items.length-1;c>=0;c--)-1!==f.items.indexOf(w(d.items[c].id))&&d.items.splice(c,1);return d},refreshOptions:function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;"undefined"==typeof b&&(b=!0);var t=this,u=t.$control_input.val(),v=t.search(u),x=t.$dropdown_content,y=t.$activeOption&&w(t.$activeOption.attr("data-value"));if(g=v.items.length,"number"==typeof t.settings.maxOptions&&(g=Math.min(g,t.settings.maxOptions)),h={},t.settings.optgroupOrder)for(i=t.settings.optgroupOrder,c=0;c<i.length;c++)h[i[c]]=[];else i=[];for(c=0;g>c;c++)for(j=t.options[v.items[c].id],k=t.render("option",j),l=j[t.settings.optgroupField]||"",m=a.isArray(l)?l:[l],e=0,f=m&&m.length;f>e;e++)l=m[e],t.optgroups.hasOwnProperty(l)||(l=""),h.hasOwnProperty(l)||(h[l]=[],i.push(l)),h[l].push(k);for(n=[],c=0,g=i.length;g>c;c++)l=i[c],t.optgroups.hasOwnProperty(l)&&h[l].length?(o=t.render("optgroup_header",t.optgroups[l])||"",o+=h[l].join(""),n.push(t.render("optgroup",a.extend({},t.optgroups[l],{html:o})))):n.push(h[l].join(""));if(x.html(n.join("")),t.settings.highlight&&v.query.length&&v.tokens.length)for(c=0,g=v.tokens.length;g>c;c++)d(x,v.tokens[c].regex);if(!t.settings.hideSelected)for(c=0,g=t.items.length;g>c;c++)t.getOption(t.items[c]).addClass("selected");p=t.settings.create&&v.query.length,p&&(x.prepend(t.render("option_create",{input:u})),s=a(x[0].childNodes[0])),t.hasOptions=v.items.length>0||p,t.hasOptions?(v.items.length>0?(r=y&&t.getOption(y),r&&r.length?q=r:"single"===t.settings.mode&&t.items.length&&(q=t.getOption(t.items[0])),q&&q.length||(q=s&&!t.settings.addPrecedence?t.getAdjacentOption(s,1):x.find("[data-selectable]:first"))):q=s,t.setActiveOption(q),b&&!t.isOpen&&t.open()):(t.setActiveOption(null),b&&t.isOpen&&t.close())},addOption:function(b){var c,d,e,f=this;if(a.isArray(b))for(c=0,d=b.length;d>c;c++)f.addOption(b[c]);else e=w(b[f.settings.valueField]),e&&!f.options.hasOwnProperty(e)&&(f.userOptions[e]=!0,f.options[e]=b,f.lastQuery=null,f.trigger("option_add",e,b))},addOptionGroup:function(a,b){this.optgroups[a]=b,this.trigger("optgroup_add",a,b)},updateOption:function(b,c){var d,e,f,g,h,i,j=this;if(b=w(b),f=w(c[j.settings.valueField]),j.options.hasOwnProperty(b)){if(!f)throw new Error("Value must be set in option data");f!==b&&(delete j.options[b],g=j.items.indexOf(b),-1!==g&&j.items.splice(g,1,f)),j.options[f]=c,h=j.renderCache.item,i=j.renderCache.option,v(h)&&(delete h[b],delete h[f]),v(i)&&(delete i[b],delete i[f]),-1!==j.items.indexOf(f)&&(d=j.getItem(b),e=a(j.render("item",c)),d.hasClass("active")&&e.addClass("active"),d.replaceWith(e)),j.isOpen&&j.refreshOptions(!1)}},removeOption:function(a){var b=this;a=w(a),delete b.userOptions[a],delete b.options[a],b.lastQuery=null,b.trigger("option_remove",a),b.removeItem(a)},clearOptions:function(){var a=this;a.loadedSearches={},a.userOptions={},a.options=a.sifter.items={},a.lastQuery=null,a.trigger("option_clear"),a.clear()},getOption:function(a){return this.getElementWithValue(a,this.$dropdown_content.find("[data-selectable]"))},getAdjacentOption:function(b,c){var d=this.$dropdown.find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},getElementWithValue:function(b,c){if(b=w(b))for(var d=0,e=c.length;e>d;d++)if(c[d].getAttribute("data-value")===b)return a(c[d]);return a()},getItem:function(a){return this.getElementWithValue(a,this.$control.children())},addItem:function(b){D(this,["change"],function(){var c,d,e,f,g=this,h=g.settings.mode;return b=w(b),-1!==g.items.indexOf(b)?("single"===h&&g.close(),void 0):(g.options.hasOwnProperty(b)&&("single"===h&&g.clear(),"multi"===h&&g.isFull()||(c=a(g.render("item",g.options[b])),g.items.splice(g.caretPos,0,b),g.insertAtCaret(c),g.refreshState(),g.isSetup&&(e=g.$dropdown_content.find("[data-selectable]"),d=g.getOption(b),f=g.getAdjacentOption(d,1).attr("data-value"),g.refreshOptions(g.isFocused&&"single"!==h),f&&g.setActiveOption(g.getOption(f)),!e.length||null!==g.settings.maxItems&&g.items.length>=g.settings.maxItems?g.close():g.positionDropdown(),g.updatePlaceholder(),g.trigger("item_add",b,c),g.updateOriginalInput()))),void 0)})},removeItem:function(a){var b,c,d,e=this;b="object"==typeof a?a:e.getItem(a),a=w(b.attr("data-value")),c=e.items.indexOf(a),-1!==c&&(b.remove(),b.hasClass("active")&&(d=e.$activeItems.indexOf(b[0]),e.$activeItems.splice(d,1)),e.items.splice(c,1),e.lastQuery=null,!e.settings.persist&&e.userOptions.hasOwnProperty(a)&&e.removeOption(a),c<e.caretPos&&e.setCaret(e.caretPos-1),e.refreshState(),e.updatePlaceholder(),e.updateOriginalInput(),e.positionDropdown(),e.trigger("item_remove",a))},createItem:function(){var b=this,c=a.trim(b.$control_input.val()||""),d=b.caretPos;if(!c.length)return!1;b.lock();var e="function"==typeof b.settings.create?this.settings.create:function(a){var c={};return c[b.settings.labelField]=a,c[b.settings.valueField]=a,c},f=B(function(a){if(b.unlock(),a&&"object"==typeof a){var c=w(a[b.settings.valueField]);c&&(b.setTextboxValue(""),b.addOption(a),b.setCaret(d),b.addItem(c),b.refreshOptions("single"!==b.settings.mode))}}),g=e.apply(this,[c,f]);return"undefined"!=typeof g&&f(g),!0},refreshItems:function(){if(this.lastQuery=null,this.isSetup)for(var a=0;a<this.items.length;a++)this.addItem(this.items);this.refreshState(),this.updateOriginalInput()},refreshState:function(){var a=this,b=a.isRequired&&!a.items.length;b||(a.isInvalid=!1),a.$control_input.prop("required",b),a.refreshClasses()},refreshClasses:function(){var b=this,c=b.isFull(),d=b.isLocked;b.$wrapper.toggleClass("rtl",b.rtl),b.$control.toggleClass("focus",b.isFocused).toggleClass("disabled",b.isDisabled).toggleClass("required",b.isRequired).toggleClass("invalid",b.isInvalid).toggleClass("locked",d).toggleClass("full",c).toggleClass("not-full",!c).toggleClass("input-active",b.isFocused&&!b.isInputHidden).toggleClass("dropdown-active",b.isOpen).toggleClass("has-options",!a.isEmptyObject(b.options)).toggleClass("has-items",b.items.length>0),b.$control_input.data("grow",!c&&!d)},isFull:function(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems},updateOriginalInput:function(){var a,b,c,d=this;if("select"===d.$input[0].tagName.toLowerCase()){for(c=[],a=0,b=d.items.length;b>a;a++)c.push('<option value="'+x(d.items[a])+'" selected="selected"></option>');c.length||this.$input.attr("multiple")||c.push('<option value="" selected="selected"></option>'),d.$input.html(c.join(""))}else d.$input.val(d.getValue());d.isSetup&&d.trigger("change",d.$input.val())},updatePlaceholder:function(){if(this.settings.placeholder){var a=this.$control_input;this.items.length?a.removeAttr("placeholder"):a.attr("placeholder",this.settings.placeholder),a.triggerHandler("update")}},open:function(){var a=this;a.isLocked||a.isOpen||"multi"===a.settings.mode&&a.isFull()||(a.focus(),a.isOpen=!0,a.refreshState(),a.$dropdown.css({visibility:"hidden",display:"block"}),a.positionDropdown(),a.$dropdown.css({visibility:"visible"}),a.trigger("dropdown_open",a.$dropdown))},close:function(){var a=this,b=a.isOpen;"single"===a.settings.mode&&a.items.length&&a.hideInput(),a.isOpen=!1,a.$dropdown.hide(),a.setActiveOption(null),a.refreshState(),b&&a.trigger("dropdown_close",a.$dropdown)},positionDropdown:function(){var a=this.$control,b="body"===this.settings.dropdownParent?a.offset():a.position();b.top+=a.outerHeight(!0),this.$dropdown.css({width:a.outerWidth(),top:b.top,left:b.left})},clear:function(){var a=this;a.items.length&&(a.$control.children(":not(input)").remove(),a.items=[],a.setCaret(0),a.updatePlaceholder(),a.updateOriginalInput(),a.refreshState(),a.showInput(),a.trigger("clear"))},insertAtCaret:function(b){var c=Math.min(this.caretPos,this.items.length);0===c?this.$control.prepend(b):a(this.$control[0].childNodes[c]).before(b),this.setCaret(c+1)},deleteSelection:function(b){var c,d,e,f,g,h,i,j,k,l=this;if(e=b&&b.keyCode===n?-1:1,f=F(l.$control_input[0]),l.$activeOption&&!l.settings.hideSelected&&(i=l.getAdjacentOption(l.$activeOption,-1).attr("data-value")),g=[],l.$activeItems.length){for(k=l.$control.children(".active:"+(e>0?"last":"first")),h=l.$control.children(":not(input)").index(k),e>0&&h++,c=0,d=l.$activeItems.length;d>c;c++)g.push(a(l.$activeItems[c]).attr("data-value"));b&&(b.preventDefault(),b.stopPropagation())}else(l.isFocused||"single"===l.settings.mode)&&l.items.length&&(0>e&&0===f.start&&0===f.length?g.push(l.items[l.caretPos-1]):e>0&&f.start===l.$control_input.val().length&&g.push(l.items[l.caretPos]));if(!g.length||"function"==typeof l.settings.onDelete&&l.settings.onDelete.apply(l,[g])===!1)return!1;for("undefined"!=typeof h&&l.setCaret(h);g.length;)l.removeItem(g.pop());return l.showInput(),l.positionDropdown(),l.refreshOptions(!0),i&&(j=l.getOption(i),j.length&&l.setActiveOption(j)),!0},advanceSelection:function(a,b){var c,d,e,f,g,h,i=this;0!==a&&(i.rtl&&(a*=-1),c=a>0?"last":"first",d=F(i.$control_input[0]),i.isFocused&&!i.isInputHidden?(f=i.$control_input.val().length,g=0>a?0===d.start&&0===d.length:d.start===f,g&&!f&&i.advanceCaret(a,b)):(h=i.$control.children(".active:"+c),h.length&&(e=i.$control.children(":not(input)").index(h),i.setActiveItem(null),i.setCaret(a>0?e+1:e))))},advanceCaret:function(a,b){var c,d,e=this;0!==a&&(c=a>0?"next":"prev",e.isShiftDown?(d=e.$control_input[c](),d.length&&(e.hideInput(),e.setActiveItem(d),b&&b.preventDefault())):e.setCaret(e.caretPos+a))},setCaret:function(b){var c=this;b="single"===c.settings.mode?c.items.length:Math.max(0,Math.min(c.items.length,b));var d,e,f,g;for(f=c.$control.children(":not(input)"),d=0,e=f.length;e>d;d++)g=a(f[d]).detach(),b>d?c.$control_input.before(g):c.$control.append(g);c.caretPos=b},lock:function(){this.close(),this.isLocked=!0,this.refreshState()},unlock:function(){this.isLocked=!1,this.refreshState()},disable:function(){var a=this;a.$input.prop("disabled",!0),a.isDisabled=!0,a.lock()},enable:function(){var a=this;a.$input.prop("disabled",!1),a.isDisabled=!1,a.unlock()},destroy:function(){var b=this,c=b.eventNS,d=b.revertSettings;b.trigger("destroy"),b.off(),b.$wrapper.remove(),b.$dropdown.remove(),b.$input.html("").append(d.$children).removeAttr("tabindex").attr({tabindex:d.tabindex}).show(),a(window).off(c),a(document).off(c),a(document.body).off(c),delete b.$input[0].selectize},render:function(a,b){var c,d,e="",f=!1,g=this,h=/^[\t ]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;return("option"===a||"item"===a)&&(c=w(b[g.settings.valueField]),f=!!c),f&&(v(g.renderCache[a])||(g.renderCache[a]={}),g.renderCache[a].hasOwnProperty(c))?g.renderCache[a][c]:(e=g.settings.render[a].apply(this,[b,x]),("option"===a||"option_create"===a)&&(e=e.replace(h,"<$1 data-selectable")),"optgroup"===a&&(d=b[g.settings.optgroupValueField]||"",e=e.replace(h,'<$1 data-group="'+y(x(d))+'"')),("option"===a||"item"===a)&&(e=e.replace(h,'<$1 data-value="'+y(x(c||""))+'"')),f&&(g.renderCache[a][c]=e),e)}}),J.count=0,J.defaults={plugins:[],delimiter:",",persist:!0,diacritics:!0,create:!1,createOnBlur:!1,highlight:!0,openOnFocus:!0,maxOptions:1e3,maxItems:null,hideSelected:null,addPrecedence:!1,preload:!1,scrollDuration:60,loadThrottle:300,dataAttr:"data-data",optgroupField:"optgroup",valueField:"value",labelField:"text",optgroupLabelField:"label",optgroupValueField:"value",optgroupOrder:null,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"selectize-control",inputClass:"selectize-input",dropdownClass:"selectize-dropdown",dropdownContentClass:"selectize-dropdown-content",dropdownParent:null,render:{}},a.fn.selectize=function(b){var c=a.fn.selectize.defaults,d=a.extend({},c,b),e=d.dataAttr,f=d.labelField,g=d.valueField,h=d.optgroupField,i=d.optgroupLabelField,j=d.optgroupValueField,k=function(b,c){var e,h,i,j,k=a.trim(b.val()||"");
3
+ if(k.length){for(i=k.split(d.delimiter),e=0,h=i.length;h>e;e++)j={},j[f]=i[e],j[g]=i[e],c.options[i[e]]=j;c.items=i}},l=function(b,c){var d,k,l,m,n=0,o=c.options,p=function(a){var b=e&&a.attr(e);return"string"==typeof b&&b.length?JSON.parse(b):null},q=function(b,d){var e,i;if(b=a(b),e=b.attr("value")||"",e.length){if(o.hasOwnProperty(e))return d&&(o[e].optgroup?a.isArray(o[e].optgroup)?o[e].optgroup.push(d):o[e].optgroup=[o[e].optgroup,d]:o[e].optgroup=d),void 0;i=p(b)||{},i[f]=i[f]||b.text(),i[g]=i[g]||e,i[h]=i[h]||d,i.$order=++n,o[e]=i,b.is(":selected")&&c.items.push(e)}},r=function(b){var d,e,f,g,h;for(b=a(b),f=b.attr("label"),f&&(g=p(b)||{},g[i]=f,g[j]=f,c.optgroups[f]=g),h=a("option",b),d=0,e=h.length;e>d;d++)q(h[d],f)};for(c.maxItems=b.attr("multiple")?null:1,m=b.children(),d=0,k=m.length;k>d;d++)l=m[d].tagName.toLowerCase(),"optgroup"===l?r(m[d]):"option"===l&&q(m[d])};return this.each(function(){if(!this.selectize){var d,e=a(this),f=this.tagName.toLowerCase(),g={placeholder:e.children('option[value=""]').text()||e.attr("placeholder"),options:{},optgroups:{},items:[]};"select"===f?l(e,g):k(e,g),d=new J(e,a.extend(!0,{},c,g,b)),e.data("selectize",d),e.addClass("selectized")}})},a.fn.selectize.defaults=J.defaults,J.define("drag_drop",function(){if(!a.fn.sortable)throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".');if("multi"===this.settings.mode){var b=this;b.lock=function(){var a=b.lock;return function(){var c=b.$control.data("sortable");return c&&c.disable(),a.apply(b,arguments)}}(),b.unlock=function(){var a=b.unlock;return function(){var c=b.$control.data("sortable");return c&&c.enable(),a.apply(b,arguments)}}(),b.setup=function(){var c=b.setup;return function(){c.apply(this,arguments);var d=b.$control.sortable({items:"[data-value]",forcePlaceholderSize:!0,disabled:b.isLocked,start:function(a,b){b.placeholder.css("width",b.helper.css("width")),d.css({overflow:"visible"})},stop:function(){d.css({overflow:"hidden"});var c=b.$activeItems?b.$activeItems.slice():null,e=[];d.children("[data-value]").each(function(){e.push(a(this).attr("data-value"))}),b.setValue(e),b.setActiveItem(c)}})}}()}}),J.define("dropdown_header",function(b){var c=this;b=a.extend({title:"Untitled",headerClass:"selectize-dropdown-header",titleRowClass:"selectize-dropdown-header-title",labelClass:"selectize-dropdown-header-label",closeClass:"selectize-dropdown-header-close",html:function(a){return'<div class="'+a.headerClass+'">'+'<div class="'+a.titleRowClass+'">'+'<span class="'+a.labelClass+'">'+a.title+"</span>"+'<a href="javascript:void(0)" class="'+a.closeClass+'">&times;</a>'+"</div>"+"</div>"}},b),c.setup=function(){var d=c.setup;return function(){d.apply(c,arguments),c.$dropdown_header=a(b.html(b)),c.$dropdown.prepend(c.$dropdown_header)}}()}),J.define("optgroup_columns",function(b){var c=this;b=a.extend({equalizeWidth:!0,equalizeHeight:!0},b),this.getAdjacentOption=function(b,c){var d=b.closest("[data-group]").find("[data-selectable]"),e=d.index(b)+c;return e>=0&&e<d.length?d.eq(e):a()},this.onKeyDown=function(){var a=c.onKeyDown;return function(b){var d,e,f,g;return!this.isOpen||b.keyCode!==j&&b.keyCode!==l?a.apply(this,arguments):(c.ignoreHover=!0,g=this.$activeOption.closest("[data-group]"),d=g.find("[data-selectable]").index(this.$activeOption),g=b.keyCode===j?g.prev("[data-group]"):g.next("[data-group]"),f=g.find("[data-selectable]"),e=f.eq(Math.min(f.length-1,d)),e.length&&this.setActiveOption(e),void 0)}}();var d=function(){var d,e,f,g,h,i,j;if(j=a("[data-group]",c.$dropdown_content),e=j.length,e&&c.$dropdown_content.width()){if(b.equalizeHeight){for(f=0,d=0;e>d;d++)f=Math.max(f,j.eq(d).height());j.css({height:f})}b.equalizeWidth&&(i=c.$dropdown_content.innerWidth(),g=Math.round(i/e),j.css({width:g}),e>1&&(h=i-g*(e-1),j.eq(e-1).css({width:h})))}};(b.equalizeHeight||b.equalizeWidth)&&(z.after(this,"positionDropdown",d),z.after(this,"refreshOptions",d))}),J.define("remove_button",function(b){if("single"!==this.settings.mode){b=a.extend({label:"&times;",title:"Remove",className:"remove",append:!0},b);var c=this,d='<a href="javascript:void(0)" class="'+b.className+'" tabindex="-1" title="'+x(b.title)+'">'+b.label+"</a>",e=function(a,b){var c=a.search(/(<\/[^>]+>\s*)$/);return a.substring(0,c)+b+a.substring(c)};this.setup=function(){var f=c.setup;return function(){if(b.append){var g=c.settings.render.item;c.settings.render.item=function(){return e(g.apply(this,arguments),d)}}f.apply(this,arguments),this.$control.on("click","."+b.className,function(b){if(b.preventDefault(),!c.isLocked){var d=a(b.target).parent();c.setActiveItem(d),c.deleteSelection()&&c.setCaret(c.items.length)}})}}()}}),J.define("restore_on_backspace",function(a){var b=this;a.text=a.text||function(a){return a[this.settings.labelField]},this.onKeyDown=function(){var c=b.onKeyDown;return function(b){var d,e;return b.keyCode===n&&""===this.$control_input.val()&&!this.$activeItems.length&&(d=this.caretPos-1,d>=0&&d<this.items.length)?(e=this.options[this.items[d]],this.deleteSelection(b)&&(this.setTextboxValue(a.text.apply(this,[e])),this.refreshOptions(!0)),b.preventDefault(),void 0):c.apply(this,arguments)}}()}),J});
admin/manage-banner.php CHANGED
@@ -96,7 +96,7 @@ jQuery(document).ready(function(){
96
  //]]>
97
  </script>
98
 
99
- <div class="wrap">
100
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
101
  <div style="float: right; margin: -20px 3px 0 0;">
102
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Banner Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
@@ -126,7 +126,7 @@ jQuery(document).ready(function(){
126
  <tr>
127
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
128
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandbanner xml=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
129
- <td rowspan="3" align="left" valign="top"><div style="font-size:11px;"><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
130
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
131
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
132
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
@@ -174,7 +174,7 @@ jQuery(document).ready(function(){
174
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
175
  </div>
176
 
177
- <table id="flag-listvideo" class="widefat fixed" cellspacing="0" >
178
 
179
  <thead>
180
  <tr>
96
  //]]>
97
  </script>
98
 
99
+ <div class="flag-wrap">
100
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
101
  <div style="float: right; margin: -20px 3px 0 0;">
102
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Banner Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
126
  <tr>
127
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
128
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandbanner xml=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
129
+ <td rowspan="3" align="left" valign="top"><div><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
130
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
131
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
132
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
174
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
175
  </div>
176
 
177
+ <table id="flag-listvideo" class="widefat fixed flag-table" cellspacing="0" >
178
 
179
  <thead>
180
  <tr>
admin/manage-galleries.php CHANGED
@@ -106,7 +106,7 @@ function flag_manage_gallery_main() {
106
 
107
  //-->
108
  </script>
109
- <div class="wrap">
110
  <h2><?php _e('Gallery Overview', 'flag'); ?></h2>
111
  <form class="search-form" action="" method="get">
112
  <p class="search-box">
@@ -148,18 +148,18 @@ function flag_manage_gallery_main() {
148
  <?php endif; ?>
149
 
150
  </div>
151
- <table class="widefat" cellspacing="0">
152
  <thead>
153
  <tr>
154
  <th scope="col" class="cb column-cb" >
155
  <input type="checkbox" onclick="checkAll(document.getElementById('editgalleries'));" name="checkall"/>
156
  </th>
157
- <th scope="col" ><a href="<?php echo $flag->manage_page->base_page . "&galsort=gid&sortdir={$ascdesc}&paged=" . $_GET['paged']; ?>"><?php _e('ID'); ?></a></th>
158
- <th scope="col" width="25%"><a href="<?php echo $flag->manage_page->base_page . "&galsort=title&sortdir={$ascdesc}&paged=" . $_GET['paged']; ?>"><?php _e('Title', 'flag'); ?></a></th>
159
- <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
160
- <th scope="col" ><?php _e('Author', 'flag'); ?></th>
161
- <th scope="col" ><?php _e('Quantity', 'flag'); ?></th>
162
- <th scope="col" ><?php _e('Action', 'flag'); ?></th>
163
  </tr>
164
  </thead>
165
  <tbody>
@@ -178,7 +178,7 @@ if($gallerylist) {
178
  <?php } ?>
179
  </th>
180
  <td scope="row"><?php echo $gid; ?></td>
181
- <td>
182
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) { ?>
183
  <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gid, 'flag_editgallery')?>" class='edit' title="<?php _e('Edit'); ?>" >
184
  <?php echo esc_html(flagGallery::i18n($name)); ?>
@@ -188,10 +188,10 @@ if($gallerylist) {
188
  <?php }
189
  if($gallery->status){ echo ' <b>- '.__('Draft', 'flag').'</b>'; }?>
190
  </td>
191
- <td><?php echo esc_html(flagGallery::i18n($gallery->galdesc)); ?>&nbsp;</td>
192
  <td><?php echo $author_user->display_name; ?></td>
193
  <td><?php echo $gallery->counter; ?></td>
194
- <td>
195
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) : ?>
196
  <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>
197
  <?php if($gallery->status) { ?>
@@ -226,7 +226,7 @@ jQuery(document).ready(function(){
226
  accept: ".acat",
227
  hoverClass: "active",
228
  drop: function( event, ui ) {
229
- jQuery( this ).find(jQuery(ui.draggable)).addClass( "highlight_new" ).attr("id", "g_"+jQuery(ui.draggable).attr('rel'));
230
  jQuery( this ).find( "p" ).hide();
231
  }
232
  });
@@ -258,7 +258,7 @@ jQuery(document).ready(function(){
258
  });
259
  /*]]>*/
260
  </script>
261
- <div class="wrap">
262
  <h2><?php _e('Albums', 'flag'); ?></h2>
263
  <form method="post" style="width: 658px; float: left;" action="<?php echo admin_url('admin.php?page=flag-manage-gallery'); ?>"><?php wp_nonce_field('flag_album'); ?>
264
  <p><input type="text" id="album_name" name="album_name" value="" /> &nbsp; <input type="submit" value="<?php _e('Create New Album','flag'); ?>" class="button-primary" /></p></form>
@@ -272,7 +272,7 @@ if($albumlist) {
272
  foreach($albumlist as $album) {
273
  ?>
274
  <div class="album">
275
- <div class="album_name"><span class="albID"><?php echo $album->id; ?>.</span> <form method="post" id="albName_<?php echo $album->id; ?>" name="albName_<?php echo $album->id; ?>"><input type="text" name="album_name" value="<?php echo esc_html($album->name); ?>" /><input type="hidden" name="album_id" value="<?php echo $album->id; ?>" /></form> <span class="album_actions"><span class="alb_msg"></span>&nbsp;&nbsp;&nbsp;<span class="del flag-ajax-post" data-action="flag_delete_album" data-_ajax_nonce="<?php echo $nonce; ?>" data-post="<?php echo $album->id; ?>"><?php _e('Delete', 'flag'); ?></span>&nbsp;<span class="album_save flag-ajax-post button" data-action="flag_save_album" data-_ajax_nonce="<?php echo $nonce; ?>" data-form="albName_<?php echo $album->id; ?>"><strong><?php _e('Save', 'flag'); ?></strong></span></span></div>
276
  <div class="album_categoties">
277
  <?php $galids = explode(',',$album->categories);
278
  if($album->categories) {
106
 
107
  //-->
108
  </script>
109
+ <div class="flag-wrap" style="margin-top:40px;">
110
  <h2><?php _e('Gallery Overview', 'flag'); ?></h2>
111
  <form class="search-form" action="" method="get">
112
  <p class="search-box">
148
  <?php endif; ?>
149
 
150
  </div>
151
+ <table class="widefat flag-table" cellspacing="0">
152
  <thead>
153
  <tr>
154
  <th scope="col" class="cb column-cb" >
155
  <input type="checkbox" onclick="checkAll(document.getElementById('editgalleries'));" name="checkall"/>
156
  </th>
157
+ <th scope="col"><a href="<?php echo $flag->manage_page->base_page . "&galsort=gid&sortdir={$ascdesc}&paged=" . $_GET['paged']; ?>"><?php _e('ID'); ?></a></th>
158
+ <th scope="col"><a href="<?php echo $flag->manage_page->base_page . "&galsort=title&sortdir={$ascdesc}&paged=" . $_GET['paged']; ?>"><?php _e('Title', 'flag'); ?></a></th>
159
+ <th scope="col"><?php _e('Description', 'flag'); ?></th>
160
+ <th scope="col"><?php _e('Author', 'flag'); ?></th>
161
+ <th scope="col"><?php _e('Quantity', 'flag'); ?></th>
162
+ <th scope="col"><?php _e('Action', 'flag'); ?></th>
163
  </tr>
164
  </thead>
165
  <tbody>
178
  <?php } ?>
179
  </th>
180
  <td scope="row"><?php echo $gid; ?></td>
181
+ <td style="width:30%">
182
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) { ?>
183
  <a href="<?php echo wp_nonce_url( $flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gid, 'flag_editgallery')?>" class='edit' title="<?php _e('Edit'); ?>" >
184
  <?php echo esc_html(flagGallery::i18n($name)); ?>
188
  <?php }
189
  if($gallery->status){ echo ' <b>- '.__('Draft', 'flag').'</b>'; }?>
190
  </td>
191
+ <td style="width:30%"><?php echo esc_html(flagGallery::i18n($gallery->galdesc)); ?>&nbsp;</td>
192
  <td><?php echo $author_user->display_name; ?></td>
193
  <td><?php echo $gallery->counter; ?></td>
194
+ <td style="white-space:nowrap;">
195
  <?php if (flagAdmin::can_manage_this_gallery($gallery->author)) : ?>
196
  <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>
197
  <?php if($gallery->status) { ?>
226
  accept: ".acat",
227
  hoverClass: "active",
228
  drop: function( event, ui ) {
229
+ jQuery( this ).find(jQuery(ui.draggable)).addClass( "highlight_new" ).attr("id", "g_"+jQuery(ui.draggable).attr('rel')).removeAttr('style');
230
  jQuery( this ).find( "p" ).hide();
231
  }
232
  });
258
  });
259
  /*]]>*/
260
  </script>
261
+ <div class="flag-wrap">
262
  <h2><?php _e('Albums', 'flag'); ?></h2>
263
  <form method="post" style="width: 658px; float: left;" action="<?php echo admin_url('admin.php?page=flag-manage-gallery'); ?>"><?php wp_nonce_field('flag_album'); ?>
264
  <p><input type="text" id="album_name" name="album_name" value="" /> &nbsp; <input type="submit" value="<?php _e('Create New Album','flag'); ?>" class="button-primary" /></p></form>
272
  foreach($albumlist as $album) {
273
  ?>
274
  <div class="album">
275
+ <div class="album_name"><span class="albID"><?php echo $album->id; ?>.</span> <form method="post" id="albName_<?php echo $album->id; ?>" name="albName_<?php echo $album->id; ?>"><input type="text" name="album_name" value="<?php echo esc_html($album->name); ?>" /><input type="hidden" name="album_id" value="<?php echo $album->id; ?>" /></form> <span class="album_actions"><span class="alb_msg"></span>&nbsp;&nbsp;&nbsp;<span class="button del flag-ajax-post" data-action="flag_delete_album" data-_ajax_nonce="<?php echo $nonce; ?>" data-post="<?php echo $album->id; ?>"><?php _e('Delete', 'flag'); ?></span>&nbsp;&nbsp;<span class="album_save flag-ajax-post button-primary" data-action="flag_save_album" data-_ajax_nonce="<?php echo $nonce; ?>" data-form="albName_<?php echo $album->id; ?>"><strong><?php _e('Save', 'flag'); ?></strong></span></span></div>
276
  <div class="album_categoties">
277
  <?php $galids = explode(',',$album->categories);
278
  if($album->categories) {
admin/manage-images.php CHANGED
@@ -181,7 +181,7 @@ jQuery(document).ready( function() {
181
  //]]>
182
  </script>
183
 
184
- <div class="wrap">
185
 
186
  <?php if ($is_search) :?>
187
  <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'flag'), esc_html( stripslashes(get_search_query()) ) ); ?></h2>
@@ -227,22 +227,26 @@ jQuery(document).ready( function() {
227
  <div class="handlediv" title="Click to toggle"><br/></div>
228
  <h3 class="hndle"><span><?php _e('Gallery settings', 'flag'); ?></span></h3>
229
  <div class="inside">
230
- <table class="form-table" >
231
  <tr>
232
- <th align="left" scope="row"><?php _e('Title', 'flag'); ?>:</th>
 
233
  <td align="left"><input type="text" size="50" name="title" value="<?php echo esc_html($gallery->title); ?>" /></td>
234
  </tr>
235
  <tr>
236
- <th align="left" scope="row"><?php _e('Description', 'flag'); ?>:</th>
 
237
  <td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo esc_html($gallery->galdesc); ?></textarea></td>
238
  </tr>
239
  <tr>
240
- <th align="left" scope="row"><?php _e('Path', 'flag'); ?>:</th>
 
241
  <td align="left"><input <?php if (IS_WPMU) echo 'readonly = "readonly"'; ?> type="text" size="50" name="path" value="<?php echo esc_attr($gallery->path); ?>" /></td>
242
  </tr>
243
  <tr>
244
  <th align="right" scope="row"><?php _e('Author', 'flag'); ?>:</th>
245
- <td align="left">
 
246
  <?php
247
  $editable_ids = $flag->manage_page->get_editable_user_ids( $user_ID );
248
  if ( $editable_ids && count( $editable_ids ) > 1 )
@@ -301,7 +305,7 @@ jQuery(document).ready( function() {
301
  </div>
302
  </div>
303
 
304
- <table id="flag-listimages" class="widefat fixed" cellspacing="0" >
305
 
306
  <thead>
307
  <tr>
181
  //]]>
182
  </script>
183
 
184
+ <div class="flag-wrap">
185
 
186
  <?php if ($is_search) :?>
187
  <h2><?php printf( __('Search results for &#8220;%s&#8221;', 'flag'), esc_html( stripslashes(get_search_query()) ) ); ?></h2>
227
  <div class="handlediv" title="Click to toggle"><br/></div>
228
  <h3 class="hndle"><span><?php _e('Gallery settings', 'flag'); ?></span></h3>
229
  <div class="inside">
230
+ <table class="flag-form-table" >
231
  <tr>
232
+ <th align="right" scope="row"><?php _e('Title', 'flag'); ?>:</th>
233
+ <td> </td>
234
  <td align="left"><input type="text" size="50" name="title" value="<?php echo esc_html($gallery->title); ?>" /></td>
235
  </tr>
236
  <tr>
237
+ <th align="right" valign="top" scope="row"><?php _e('Description', 'flag'); ?>:</th>
238
+ <td> </td>
239
  <td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo esc_html($gallery->galdesc); ?></textarea></td>
240
  </tr>
241
  <tr>
242
+ <th align="right" scope="row"><?php _e('Path', 'flag'); ?>:</th>
243
+ <td> </td>
244
  <td align="left"><input <?php if (IS_WPMU) echo 'readonly = "readonly"'; ?> type="text" size="50" name="path" value="<?php echo esc_attr($gallery->path); ?>" /></td>
245
  </tr>
246
  <tr>
247
  <th align="right" scope="row"><?php _e('Author', 'flag'); ?>:</th>
248
+ <td> </td>
249
+ <td align="left">
250
  <?php
251
  $editable_ids = $flag->manage_page->get_editable_user_ids( $user_ID );
252
  if ( $editable_ids && count( $editable_ids ) > 1 )
305
  </div>
306
  </div>
307
 
308
+ <table id="flag-listimages" class="widefat fixed flag-table" cellspacing="0" >
309
 
310
  <thead>
311
  <tr>
admin/manage-playlist.php CHANGED
@@ -69,15 +69,12 @@ function showDialog( windowId, height ) {
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
71
  jQuery("#" + windowId + "_playlist").val(elementlist);
72
- // console.log (jQuery("#TB_playlist").val());
73
  tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
74
  }
75
  var current_image = '';
76
  function send_to_editor(html) {
77
  var source = html.match(/src=\".*\" alt/);
78
  source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
79
- //var id = html.match(/wp-image-(\d+(\.\d)*)/ig);
80
- //id = id[0].match(/\d+/);
81
  jQuery('#mp3thumb-'+actInp).attr('value', source);
82
  jQuery('#thumb-'+actInp).attr('src', source);
83
  tb_remove();
@@ -97,7 +94,7 @@ jQuery(document).ready(function(){
97
  //]]>
98
  </script>
99
 
100
- <div class="wrap">
101
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
102
  <div style="float: right; margin: -20px 3px 0 0;">
103
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Music Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
@@ -127,7 +124,7 @@ jQuery(document).ready(function(){
127
  <tr>
128
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
129
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandmusic playlist=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
130
- <td rowspan="3" align="left" valign="top"><div style="font-size:11px;"><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
131
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
132
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
133
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
@@ -175,7 +172,7 @@ jQuery(document).ready(function(){
175
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
176
  </div>
177
 
178
- <table id="flag-listmusic" class="widefat fixed" cellspacing="0" >
179
 
180
  <thead>
181
  <tr>
@@ -225,7 +222,7 @@ if(count($items_a)) {
225
  echo round($size/1024/1024,2).' Mb';
226
  ?></td>
227
  <td class="thumb" rowspan="2">
228
- <div style="width: 100px; height: 100px;"><img id="thumb-<?php echo $mp3->ID; ?>" src="<?php echo esc_url($thumb); ?>" width="100" height="100" alt="" /></div>
229
  </td>
230
  <td class="title_filename" rowspan="2">
231
  <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
69
  }
70
  jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
71
  jQuery("#" + windowId + "_playlist").val(elementlist);
 
72
  tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
73
  }
74
  var current_image = '';
75
  function send_to_editor(html) {
76
  var source = html.match(/src=\".*\" alt/);
77
  source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
 
 
78
  jQuery('#mp3thumb-'+actInp).attr('value', source);
79
  jQuery('#thumb-'+actInp).attr('src', source);
80
  tb_remove();
94
  //]]>
95
  </script>
96
 
97
+ <div class="flag-wrap">
98
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
99
  <div style="float: right; margin: -20px 3px 0 0;">
100
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Music Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
124
  <tr>
125
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
126
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandmusic playlist=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
127
+ <td rowspan="3" align="left" valign="top"><div><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
128
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
129
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
130
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
172
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
173
  </div>
174
 
175
+ <table id="flag-listmusic" class="widefat fixed flag-table" cellspacing="0" >
176
 
177
  <thead>
178
  <tr>
222
  echo round($size/1024/1024,2).' Mb';
223
  ?></td>
224
  <td class="thumb" rowspan="2">
225
+ <div style="width: 100px; height: 100px;"><img id="thumb-<?php echo $mp3->ID; ?>" src="<?php echo esc_url($thumb); ?>" style="height:auto; width:auto; max-height:100px; max-width:100px;" alt="" /></div>
226
  </td>
227
  <td class="title_filename" rowspan="2">
228
  <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
admin/manage-sort.php CHANGED
@@ -49,7 +49,7 @@ function flag_sortorder($galleryID = 0){
49
  ?>
50
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
51
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
52
- <div class="wrap">
53
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
54
 
55
  <form class="alignright" method="POST" action="<?php echo admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID; ?>" accept-charset="utf-8">
@@ -92,24 +92,24 @@ jQuery(document).ready(function($) {
92
  });
93
  /*]]>*/
94
  </script>
95
- <table id="flag-listitems" class="widefat fixed" cellspacing="0" >
96
 
97
  <thead>
98
  <tr>
99
- <th class="header" width="30px"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
100
- <th width="80"><?php _e('Thumb', 'flag'); ?></th>
101
- <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
102
- <th class="header" width="130"><p><?php _e('Date', 'flag'); ?></p></th>
103
- <th class="header"><p><?php _e('Alt &amp; Title Text', 'flag'); ?></p></th>
104
  </tr>
105
  </thead>
106
  <tfoot>
107
  <tr>
108
- <th><?php _e('ID', 'flag'); ?></th>
109
- <th><?php _e('Thumb', 'flag'); ?></p></th>
110
- <th><?php _e('Filename', 'flag'); ?></th>
111
- <th><?php _e('Date', 'flag'); ?></th>
112
- <th><?php _e('Alt &amp; Title Text', 'flag'); ?></th>
113
  </tr>
114
  </tfoot>
115
  <tbody id="listimages">
@@ -126,9 +126,9 @@ if($picturelist) {
126
 
127
  ?>
128
  <tr id="picture-<?php echo $pid; ?>" class="<?php echo $alternate; ?> iedit" valign="top">
129
- <td scope="row"><strong><?php echo $pid; ?></strong><input type="hidden" name="sortpid-<?php echo $pid; ?>" value="<?php echo $pid; ?>" /></td>
130
  <td><a href="<?php echo $act_gallery_url.$picture->filename; ?>" class="thickbox" title="<?php echo $picture->filename; ?>">
131
- <img class="thumb" src="<?php echo $act_thumbnail_url ."thumbs_" .$picture->filename; ?>" style="width:40px; height:auto;" id="thumb-<?php echo $pid; ?>" />
132
  </a></td>
133
  <td><?php echo $picture->filename; ?></td>
134
  <td><?php echo $date; ?></td>
49
  ?>
50
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
51
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
52
+ <div class="flag-wrap">
53
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
54
 
55
  <form class="alignright" method="POST" action="<?php echo admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID; ?>" accept-charset="utf-8">
92
  });
93
  /*]]>*/
94
  </script>
95
+ <table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >
96
 
97
  <thead>
98
  <tr>
99
+ <th class="header" width="30px"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
100
+ <th width="120"><p><?php _e('Thumb', 'flag'); ?></p></th>
101
+ <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
102
+ <th class="header" width="130"><p><?php _e('Date', 'flag'); ?></p></th>
103
+ <th class="header"><p><?php _e('Alt &amp; Title Text', 'flag'); ?></p></th>
104
  </tr>
105
  </thead>
106
  <tfoot>
107
  <tr>
108
+ <th><p><?php _e('ID', 'flag'); ?></p></th>
109
+ <th><p><?php _e('Thumb', 'flag'); ?></p></th>
110
+ <th><p><?php _e('Filename', 'flag'); ?></p></th>
111
+ <th><p><?php _e('Date', 'flag'); ?></p></th>
112
+ <th><p><?php _e('Alt &amp; Title Text', 'flag'); ?></p></th>
113
  </tr>
114
  </tfoot>
115
  <tbody id="listimages">
126
 
127
  ?>
128
  <tr id="picture-<?php echo $pid; ?>" class="<?php echo $alternate; ?> iedit" valign="top">
129
+ <td><strong><?php echo $pid; ?></strong><input type="hidden" name="sortpid-<?php echo $pid; ?>" value="<?php echo $pid; ?>" /></td>
130
  <td><a href="<?php echo $act_gallery_url.$picture->filename; ?>" class="thickbox" title="<?php echo $picture->filename; ?>">
131
+ <img class="thumb" src="<?php echo $act_thumbnail_url ."thumbs_" .$picture->filename; ?>" style="width:80px; height:auto;" id="thumb-<?php echo $pid; ?>" />
132
  </a></td>
133
  <td><?php echo $picture->filename; ?></td>
134
  <td><?php echo $date; ?></td>
admin/manage-video.php CHANGED
@@ -97,7 +97,7 @@ jQuery(document).ready(function(){
97
  //]]>
98
  </script>
99
 
100
- <div class="wrap">
101
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
102
  <div style="float: right; margin: -20px 3px 0 0;">
103
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Video Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
@@ -127,7 +127,7 @@ jQuery(document).ready(function(){
127
  <tr>
128
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
129
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandvideo playlist=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
130
- <td rowspan="3" align="left" valign="top"><div style="font-size:11px;"><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
131
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
132
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
133
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
@@ -175,7 +175,7 @@ jQuery(document).ready(function(){
175
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
176
  </div>
177
 
178
- <table id="flag-listvideo" class="widefat fixed" cellspacing="0" >
179
 
180
  <thead>
181
  <tr>
@@ -224,7 +224,7 @@ if(count($items_a)) {
224
  echo round($size/1024/1024,2).' Mb';
225
  ?></td>
226
  <td class="thumb">
227
- <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo FLAG_URLPATH; ?>admin/flv_preview.php?vid=<?php echo $flv->ID; ?>&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php echo $flv->ID; ?>" src="<?php echo esc_url($thumb); ?>" width="100" height="100" alt="" /></a>
228
  </td>
229
  <td class="title_filename">
230
  <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
97
  //]]>
98
  </script>
99
 
100
+ <div class="flag-wrap">
101
  <h2><?php _e( 'Playlist', 'flag' ); ?>: <?php echo esc_html($playlist['title']); ?></h2>
102
  <div style="float: right; margin: -20px 3px 0 0;">
103
  <span><a href="<?php echo $filepath; ?>"><?php _e('Back to Video Box', 'flag'); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
127
  <tr>
128
  <th align="left" valign="middle" scope="row"><?php _e('Shortcode', 'flag'); ?>:</th>
129
  <td align="left" valign="middle"><input type="text" readonly="readonly" size="50" onfocus="this.select()" value="[grandvideo playlist=<?php echo sanitize_flagname($_GET['playlist']); ?>]" /></td>
130
+ <td rowspan="3" align="left" valign="top"><div><strong style="display: inline-block; width: 100px;"><?php _e("Playlist Skin", 'flag'); ?>:</strong>
131
  <input id="skinaction" type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
132
  <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
133
  <?php require_once (dirname(__FILE__) . '/get_skin.php');
175
  <input type="submit" name="updatePlaylist" class="button-primary action alignright" value="<?php _e("Update Playlist",'flag')?>" />
176
  </div>
177
 
178
+ <table id="flag-listvideo" class="widefat fixed flag-table" cellspacing="0" >
179
 
180
  <thead>
181
  <tr>
224
  echo round($size/1024/1024,2).' Mb';
225
  ?></td>
226
  <td class="thumb">
227
+ <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo FLAG_URLPATH; ?>admin/flv_preview.php?vid=<?php echo $flv->ID; ?>&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php echo $flv->ID; ?>" src="<?php echo esc_url($thumb); ?>" style="width:auto; height:auto; max-width:100px; max-height:100px;" alt="" /></a>
228
  </td>
229
  <td class="title_filename">
230
  <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
admin/music-box.php CHANGED
@@ -1,59 +1,65 @@
1
  <?php
2
 
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
 
 
4
 
5
  // check for correct capability
6
- if ( !is_user_logged_in() )
7
  die('-1');
 
8
 
9
  // check for correct FlAG capability
10
- if ( !current_user_can('FlAG Manage music') )
11
- die('-1');
 
12
 
13
 
14
- require_once (dirname (__FILE__) . '/functions.php');
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) )
22
  flagAdmin::import_mp3($mp3folder);
 
23
  }
24
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
25
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
26
- if($action == 'no_action') {
27
  $action = false;
28
  }
29
- switch($mode) {
30
  case 'sort':
31
  check_admin_referer('flag_sort');
32
- include_once (dirname (__FILE__) . '/playlist-sort.php');
33
  flag_playlist_order();
34
- break;
35
  case 'edit':
36
  $file = sanitize_flagname($_GET['playlist']);
37
- if(isset($_POST['updatePlaylist'])) {
38
  check_admin_referer('flag_update');
39
  $title = esc_html($_POST['playlist_title']);
40
  $descr = esc_html($_POST['playlist_descr']);
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;
 
45
  $data[] = $item_id;
46
  }
47
  flagGallery::flagSaveWpMedia();
48
- flagSavePlaylist($title,$descr,$data,$file);
49
  }
50
- if(isset($_POST['updatePlaylistSkin'])) {
51
  check_admin_referer('flag_update');
52
  flagSavePlaylistSkin($file);
53
  }
54
- include_once (dirname (__FILE__) . '/manage-playlist.php');
55
  flag_playlist_edit();
56
- break;
57
  case 'save':
58
  if(isset($_POST['items_array'])){
59
  check_admin_referer('flag_update');
@@ -62,469 +68,494 @@ function flag_music_controler() {
62
  $data = $_POST['items_array'];
63
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
64
  flagGallery::flagSaveWpMedia();
65
- flagSavePlaylist($title,$descr,$data, $file);
66
  }
67
- if(isset($_GET['playlist'])) {
68
- include_once (dirname (__FILE__) . '/manage-playlist.php');
69
  flag_playlist_edit();
70
- } else {
71
  flag_created_playlists();
72
  flag_music_wp_media_lib();
73
  }
74
- break;
75
- case 'add':
76
- check_admin_referer('flag_add');
77
  if(isset($_POST['items']) && isset($_GET['playlist'])){
78
  $added = $_POST['items'];
79
- } elseif(isset($_GET['playlist'])) {
80
- $added = $_COOKIE['musicboxplaylist_'.sanitize_flagname($_GET['playlist'])];
81
- } else {
82
  $added = false;
83
  }
84
  flag_music_wp_media_lib($added);
85
- break;
86
  case 'delete':
87
  check_admin_referer('flag_delete');
88
  flag_playlist_delete(sanitize_flagname($_GET['playlist']));
89
- case 'main':
90
- if(isset($_POST['updateMedia'])) {
91
  check_admin_referer('flag_update');
92
  flagGallery::flagSaveWpMedia();
93
- flagGallery::show_message( __('Media updated','flag') );
94
  }
95
  default:
96
  flag_created_playlists();
97
  flag_music_wp_media_lib();
98
- break;
99
  }
100
 
101
  }
102
 
103
- function flag_created_playlists() {
104
 
105
- // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
106
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
107
 
108
  $all_playlists = get_playlists();
109
  $total_all_playlists = count($all_playlists);
110
- $flag_options = get_option ('flag_options');
111
 
112
- ?>
113
- <div class="wrap">
114
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
115
- <table class="widefat" cellspacing="0">
116
  <thead>
117
  <tr>
118
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
119
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
120
- <th scope="col" ><?php _e('Quantity', 'flag'); ?></th>
121
- <th scope="col" ><?php _e('Shortcode', 'flag'); ?></th>
122
- <th scope="col" ><?php _e('Action', 'flag'); ?></th>
123
  </tr>
124
  </thead>
125
  <tbody>
126
- <?php
127
- if($all_playlists) {
128
- foreach((array)$all_playlists as $playlist_file => $playlist_data) {
129
- $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
130
- $class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
131
- $playlist_name = basename($playlist_file, '.xml');
132
- if(count($query_m) != count($playlist_data['items'])) {
133
- flagSavePlaylist($playlist_data['title'],$playlist_data['description'],$playlist_data['items'],$playlist_name);
134
- }
135
- ?>
136
- <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
137
- <td>
138
- <a href="<?php echo esc_url($filepath.'&playlist='.$playlist_name.'&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>" >
139
- <?php echo esc_html($playlist_data['title']); ?>
140
- </a>
141
- </td>
142
- <td><?php echo esc_html($playlist_data['description']); echo '&nbsp;('.__("player", "flag").': <strong>'.esc_html($playlist_data['skin']).'</strong>)' ?></td>
143
- <td><?php echo count($query_m); ?></td>
144
- <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandmusic playlist=<?php echo $playlist_name; ?>]" /></td>
145
- <td>
146
- <a href="<?php echo wp_nonce_url($filepath.'&playlist='.$playlist_name."&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
147
- </td>
148
- </tr>
149
- <?php
150
- }
151
- } else {
152
- echo '<tr><td colspan="5" align="center"><strong>'.__('No playlists found','flag').'</strong></td></tr>';
153
- }
154
- ?>
 
 
155
  </tbody>
156
  </table>
157
  </div>
158
 
159
- <?php }
160
 
161
 
162
  // *** show media list
163
- function flag_music_wp_media_lib($added=false) {
164
  global $wpdb;
165
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
166
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
167
- if($added!==false) {
168
  $added = preg_replace('/[^\d,]+/', '', $added);
169
- $filepath .= '&playlist='.sanitize_flagname($_GET['playlist']).'&mode=save';
170
  $flag_options = get_option('flag_options');
171
- $playlistPath = $flag_options['galleryPath'].'playlists/'.sanitize_flagname($_GET['playlist']).'.xml';
172
- $playlist = get_playlist_data(ABSPATH.$playlistPath);
173
  $exclude = explode(',', $added);
174
  $exclude = array_filter($exclude, 'intval');
175
- } else {
176
  $items_array_default = isset($_COOKIE['musicboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['musicboxplaylist_default']) : '';
177
  $exclude = explode(',', $items_array_default);
178
  $exclude = array_filter($exclude, 'intval');
179
  }
180
  if(isset($_GET['playlist'])){
181
  $playlist_cookie = sanitize_flagname($_GET['playlist']);
182
- } else {
183
  $playlist_cookie = 'default';
184
  }
185
  $filepath = esc_url($filepath);
186
- ?>
187
- <script type="text/javascript">
188
- <!--
189
- jQuery(document).ready(function(){
190
- var storedData = getStorage('musicboxplaylist_');
191
- <?php if(isset($_POST['items'])){
192
  ?>
193
- storedData.set('<?php echo $playlist_cookie; ?>', '<?php echo preg_replace('/[^\d,]+/', '', $_POST['items']); ?>');
194
- <?php } ?>
195
- jQuery('.cb :checkbox').click(function() {
196
- var cur, arr, del;
197
- if(jQuery(this).is(':checked')){
198
- cur = jQuery(this).val();
199
- arr = jQuery('#items_array').val();
200
- if(arr) { del = ','; } else { del = ''; }
201
- jQuery('#items_array').val(arr+del+cur);
202
- jQuery(this).closest('tr').css('background-color','#DDFFBB').next().css('background-color','#DDFFBB');
203
- } else {
204
- cur = jQuery(this).val();
205
- arr = jQuery('#items_array').val().split(',');
206
- arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
207
- jQuery('#items_array').val(arr);
208
- jQuery(this).closest('tr').removeAttr('style').next().removeAttr('style');
209
- }
210
- storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
211
- });
212
- jQuery('.clear_selected').click(function(){
213
- jQuery('#items_array').val('');
214
- jQuery('.cb :checkbox').each(function(){
215
- jQuery(this).prop('checked', false).closest('tr').removeAttr('style').next().removeAttr('style');
216
- });
217
- storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
218
- });
219
- jQuery('.del_thumb').click(function(){
220
- var id = jQuery(this).attr('data-id');
221
- jQuery('#mp3thumb-'+id).attr('value', '');
222
- jQuery('#thumb-'+id).attr('src', '<?php echo site_url()."/wp-includes/images/crystal/audio.png"; ?>');
223
- return false;
224
- });
225
- });
226
- function getStorage(key_prefix) {
227
- return {
228
- set: function (id, data) {
229
- document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
230
- },
231
- get: function (id, data) {
232
- var cookies = document.cookie, parsed = {};
233
- cookies.replace(/([^=]+)=([^;]*);?\s*/g, function (whole, key, value) {
234
- parsed[key] = decodeURIComponent(value);
235
  });
236
- return parsed[key_prefix + id];
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
- };
239
- }
240
 
241
- function checkAll(form) {
242
- for (i = 0, n = form.elements.length; i < n; i++) {
243
- if(form.elements[i].type == "checkbox") {
244
- if(form.elements[i].name == "doaction[]") {
245
- if(form.elements[i].checked == true)
246
- form.elements[i].checked = false;
247
- else
248
- form.elements[i].checked = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  }
250
  }
251
- }
252
- var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
253
- jQuery('#items_array').val(arr);
254
- }
255
- // this function check for a the number of selected images, sumbmit false when no one selected
256
- function checkSelected() {
257
- if(!jQuery('#items_array').val()) {
258
- alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
259
- return false;
260
- }
261
- var actionId = jQuery('#bulkaction').val();
262
- switch (actionId) {
263
- case "new_playlist":
264
- showDialog('new_playlist', 160);
265
- return false;
266
- break;
267
- }
268
- }
269
 
270
- function showDialog( windowId, height ) {
271
- jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
272
- jQuery("#" + windowId + "_mp3id").val(jQuery('#items_array').val());
273
- // console.log (jQuery("#TB_imagelist").val());
274
- tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
275
- }
276
- var current_image = '';
277
- function send_to_editor(html) {
278
- var source = html.match(/src=\".*\" alt/);
279
- source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
280
- //var id = html.match(/wp-image-(\d+(\.\d)*)/ig);
281
- //id = id[0].match(/\d+/);
282
- jQuery('#mp3thumb-'+actInp).attr('value', source);
283
- jQuery('#thumb-'+actInp).attr('src', source);
284
- tb_remove();
285
- }
286
- //-->
287
- </script>
288
- <div class="wrap">
289
- <?php if($added===false) { ?>
290
- <?php if( current_user_can('FlAG Import folder') ) {
291
- $defaultpath = basename(WP_CONTENT_DIR).'/';
292
- ?>
293
- <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css" />
294
- <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
295
- <script type="text/javascript">
296
- /* <![CDATA[ */
297
- jQuery(function() {
298
- jQuery("span.browsefiles").show().click(function(){
299
- jQuery("#file_browser").fileTree({
300
- script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
301
- root: jQuery("#mp3folder").val()
302
- }, function(file) {
303
- //var path = file.replace("<?php echo WINABSPATH; ?>", "");
304
- jQuery("#mp3folder").val(file);
305
- });
306
 
307
- jQuery("#file_browser").show("slide");
308
- });
309
- });
310
- /* ]]> */
311
- </script>
312
 
313
- <!-- import folder -->
314
- <div id="importfolder">
315
- <h2><?php _e('Import mp3 from folder', 'flag'); ?></h2>
316
- <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
317
- <?php wp_nonce_field('flag_addmp3'); ?>
318
- <table class="form-table">
319
- <tr valign="top">
320
- <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
321
- <td><input type="text" size="35" id="mp3folder" name="mp3folder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...',"flag"); ?></span>
322
- <div id="file_browser"></div><br />
323
- <p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
324
- <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
325
- </td>
326
- </tr>
327
- </table>
328
- <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
329
- </form>
330
- </div>
331
- <?php } ?>
332
- <?php } ?>
 
 
 
333
 
334
  <h2><?php _e('WordPress Music Library', 'flag'); ?></h2>
335
- <?php
336
- // look for pagination
337
- if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
338
- $_GET['paged'] = 1;
 
339
 
340
- $_GET['paged'] = intval($_GET['paged']);
341
- $objects_per_page = 25;
342
- $start = ( $_GET['paged'] - 1 ) * $objects_per_page;
343
- $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` = 'audio/mpeg' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
344
- $musiclist = get_posts( $args = array(
345
- 'numberposts' => $objects_per_page,
346
- 'offset' => $start,
347
- 'orderby' => 'ID',
348
- 'order' => 'DESC',
349
- 'post_type' => 'attachment',
350
- 'post_mime_type' => 'audio/mpeg' )
351
- );
352
 
353
- // build pagination
354
- $page_links = paginate_links( array(
355
- 'base' => add_query_arg( 'paged', '%#%' ),
356
- 'format' => '',
357
- 'prev_text' => __('&laquo;'),
358
- 'next_text' => __('&raquo;'),
359
- 'total' => ceil( $img_total_count / $objects_per_page),
360
- 'current' => intval($_GET['paged']),
361
- 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))
362
- ));
363
- ?>
364
- <div class="tablenav" style="overflow: hidden; height: auto;">
365
- <?php if($added===false) { ?>
366
- <div class="alignleft"><b><?php _e('Selected Media','flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>" /> <span class="clear_selected button"><?php _e('Clear Selected','flag'); ?></span></div>
367
- <?php } ?>
368
- <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
369
- number_format_i18n( ( $_GET['paged'] - 1 ) * $objects_per_page + 1 ),
370
- number_format_i18n( min( $_GET['paged'] * $objects_per_page, $img_total_count ) ),
371
- number_format_i18n( $img_total_count ),
372
- $page_links
373
- ); echo $page_links_text; ?></div>
374
- </div>
375
- <form id="musiclib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
376
- <?php wp_nonce_field('flag_update'); ?>
377
- <input type="hidden" name="page" value="music-box" />
378
-
379
- <div class="tablenav">
380
-
381
- <div class="actions">
382
- <?php if($added===false) { ?>
383
- <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media','flag'); ?>" />
384
- <?php if ( function_exists('json_encode') ) { ?>
385
- <select name="bulkaction" id="bulkaction">
386
- <option value="no_action" ><?php _e("No action",'flag'); ?></option>
387
- <option value="new_playlist" ><?php _e("Create new playlist",'flag'); ?></option>
388
- </select>
389
- <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
390
- <?php } ?>
391
- <a href="<?php echo admin_url( 'media-new.php'); ?>" class="button"><?php _e('Upload Music','flag'); ?></a>
392
- <input type="hidden" id="items_array" name="items_array" value="" />
393
- <?php } else { ?>
394
- <input type="hidden" name="mode" value="save" />
395
- <input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>" />
396
- <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>" />
397
- <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
398
- <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
399
- <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
400
- <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist','flag'); ?>" />
401
- <?php } ?>
402
- </div>
403
-
404
  </div>
405
- <table class="widefat" cellspacing="0">
406
- <thead>
407
- <tr>
408
- <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('musiclib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
409
- <th class="id" width="134" scope="col"><div><?php _e('ID', 'flag'); ?></div></th>
410
- <th class="size" width="75" scope="col"><div><?php _e('Size', 'flag'); ?></div></th>
411
- <th class="thumb" width="110" scope="col"><div><?php _e('Thumbnail', 'flag'); ?></div></th>
412
- <th class="title_filename" scope="col"><div><?php _e('Filename / Title', 'flag'); ?></div></th>
413
- <th class="description" scope="col"><div><?php _e('Description', 'flag'); ?></div></th>
414
- </tr>
415
- </thead>
416
- <tfoot>
417
- <tr>
418
- <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('musiclib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
419
- <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
420
- <th class="size" scope="col"><?php _e('Size', 'flag'); ?></th>
421
- <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
422
- <th class="title_filename" scope="col"><?php _e('Filename / Title', 'flag'); ?></th>
423
- <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
424
- </tr>
425
- </tfoot>
426
- <tbody>
427
- <?php
428
- $uploads = wp_upload_dir();
429
- $flag_options = get_option('flag_options');
430
- if($musiclist) {
431
- foreach($musiclist as $mp3) {
432
- $list[] = $mp3->ID;
433
- }
434
- $class = ' class="alternate"';
435
- foreach($musiclist as $mp3) {
436
- $class = ( empty($class) ) ? ' class="alternate"' : '';
437
- $class2 = ( empty($class) ) ? '' : ' alternate';
438
- $ex = $checked = '';
439
- if( ($added!==false || !empty($items_array_default)) && in_array($mp3->ID, $exclude) ) {
440
- $ex = ' style="background-color:#DDFFBB;" title="'.__("Already Added", "flag").'"';
441
- $checked = ' checked="checked"';
442
- }
443
- $bg = ( !isset($class) || $class == 'class="alternate"' ) ? 'f9f9f9' : 'ffffff';
444
- $thumb = $mp3thumb = get_post_meta($mp3->ID, 'thumbnail', true);
445
- if(empty($thumb)) {
446
- $thumb = site_url().'/wp-includes/images/crystal/audio.png';
447
- $mp3thumb = '';
448
- }
449
- $url = wp_get_attachment_url($mp3->ID);
450
- ?>
451
- <tr id="mp3-<?php echo $mp3->ID; ?>"<?php echo $class.$ex; ?>>
452
- <th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $mp3->ID; ?>" /></th>
453
- <td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $mp3->ID; ?></p></td>
454
- <td class="size" style="padding-bottom: 0; border-bottom: none;"><?php
455
- $path = $uploads['basedir'].str_replace($uploads['baseurl'],'',$url);
456
- $size = filesize($path);
457
- echo round($size/1024/1024,2).' Mb';
458
- ?></td>
459
- <td class="thumb" rowspan="2">
460
- <img id="thumb-<?php echo $mp3->ID; ?>" src="<?php echo esc_url($thumb); ?>" width="100" height="100" alt="" />
461
- </td>
462
- <td class="title_filename" rowspan="2">
463
- <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
464
- <textarea title="Title" name="item_a[<?php echo $mp3->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($mp3->post_title)); ?></textarea><br />
465
- <p><?php _e('Thumb URL:', 'flag'); ?> <input id="mp3thumb-<?php echo $mp3->ID; ?>" name="item_a[<?php echo $mp3->ID; ?>][post_thumb]" type="text" value="<?php echo esc_url($mp3thumb); ?>" /> <a class="thickbox" onclick="actInp=<?php echo $mp3->ID; ?>" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php _e('Add an Image','flag'); ?>"><?php _e('assist', 'flag'); ?></a></p>
466
- </td>
467
- <td class="description" rowspan="2">
468
- <textarea name="item_a[<?php echo $mp3->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1" ><?php echo esc_html(stripslashes($mp3->post_content)); ?></textarea>
469
- </td>
470
- </tr>
471
- <tr class="mp3-<?php echo $mp3->ID.$class2; ?>"<?php echo $ex; ?>>
472
- <td valign="top" class="player" colspan="3"><script type="text/javascript">swfobject.embedSWF("<?php echo FLAG_URLPATH; ?>lib/mini.swf", "c-<?php echo $mp3->ID; ?>", "250", "20", "10.1.52", "expressInstall.swf", {path:"<?php echo str_replace(array('.mp3'), array(''), $url); ?>",bgcolor:"<?php echo $flag_options['mpBG'] ?>",color1:"<?php echo $flag_options['mpColor1'] ?>",color2:"<?php echo $flag_options['mpColor2'] ?>"}, {wmode:"transparent"}, {id:"f-<?php echo $mp3->ID; ?>",name:"f-<?php echo $mp3->ID; ?>"});</script>
473
- <div class="play" style="padding-left: 4px;"><span id="c-<?php echo $mp3->ID; ?>"></span></div>
474
- <p style="padding: 7px 3px;">Shortcode:&nbsp;<input type="text" class="shortcode1" readonly="readonly" style="width: 180px; font-size: 9px;" onfocus="this.select()" value="[grandmp3 id=<?php echo $mp3->ID; ?> autoplay=<?php echo $flag_options['mpAutoplay']; ?>]" /></p></td>
475
- </tr>
476
- <?php
477
- }
478
- } else {
479
- echo '<tr><td colspan="6" align="center"><strong>'.__('No music in WordPress Media Library.','flag').'</strong></td></tr>';
480
- }
481
- ?>
482
- </tbody>
483
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  </form>
485
  </div>
486
 
487
  <!-- #new_playlist -->
488
- <div id="new_playlist" style="display: none;" >
489
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
490
- <?php wp_nonce_field('flag_update'); ?>
491
- <input type="hidden" id="new_playlist_mp3id" name="items_array" value="" />
492
- <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value="" />
493
- <input type="hidden" name="mode" value="save" />
494
- <input type="hidden" name="page" value="music-box" />
495
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
496
- <tr valign="top">
497
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title','flag'); ?></th>
498
- <td><input type="text" class="alignleft" name="playlist_title" value="" />
499
- <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
500
- <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
501
- <?php require_once (dirname(__FILE__) . '/get_skin.php');
502
- $all_skins = get_skins($skin_folder='', $type='m');
503
- if(count($all_skins)) {
504
- foreach ( (array)$all_skins as $skin_file => $skin_data) {
505
- echo '<option value="'.dirname($skin_file).'">'.$skin_data['Name'].'</option>'."\n";
506
- }
507
- } else {
508
- echo '<option value="music_default">'.__("No Skins", "flag").'</option>';
509
- }
510
- ?>
511
- </select>
512
- </div>
513
- </td>
514
- </tr>
515
- <tr valign="top">
516
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description','flag'); ?></th>
517
- <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
518
- </tr>
519
- <tr>
520
- <td>&nbsp;</td>
521
- <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
522
- &nbsp; &nbsp; &nbsp;
523
- <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>" />
524
- </td>
525
- </tr>
526
- </table>
 
527
  </form>
528
  </div>
529
- <!-- /#new_playlist -->
530
  <?php }
1
  <?php
2
 
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
4
+ die('You are not allowed to call this page directly.');
5
+ }
6
 
7
  // check for correct capability
8
+ if(!is_user_logged_in()){
9
  die('-1');
10
+ }
11
 
12
  // check for correct FlAG capability
13
+ if(!current_user_can('FlAG Manage music')){
14
+ die('-1');
15
+ }
16
 
17
 
18
+ require_once(dirname(__FILE__) . '/functions.php');
19
+ require_once(dirname(__FILE__) . '/playlist.functions.php');
20
 
21
+ function flag_music_controler(){
22
+ if(isset($_POST['importfolder']) && $_POST['importfolder']){
23
  check_admin_referer('flag_addmp3');
24
  $mp3folder = $_POST['mp3folder'];
25
+ if(!empty($mp3folder)){
26
  flagAdmin::import_mp3($mp3folder);
27
+ }
28
  }
29
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
30
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
31
+ if($action == 'no_action'){
32
  $action = false;
33
  }
34
+ switch($mode){
35
  case 'sort':
36
  check_admin_referer('flag_sort');
37
+ include_once(dirname(__FILE__) . '/playlist-sort.php');
38
  flag_playlist_order();
39
+ break;
40
  case 'edit':
41
  $file = sanitize_flagname($_GET['playlist']);
42
+ if(isset($_POST['updatePlaylist'])){
43
  check_admin_referer('flag_update');
44
  $title = esc_html($_POST['playlist_title']);
45
  $descr = esc_html($_POST['playlist_descr']);
46
  $data = array();
47
+ foreach($_POST['item_a'] as $item_id => $item){
48
+ if($action == 'delete_items' && in_array($item_id, $_POST['doaction'])){
49
  continue;
50
+ }
51
  $data[] = $item_id;
52
  }
53
  flagGallery::flagSaveWpMedia();
54
+ flagSavePlaylist($title, $descr, $data, $file);
55
  }
56
+ if(isset($_POST['updatePlaylistSkin'])){
57
  check_admin_referer('flag_update');
58
  flagSavePlaylistSkin($file);
59
  }
60
+ include_once(dirname(__FILE__) . '/manage-playlist.php');
61
  flag_playlist_edit();
62
+ break;
63
  case 'save':
64
  if(isset($_POST['items_array'])){
65
  check_admin_referer('flag_update');
68
  $data = $_POST['items_array'];
69
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
70
  flagGallery::flagSaveWpMedia();
71
+ flagSavePlaylist($title, $descr, $data, $file);
72
  }
73
+ if(isset($_GET['playlist'])){
74
+ include_once(dirname(__FILE__) . '/manage-playlist.php');
75
  flag_playlist_edit();
76
+ } else{
77
  flag_created_playlists();
78
  flag_music_wp_media_lib();
79
  }
80
+ break;
81
+ case 'add':
82
+ check_admin_referer('flag_add');
83
  if(isset($_POST['items']) && isset($_GET['playlist'])){
84
  $added = $_POST['items'];
85
+ } elseif(isset($_GET['playlist'])){
86
+ $added = $_COOKIE['musicboxplaylist_' . sanitize_flagname($_GET['playlist'])];
87
+ } else{
88
  $added = false;
89
  }
90
  flag_music_wp_media_lib($added);
91
+ break;
92
  case 'delete':
93
  check_admin_referer('flag_delete');
94
  flag_playlist_delete(sanitize_flagname($_GET['playlist']));
95
+ case 'main':
96
+ if(isset($_POST['updateMedia'])){
97
  check_admin_referer('flag_update');
98
  flagGallery::flagSaveWpMedia();
99
+ flagGallery::show_message(__('Media updated', 'flag'));
100
  }
101
  default:
102
  flag_created_playlists();
103
  flag_music_wp_media_lib();
104
+ break;
105
  }
106
 
107
  }
108
 
109
+ function flag_created_playlists(){
110
 
 
111
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
112
 
113
  $all_playlists = get_playlists();
114
  $total_all_playlists = count($all_playlists);
115
+ $flag_options = get_option('flag_options');
116
 
117
+ ?>
118
+ <div class="flag-wrap">
119
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
120
+ <table class="widefat flag-table" cellspacing="0">
121
  <thead>
122
  <tr>
123
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
124
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
125
+ <th scope="col"><?php _e('Quantity', 'flag'); ?></th>
126
+ <th scope="col"><?php _e('Shortcode', 'flag'); ?></th>
127
+ <th scope="col"><?php _e('Action', 'flag'); ?></th>
128
  </tr>
129
  </thead>
130
  <tbody>
131
+ <?php
132
+ if($all_playlists){
133
+ foreach((array) $all_playlists as $playlist_file => $playlist_data){
134
+ $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => - 1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
135
+ $class = (!isset($class) || $class == 'class="alternate"')? '' : 'class="alternate"';
136
+ $playlist_name = basename($playlist_file, '.xml');
137
+ if(count($query_m) != count($playlist_data['items'])){
138
+ flagSavePlaylist($playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name);
139
+ }
140
+ ?>
141
+ <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
142
+ <td>
143
+ <a href="<?php echo esc_url($filepath . '&playlist=' . $playlist_name . '&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>">
144
+ <?php echo esc_html($playlist_data['title']); ?>
145
+ </a>
146
+ </td>
147
+ <td><?php echo esc_html($playlist_data['description']);
148
+ echo '&nbsp;(' . __("player", "flag") . ': <strong>' . esc_html($playlist_data['skin']) . '</strong>)' ?></td>
149
+ <td><?php echo count($query_m); ?></td>
150
+ <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandmusic playlist=<?php echo $playlist_name; ?>]"/></td>
151
+ <td>
152
+ <a href="<?php echo wp_nonce_url($filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?", 'flag') ?>');if(check==false) {return false;
153
+ }"><?php _e('Delete', 'flag'); ?></a>
154
+ </td>
155
+ </tr>
156
+ <?php
157
+ }
158
+ } else{
159
+ echo '<tr><td colspan="5" align="center"><strong>' . __('No playlists found', 'flag') . '</strong></td></tr>';
160
+ }
161
+ ?>
162
  </tbody>
163
  </table>
164
  </div>
165
 
166
+ <?php }
167
 
168
 
169
  // *** show media list
170
+ function flag_music_wp_media_lib($added = false){
171
  global $wpdb;
172
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
173
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
174
+ if($added !== false){
175
  $added = preg_replace('/[^\d,]+/', '', $added);
176
+ $filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
177
  $flag_options = get_option('flag_options');
178
+ $playlistPath = $flag_options['galleryPath'] . 'playlists/' . sanitize_flagname($_GET['playlist']) . '.xml';
179
+ $playlist = get_playlist_data(ABSPATH . $playlistPath);
180
  $exclude = explode(',', $added);
181
  $exclude = array_filter($exclude, 'intval');
182
+ } else{
183
  $items_array_default = isset($_COOKIE['musicboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['musicboxplaylist_default']) : '';
184
  $exclude = explode(',', $items_array_default);
185
  $exclude = array_filter($exclude, 'intval');
186
  }
187
  if(isset($_GET['playlist'])){
188
  $playlist_cookie = sanitize_flagname($_GET['playlist']);
189
+ } else{
190
  $playlist_cookie = 'default';
191
  }
192
  $filepath = esc_url($filepath);
 
 
 
 
 
 
193
  ?>
194
+ <script type="text/javascript">
195
+ <!--
196
+ jQuery(document).ready(function(){
197
+ var storedData = getStorage('musicboxplaylist_');
198
+ <?php if(isset($_POST['items'])){
199
+ ?>
200
+ storedData.set('<?php echo $playlist_cookie; ?>', '<?php echo preg_replace('/[^\d,]+/', '', $_POST['items']); ?>');
201
+ <?php } ?>
202
+ jQuery('.cb :checkbox').click(function(){
203
+ var cur, arr, del;
204
+ if(jQuery(this).is(':checked')){
205
+ cur = jQuery(this).val();
206
+ arr = jQuery('#items_array').val();
207
+ if(arr){ del = ','; } else{ del = ''; }
208
+ jQuery('#items_array').val(arr + del + cur);
209
+ jQuery(this).closest('tbody').addClass('already-added');
210
+ } else{
211
+ cur = jQuery(this).val();
212
+ arr = jQuery('#items_array').val().split(',');
213
+ arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
214
+ jQuery('#items_array').val(arr);
215
+ jQuery(this).closest('tbody').removeClass('already-added');
216
+ }
217
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
218
+ });
219
+ jQuery('.clear_selected').click(function(){
220
+ jQuery('#items_array').val('');
221
+ jQuery('.cb :checkbox').each(function(){
222
+ jQuery(this).prop('checked', false).closest('tbody').removeClass('already-added');
223
+ });
224
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
225
+ });
226
+ jQuery('.del_thumb').click(function(){
227
+ var id = jQuery(this).attr('data-id');
228
+ jQuery('#mp3thumb-' + id).attr('value', '');
229
+ jQuery('#thumb-' + id).attr('src', '<?php echo site_url()."/wp-includes/images/crystal/audio.png"; ?>');
230
+ return false;
 
 
 
 
 
231
  });
232
+ });
233
+ function getStorage(key_prefix){
234
+ return {
235
+ set: function(id, data){
236
+ document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
237
+ },
238
+ get: function(id, data){
239
+ var cookies = document.cookie, parsed = {};
240
+ cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value){
241
+ parsed[key] = decodeURIComponent(value);
242
+ });
243
+ return parsed[key_prefix + id];
244
+ }
245
+ };
246
  }
 
 
247
 
248
+ function checkAll(form){
249
+ for(i = 0, n = form.elements.length; i < n; i++){
250
+ if(form.elements[i].type == "checkbox"){
251
+ if(form.elements[i].name == "doaction[]"){
252
+ if(form.elements[i].checked == true){
253
+ form.elements[i].checked = false;
254
+ } else{
255
+ form.elements[i].checked = true;
256
+ }
257
+ jQuery(form.elements[i]).closest('tbody').toggleClass('already-added');
258
+ }
259
+ }
260
+ }
261
+ var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
262
+ jQuery('#items_array').val(arr);
263
+ }
264
+ // this function check for a the number of selected images, sumbmit false when no one selected
265
+ function checkSelected(){
266
+ if(!jQuery('#items_array').val()){
267
+ alert('<?php echo esc_js(__("No items selected", "flag")); ?>');
268
+ return false;
269
+ }
270
+ var actionId = jQuery('#bulkaction').val();
271
+ switch(actionId){
272
+ case "new_playlist":
273
+ showDialog('new_playlist', 160);
274
+ return false;
275
+ break;
276
  }
277
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
+ function showDialog(windowId, height){
280
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
281
+ jQuery("#" + windowId + "_mp3id").val(jQuery('#items_array').val());
282
+ tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
283
+ }
284
+ var current_image = '';
285
+ function send_to_editor(html){
286
+ var source = html.match(/src=\".*\" alt/);
287
+ source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
288
+ jQuery('#mp3thumb-' + actInp).attr('value', source);
289
+ jQuery('#thumb-' + actInp).attr('src', source);
290
+ tb_remove();
291
+ }
292
+ //-->
293
+ </script>
294
+ <div class="flag-wrap">
295
+ <?php if($added === false){ ?>
296
+ <?php if(current_user_can('FlAG Import folder')){
297
+ $defaultpath = basename(WP_CONTENT_DIR) . '/';
298
+ ?>
299
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
300
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
301
+ <script type="text/javascript">
302
+ /* <![CDATA[ */
303
+ jQuery(function(){
304
+ jQuery("span.browsefiles").show().click(function(){
305
+ jQuery("#file_browser").fileTree({
306
+ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
307
+ root: jQuery("#mp3folder").val()
308
+ }, function(file){
309
+ //var path = file.replace("<?php echo WINABSPATH; ?>", "");
310
+ jQuery("#mp3folder").val(file);
311
+ });
 
 
 
312
 
313
+ jQuery("#file_browser").show("slide");
314
+ });
315
+ });
316
+ /* ]]> */
317
+ </script>
318
 
319
+ <!-- import folder -->
320
+ <div id="importfolder">
321
+ <h2><?php _e('Import mp3 from folder', 'flag'); ?></h2>
322
+
323
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
324
+ <?php wp_nonce_field('flag_addmp3'); ?>
325
+ <table class="form-table">
326
+ <tr valign="top">
327
+ <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
328
+ <td><input type="text" size="35" id="mp3folder" name="mp3folder" value="<?php echo $defaultpath; ?>"/><span class="browsefiles button" style="display:none"><?php _e('Browse...', "flag"); ?></span>
329
+
330
+ <div id="file_browser"></div>
331
+ <br/>
332
+ <p><label><input type="checkbox" name="delete_files" value="delete"/> &nbsp;
333
+ <?php _e('delete files after import in WordPress Media Library', 'flag'); ?></label></p>
334
+ </td>
335
+ </tr>
336
+ </table>
337
+ <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
338
+ </form>
339
+ </div>
340
+ <?php } ?>
341
+ <?php } ?>
342
 
343
  <h2><?php _e('WordPress Music Library', 'flag'); ?></h2>
344
+ <?php
345
+ // look for pagination
346
+ if(!isset($_GET['paged']) || $_GET['paged'] < 1){
347
+ $_GET['paged'] = 1;
348
+ }
349
 
350
+ $_GET['paged'] = intval($_GET['paged']);
351
+ $objects_per_page = 25;
352
+ $start = ($_GET['paged'] - 1) * $objects_per_page;
353
+ $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` = 'audio/mpeg' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
354
+ $musiclist = get_posts($args = array(
355
+ 'numberposts' => $objects_per_page,
356
+ 'offset' => $start,
357
+ 'orderby' => 'ID',
358
+ 'order' => 'DESC',
359
+ 'post_type' => 'attachment',
360
+ 'post_mime_type' => 'audio/mpeg'
361
+ ));
362
 
363
+ // build pagination
364
+ $page_links = paginate_links(array(
365
+ 'base' => add_query_arg('paged', '%#%'),
366
+ 'format' => '',
367
+ 'prev_text' => __('&laquo;'),
368
+ 'next_text' => __('&raquo;'),
369
+ 'total' => ceil($img_total_count / $objects_per_page),
370
+ 'current' => intval($_GET['paged']),
371
+ 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))
372
+ ));
373
+ ?>
374
+ <div class="tablenav" style="overflow: hidden; height: auto;">
375
+ <?php if($added === false){ ?>
376
+ <div class="alignleft"><b><?php _e('Selected Media', 'flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>"/>
377
+ <span class="clear_selected button"><?php _e('Clear Selected', 'flag'); ?></span></div>
378
+ <?php } ?>
379
+ <div class="tablenav-pages"><?php $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $objects_per_page + 1), number_format_i18n(min($_GET['paged'] * $objects_per_page, $img_total_count)), number_format_i18n($img_total_count), $page_links);
380
+ echo $page_links_text; ?></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  </div>
382
+ <form id="musiclib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
383
+ <?php wp_nonce_field('flag_update'); ?>
384
+ <input type="hidden" name="page" value="music-box"/>
385
+
386
+ <div class="tablenav">
387
+
388
+ <div class="actions">
389
+ <?php if($added === false){ ?>
390
+ <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media', 'flag'); ?>"/>
391
+ <?php if(function_exists('json_encode')){ ?>
392
+ <select name="bulkaction" id="bulkaction">
393
+ <option value="no_action"><?php _e("No action", 'flag'); ?></option>
394
+ <option value="new_playlist"><?php _e("Create new playlist", 'flag'); ?></option>
395
+ </select>
396
+ <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply', 'flag'); ?>" onclick="if ( !checkSelected() ) {return false;
397
+ }"/>
398
+ <?php } ?>
399
+ <a href="<?php echo admin_url('media-new.php'); ?>" class="button"><?php _e('Upload Music', 'flag'); ?></a>
400
+ <input type="hidden" id="items_array" name="items_array" value=""/>
401
+ <?php } else{ ?>
402
+ <input type="hidden" name="mode" value="save"/>
403
+ <input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>"/>
404
+ <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>"/>
405
+ <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
406
+ <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
407
+ <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
408
+ <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist', 'flag'); ?>"/>
409
+ <?php } ?>
410
+ </div>
411
+
412
+ </div>
413
+ <table class="widefat flag-table" cellspacing="0">
414
+ <thead>
415
+ <tr>
416
+ <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('musiclib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
417
+ <th class="id" width="134" scope="col">
418
+ <div><?php _e('ID', 'flag'); ?></div>
419
+ </th>
420
+ <th class="size" width="75" scope="col">
421
+ <div><?php _e('Size', 'flag'); ?></div>
422
+ </th>
423
+ <th class="thumb" width="110" scope="col">
424
+ <div><?php _e('Thumbnail', 'flag'); ?></div>
425
+ </th>
426
+ <th class="title_filename" scope="col">
427
+ <div><?php _e('Filename / Title', 'flag'); ?></div>
428
+ </th>
429
+ <th class="description" scope="col">
430
+ <div><?php _e('Description', 'flag'); ?></div>
431
+ </th>
432
+ </tr>
433
+ </thead>
434
+ <tfoot>
435
+ <tr>
436
+ <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('musiclib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
437
+ <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
438
+ <th class="size" scope="col"><?php _e('Size', 'flag'); ?></th>
439
+ <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
440
+ <th class="title_filename" scope="col"><?php _e('Filename / Title', 'flag'); ?></th>
441
+ <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
442
+ </tr>
443
+ </tfoot>
444
+ <?php
445
+ $uploads = wp_upload_dir();
446
+ $flag_options = get_option('flag_options');
447
+ if($musiclist){
448
+ foreach($musiclist as $mp3){
449
+ $list[] = $mp3->ID;
450
+ }
451
+ $class = 'alternate';
452
+ foreach($musiclist as $mp3){
453
+ $class = (empty($class))? 'alternate' : '';
454
+ $ex = $checked = '';
455
+ if(($added !== false || !empty($items_array_default)) && in_array($mp3->ID, $exclude)){
456
+ $class .= ' already-added';
457
+ $ex = ' title="' . __("Already Added", "flag") . '"';
458
+ $checked = ' checked="checked"';
459
+ }
460
+ $thumb = $mp3thumb = get_post_meta($mp3->ID, 'thumbnail', true);
461
+ if(empty($thumb)){
462
+ $thumb = site_url() . '/wp-includes/images/crystal/audio.png';
463
+ $mp3thumb = '';
464
+ }
465
+ $url = wp_get_attachment_url($mp3->ID);
466
+ ?>
467
+ <tbody class="<?php echo $class; ?>"<?php echo $ex; ?>>
468
+ <tr id="mp3-<?php echo $mp3->ID; ?>">
469
+ <th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $mp3->ID; ?>"/></th>
470
+ <td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $mp3->ID; ?></p></td>
471
+ <td class="size" style="padding-bottom: 0; border-bottom: none;"><?php
472
+ $path = $uploads['basedir'] . str_replace($uploads['baseurl'], '', $url);
473
+ $size = filesize($path);
474
+ if($size){
475
+ echo round($size / 1024 / 1024, 2) . ' Mb';
476
+ } else{
477
+ _e("Can't read file size. Perhaps file is broken.", 'flag');
478
+ }
479
+ ?></td>
480
+ <td class="thumb" rowspan="2">
481
+ <img id="thumb-<?php echo $mp3->ID; ?>" src="<?php echo esc_url($thumb); ?>" style="width:auto; height:auto; max-width:100px; max-height:100px;" alt=""/>
482
+ </td>
483
+ <td class="title_filename" rowspan="2">
484
+ <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br/>
485
+ <textarea title="Title" name="item_a[<?php echo $mp3->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($mp3->post_title)); ?></textarea><br/>
486
+ <p><?php _e('Thumb URL:', 'flag'); ?> <input id="mp3thumb-<?php echo $mp3->ID; ?>" name="item_a[<?php echo $mp3->ID; ?>][post_thumb]" type="text" value="<?php echo esc_url($mp3thumb); ?>"/>
487
+ <a class="thickbox" onclick="actInp=<?php echo $mp3->ID; ?>" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php _e('Add an Image', 'flag'); ?>"><?php _e('assist', 'flag'); ?></a>
488
+ </p>
489
+ </td>
490
+ <td class="description" rowspan="2">
491
+ <textarea name="item_a[<?php echo $mp3->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php echo esc_html(stripslashes($mp3->post_content)); ?></textarea>
492
+ </td>
493
+ </tr>
494
+ <tr class="mp3-<?php echo $mp3->ID; ?>">
495
+ <td valign="top" class="player" colspan="3">
496
+ <script type="text/javascript">swfobject.embedSWF("<?php echo FLAG_URLPATH; ?>lib/mini.swf", "c-<?php echo $mp3->ID; ?>", "250", "20", "10.1.52", "expressInstall.swf", {
497
+ path: "<?php echo str_replace(array('.mp3'), array(''), $url); ?>",
498
+ bgcolor: "<?php echo $flag_options['mpBG'] ?>",
499
+ color1: "<?php echo $flag_options['mpColor1'] ?>",
500
+ color2: "<?php echo $flag_options['mpColor2'] ?>"
501
+ }, {wmode: "transparent"}, {id: "f-<?php echo $mp3->ID; ?>", name: "f-<?php echo $mp3->ID; ?>"});</script>
502
+ <div class="play" style="padding-left: 4px;"><span id="c-<?php echo $mp3->ID; ?>"></span></div>
503
+ <p style="padding: 7px 3px;">Shortcode:&nbsp;<input type="text" class="shortcode1" readonly="readonly" style="width: 180px; font-size: 9px;" onfocus="this.select()" value="[grandmp3 id=<?php echo $mp3->ID; ?> autoplay=<?php echo $flag_options['mpAutoplay']; ?>]"/>
504
+ </p></td>
505
+ </tr>
506
+ </tbody>
507
+ <?php
508
+ }
509
+ } else{
510
+ echo '<tr><td colspan="6" align="center"><strong>' . __('No music in WordPress Media Library.', 'flag') . '</strong></td></tr>';
511
+ }
512
+ ?>
513
+ </table>
514
  </form>
515
  </div>
516
 
517
  <!-- #new_playlist -->
518
+ <div id="new_playlist" style="display: none;">
519
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
520
+ <?php wp_nonce_field('flag_update'); ?>
521
+ <input type="hidden" id="new_playlist_mp3id" name="items_array" value=""/>
522
+ <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
523
+ <input type="hidden" name="mode" value="save"/>
524
+ <input type="hidden" name="page" value="music-box"/>
525
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
526
+ <tr valign="top">
527
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title', 'flag'); ?></th>
528
+ <td><input type="text" class="alignleft" name="playlist_title" value=""/>
529
+
530
+ <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
531
+ <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
532
+ <?php require_once(dirname(__FILE__) . '/get_skin.php');
533
+ $all_skins = get_skins($skin_folder = '', $type = 'm');
534
+ if(count($all_skins)){
535
+ foreach((array) $all_skins as $skin_file => $skin_data){
536
+ echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
537
+ }
538
+ } else{
539
+ echo '<option value="music_default">' . __("No Skins", "flag") . '</option>';
540
+ }
541
+ ?>
542
+ </select>
543
+ </div>
544
+ </td>
545
+ </tr>
546
+ <tr valign="top">
547
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description', 'flag'); ?></th>
548
+ <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
549
+ </tr>
550
+ <tr>
551
+ <td>&nbsp;</td>
552
+ <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
553
+ &nbsp; &nbsp; &nbsp;
554
+ <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>"/>
555
+ </td>
556
+ </tr>
557
+ </table>
558
  </form>
559
  </div>
560
+ <!-- /#new_playlist -->
561
  <?php }
admin/overview.php CHANGED
@@ -10,8 +10,8 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
10
  function flag_admin_overview() {
11
  echo get_option('flag_plugin_error');
12
  ?>
13
- <div class="wrap flag-wrap">
14
- <h2><?php _e('Grand Flagallery Overview', 'flag'); echo ' v'.FLAGVERSION; ?></h2>
15
  <div id="flag-overview" class="metabox-holder">
16
  <div id="post-body" class="has-sidebar">
17
  <div class="has-sidebar-content">
@@ -178,37 +178,37 @@ function flag_overview_right_now() {
178
  ?>
179
 
180
  <div class="table table_content">
181
- <p class="sub"><?php _e('At a Glance', 'flag'); ?></p>
182
  <table>
183
- <tbody>
184
  <tr class="first">
185
- <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=1"><?php echo $images; ?></a></td>
186
  <td class="t"><?php echo _n( 'Image', 'Images', $images, 'flag' ); ?></td>
187
- <td class="b"></td>
188
- <td class="last"></td>
189
  </tr>
190
  <tr>
191
- <td class="first b"><a href="admin.php?page=flag-manage-gallery&tabs=0"><?php echo $galleries; ?></a></td>
192
  <td class="t"><?php echo _n( 'Gallery', 'Galleries', $galleries, 'flag' ); ?></td>
193
- <td class="b"></td>
194
- <td class="last"></td>
195
  </tr>
196
- </tbody>
197
  </table>
198
  </div>
199
  <div class="versions">
200
- <p>
201
- <?php if(current_user_can('FlAG Upload images')): ?><a class="button rbutton" href="admin.php?page=flag-manage-gallery&tabs=1"><strong><?php _e('Upload pictures', 'flag'); ?></strong></a><?php endif; ?>
202
- <?php _e('Here you can control your images and galleries.', 'flag'); ?></p>
203
- <span><?php
204
- $userlevel = '<span class="b">' . (current_user_can('manage_options') ? __('Gallery Administrator', 'flag') : __('Gallery Editor', 'flag')) . '</span>';
 
 
 
 
205
  printf(__('You currently have %s rights.', 'flag'), $userlevel);
206
  ?></span>
207
  </div>
208
  <?php
209
  }
210
 
211
- add_meta_box('dashboard_right_now', __('Welcome to FlAGallery !', 'flag'), 'flag_overview_right_now', 'flag-overview', 'normal', 'default');
212
  add_meta_box('flag_server', __('Server Settings', 'flag'), 'flag_overview_server', 'flag-overview', 'normal', 'default');
213
  add_meta_box('flag_gd_lib', __('Graphic Library', 'flag'), 'flag_overview_graphic_lib', 'flag-overview', 'normal', 'default');
214
  add_meta_box('dashboard_primary', __('Setup Box', 'flag'), 'flag_overview_setup', 'flag-overview', 'side', 'core');
10
  function flag_admin_overview() {
11
  echo get_option('flag_plugin_error');
12
  ?>
13
+ <div class="flag-wrap">
14
+ <h2 class="overview-title"><?php _e('Grand Flagallery Overview', 'flag'); echo ' v'.FLAGVERSION; ?></h2>
15
  <div id="flag-overview" class="metabox-holder">
16
  <div id="post-body" class="has-sidebar">
17
  <div class="has-sidebar-content">
178
  ?>
179
 
180
  <div class="table table_content">
181
+ <strong><?php _e('At a Glance', 'flag'); ?>:</strong>
182
  <table>
 
183
  <tr class="first">
 
184
  <td class="t"><?php echo _n( 'Image', 'Images', $images, 'flag' ); ?></td>
185
+ <td>:</td>
186
+ <td class="b"><a href="admin.php?page=flag-manage-gallery&tabs=1"><?php echo $images; ?></a></td>
187
  </tr>
188
  <tr>
 
189
  <td class="t"><?php echo _n( 'Gallery', 'Galleries', $galleries, 'flag' ); ?></td>
190
+ <td>:</td>
191
+ <td class="b"><a href="admin.php?page=flag-manage-gallery&tabs=0"><?php echo $galleries; ?></a></td>
192
  </tr>
 
193
  </table>
194
  </div>
195
  <div class="versions">
196
+ <?php if(current_user_can('FlAG Upload images')): ?>
197
+ <p>
198
+ <?php _e('Here you can control your images and galleries', 'flag'); ?>
199
+ &nbsp;
200
+ <a class="button rbutton" href="admin.php?page=flag-manage-gallery&tabs=1"><strong><?php _e('Upload pictures', 'flag'); ?></strong></a>
201
+ </p>
202
+ <?php endif; ?>
203
+ <span><?php
204
+ $userlevel = '<span class="b">' . (current_user_can('manage_options') ? __('Gallery Administrator', 'flag') : __('Gallery Editor', 'flag')) . '</span>';
205
  printf(__('You currently have %s rights.', 'flag'), $userlevel);
206
  ?></span>
207
  </div>
208
  <?php
209
  }
210
 
211
+ add_meta_box('flag_dashboard_right_now', __('Welcome to FlAGallery !', 'flag'), 'flag_overview_right_now', 'flag-overview', 'normal', 'default');
212
  add_meta_box('flag_server', __('Server Settings', 'flag'), 'flag_overview_server', 'flag-overview', 'normal', 'default');
213
  add_meta_box('flag_gd_lib', __('Graphic Library', 'flag'), 'flag_overview_graphic_lib', 'flag-overview', 'normal', 'default');
214
  add_meta_box('dashboard_primary', __('Setup Box', 'flag'), 'flag_overview_setup', 'flag-overview', 'side', 'core');
admin/playlist-sort.php CHANGED
@@ -14,7 +14,7 @@ function flag_playlist_order($playlist = 'deprecated'){
14
  ?>
15
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
16
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
17
- <div class="wrap">
18
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
19
 
20
  <div class="alignright tablenav" style="margin-bottom: -36px;">
@@ -59,7 +59,7 @@ jQuery(document).ready(function($) {
59
  });
60
  /*]]>*/
61
  </script>
62
- <table id="flag-listitems" class="widefat fixed" cellspacing="0" >
63
 
64
  <thead>
65
  <tr>
14
  ?>
15
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
16
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
17
+ <div class="flag-wrap">
18
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
19
 
20
  <div class="alignright tablenav" style="margin-bottom: -36px;">
59
  });
60
  /*]]>*/
61
  </script>
62
+ <table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >
63
 
64
  <thead>
65
  <tr>
admin/settings.php CHANGED
@@ -133,7 +133,7 @@ function flag_admin_options() {
133
  $flag_options = get_option('flag_options');
134
  ?>
135
 
136
- <div id="slider" class="wrap">
137
 
138
  <ul id="tabs" class="tabs">
139
  <li class="selected"><a href="#" rel="imageoptions"><?php _e('Gallery Options', 'flag'); ?></a></li>
@@ -147,7 +147,6 @@ function flag_admin_options() {
147
  <li><a href="#" rel="roles"><?php _e('Roles', 'flag'); ?></a></li>
148
  <?php endif; ?>
149
  </ul>
150
-
151
  <!-- Image Gallery Options -->
152
  <script type="text/javascript">
153
  jQuery(document).ready(function() {
@@ -444,6 +443,7 @@ jQuery(document).ready(function() {
444
  <form method="POST" name="addroles" id="addroles" accept-charset="utf-8">
445
  <?php wp_nonce_field('flag_addroles'); ?>
446
  <h2><?php _e('Roles / capabilities','flag'); ?></h2>
 
447
  <p><?php _e('Select the lowest role which should be able to access the follow capabilities. Flash Album Gallery supports the standard roles from WordPress.', 'flag'); ?></p>
448
  <table class="form-table">
449
  <tr valign="top">
133
  $flag_options = get_option('flag_options');
134
  ?>
135
 
136
+ <div id="slider" class="flag-wrap">
137
 
138
  <ul id="tabs" class="tabs">
139
  <li class="selected"><a href="#" rel="imageoptions"><?php _e('Gallery Options', 'flag'); ?></a></li>
147
  <li><a href="#" rel="roles"><?php _e('Roles', 'flag'); ?></a></li>
148
  <?php endif; ?>
149
  </ul>
 
150
  <!-- Image Gallery Options -->
151
  <script type="text/javascript">
152
  jQuery(document).ready(function() {
443
  <form method="POST" name="addroles" id="addroles" accept-charset="utf-8">
444
  <?php wp_nonce_field('flag_addroles'); ?>
445
  <h2><?php _e('Roles / capabilities','flag'); ?></h2>
446
+ <div>&nbsp;</div>
447
  <p><?php _e('Select the lowest role which should be able to access the follow capabilities. Flash Album Gallery supports the standard roles from WordPress.', 'flag'); ?></p>
448
  <table class="form-table">
449
  <tr valign="top">
admin/skins.php CHANGED
@@ -291,7 +291,7 @@ if( isset($_GET['skins_refresh']) ) {
291
  flagGallery::show_message( __('Skins refreshed successfully','flag') );
292
  }
293
  ?>
294
- <div id="slider" class="wrap">
295
  <ul id="tabs" class="tabs">
296
  <?php if( current_user_can('FlAG Add skins') ) { ?>
297
  <li class="selected"><a href="#" rel="addskin"><?php _e('Add new skin', 'flag'); ?></a></li>
@@ -302,7 +302,8 @@ if( isset($_GET['skins_refresh']) ) {
302
  <?php if( current_user_can('FlAG Add skins') ) { ?>
303
  <div id="addskin" class="cptab">
304
  <h2><?php _e('Add new skin', 'flag'); ?></h2>
305
- <h4><?php _e('Install a skin in .zip format', 'flag'); ?></h4>
 
306
  <p><?php _e('If you have a skin in a .zip format, You may install it by uploading it here.', 'flag'); ?></p>
307
  <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('admin.php?page=flag-skins'); ?>">
308
  <?php wp_nonce_field( 'skin-upload'); ?>
@@ -343,7 +344,7 @@ if( isset($_GET['skins_refresh']) ) {
343
  </div>
344
  <?php } ?>
345
 
346
- <div class="wrap" style="min-width: 878px;">
347
  <h2><?php _e('Skins', 'flag'); ?>:</h2>
348
  <p style="float: right; display:none;"><a class="button" href="<?php echo wp_nonce_url('admin.php?page=flag-skins&amp;skins_refresh=1', 'skins_refresh'); ?>"><?php _e('Refresh / Update Skins', 'flag'); ?></a></p>
349
  <p><a class="button<?php if(!$type) echo '-primary'; ?>" href="<?php echo admin_url('admin.php?page=flag-skins'); ?>"><span style="font-size: 14px;"><?php _e('Photo skins', 'flag'); ?></span></a>&nbsp;&nbsp;&nbsp;
@@ -464,7 +465,7 @@ function flag_curl_exec_follow($ch, &$maxredirect = null) {
464
  ?>
465
 
466
  <div style="width:70%; overflow: hidden; float: left;">
467
- <table class="widefat" cellspacing="0" id="skins-table">
468
  <thead>
469
  <tr>
470
  <th scope="col" class="manage-column"><?php _e('Skin', 'flag'); ?></th>
291
  flagGallery::show_message( __('Skins refreshed successfully','flag') );
292
  }
293
  ?>
294
+ <div id="slider" class="flag-wrap">
295
  <ul id="tabs" class="tabs">
296
  <?php if( current_user_can('FlAG Add skins') ) { ?>
297
  <li class="selected"><a href="#" rel="addskin"><?php _e('Add new skin', 'flag'); ?></a></li>
302
  <?php if( current_user_can('FlAG Add skins') ) { ?>
303
  <div id="addskin" class="cptab">
304
  <h2><?php _e('Add new skin', 'flag'); ?></h2>
305
+ <div>&nbsp;</div>
306
+ <h4 style="margin-top:0;"><?php _e('Install a skin in .zip format', 'flag'); ?></h4>
307
  <p><?php _e('If you have a skin in a .zip format, You may install it by uploading it here.', 'flag'); ?></p>
308
  <form method="post" enctype="multipart/form-data" action="<?php echo admin_url('admin.php?page=flag-skins'); ?>">
309
  <?php wp_nonce_field( 'skin-upload'); ?>
344
  </div>
345
  <?php } ?>
346
 
347
+ <div class="flag-wrap" style="min-width: 878px;">
348
  <h2><?php _e('Skins', 'flag'); ?>:</h2>
349
  <p style="float: right; display:none;"><a class="button" href="<?php echo wp_nonce_url('admin.php?page=flag-skins&amp;skins_refresh=1', 'skins_refresh'); ?>"><?php _e('Refresh / Update Skins', 'flag'); ?></a></p>
350
  <p><a class="button<?php if(!$type) echo '-primary'; ?>" href="<?php echo admin_url('admin.php?page=flag-skins'); ?>"><span style="font-size: 14px;"><?php _e('Photo skins', 'flag'); ?></span></a>&nbsp;&nbsp;&nbsp;
465
  ?>
466
 
467
  <div style="width:70%; overflow: hidden; float: left;">
468
+ <table class="widefat flag-table" cellspacing="0" id="skins-table">
469
  <thead>
470
  <tr>
471
  <th scope="col" class="manage-column"><?php _e('Skin', 'flag'); ?></th>
admin/tinymce/editor_plugin.js CHANGED
@@ -19,8 +19,8 @@
19
  ed.addCommand('mceFlAG', function() {
20
  ed.windowManager.open({
21
  file : url + '/window.php',
22
- width : 460 + ed.getLang('FlAG.delta_width', 0),
23
- height : 250 + ed.getLang('FlAG.delta_height', 0),
24
  inline : 1
25
  }, {
26
  plugin_url : url // Plugin absolute URL
19
  ed.addCommand('mceFlAG', function() {
20
  ed.windowManager.open({
21
  file : url + '/window.php',
22
+ width : 640 + ed.getLang('FlAG.delta_width', 0),
23
+ height : 480 + ed.getLang('FlAG.delta_height', 0),
24
  inline : 1
25
  }, {
26
  plugin_url : url // Plugin absolute URL
admin/tinymce/popup.css CHANGED
@@ -1,29 +1,25 @@
1
  body {
2
- font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
3
  background:#f1f1f1;
4
  padding:0;
5
  margin:8px 8px 0 8px;
6
  }
7
 
8
  html {background:#f1f1f1;}
9
- td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
10
  textarea {resize:none;outline:none;}
11
  a:link, a:visited {color:black;}
12
  a:hover {color:#2B6FB6;}
13
  .nowrap {white-space: nowrap}
14
-
 
15
  /* Forms */
16
- fieldset {margin:0; padding:4px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:10px;}
17
  legend {color:#2B6FB6; font-weight:bold;}
18
- label.msg {display:none;}
19
- label.invalid {color:#EE0000; display:inline;}
20
- input.invalid {border:1px solid #EE0000;}
21
- input {background:#FFF; border:1px solid #dfdfdf;}
22
- input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
23
- input, select, textarea {border:1px solid #dfdfdf;}
24
- input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
25
- input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
26
- .input_noborder {border:0;}
27
 
28
  /* Buttons */
29
  #insert, #cancel, #apply, .mceActionPanel .button, input.mceButton, .updateButton {
@@ -34,31 +30,19 @@ input.checkbox {border:1px none #000000; background:transparent; vertical-align:
34
  font-size: 11px;
35
  width:94px;
36
  height:24px;
37
- background:url(img/fade-butt.png) 0 0;
38
  color:#000;
39
  cursor:pointer;
40
  -moz-border-radius: 3px;
41
  -khtml-border-radius: 3px;
42
  -webkit-border-radius: 3px;
43
  border-radius: 3px;
 
44
  }
45
  #insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover,
46
  #insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus {
47
  border: 1px solid #555;
48
  }
49
-
50
-
51
- /* Charmap */
52
- table.charmap {border:1px solid #AAA; text-align:center}
53
- td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
54
- #charmap a {display:block; color:#000; text-decoration:none; border:0}
55
- #charmap a:hover {background:#CCC;color:#2B6FB6}
56
- #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
57
- #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
58
- #charmap #charmapView {background-color:#fff;}
59
-
60
- /* Source */
61
- .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
62
  .mceActionPanel {margin-top:5px;}
63
 
64
  /* Tabs classes */
@@ -76,43 +60,13 @@ div.tabs a:link, div.tabs a:visited, div.tabs a:hover {color:black;}
76
  .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
77
  .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
78
 
79
- /* Columns */
80
- .column {float:left;}
81
- .properties {width:100%;}
82
- .properties .column1 {}
83
- .properties .column2 {text-align:left;}
84
-
85
- /* Titles */
86
- h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
87
- h3 {font-size:14px;}
88
- .title {font-size:12px; font-weight:bold; color:#2B6FB6;}
89
-
90
- /* Dialog specific */
91
- #link .panel_wrapper, #link div.current {height:125px;}
92
- #image .panel_wrapper, #image div.current {height:200px;}
93
- #plugintable thead {font-weight:bold; background:#DDD;}
94
- #plugintable, #about #plugintable td {border:1px solid #919B9C;}
95
- #plugintable {width:96%; margin-top:10px;}
96
- #pluginscontainer {height:290px; overflow:auto;}
97
- #colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
98
- #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
99
- #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
100
- #colorpicker #light div {overflow:hidden;}
101
- #colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
102
- #colorpicker .panel_wrapper div.current {height:175px;}
103
- #colorpicker #namedcolors {width:150px;}
104
- #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
105
- #colorpicker #colornamecontainer {margin-top:5px;}
106
- #colorpicker #picker_panel fieldset {margin:auto;width:325px;}
107
-
108
-
109
-
110
  ul#tabs{
111
  display: block;
112
  background:#F1F1F1 none repeat scroll 0%;
113
- font-size:12px;
114
  overflow:hidden;
115
  width: auto;
 
116
  padding: 0 0 0 5px;
117
  /* border-bottom: 1px solid #000000; */
118
  margin-bottom: 0;
@@ -137,7 +91,7 @@ ul.tabs:after { /* clearing without presentational markup, IE gets extra treatme
137
  }
138
  ul.tabs li {
139
  float: left;
140
- padding: 2px 3px;
141
  margin: 2px 2px -1px 1px !important;
142
  text-decoration: none;
143
  list-style: none;
@@ -155,6 +109,7 @@ ul.tabs a {
155
  text-decoration: none;
156
  white-space: nowrap; /* required in IE 6 */
157
  outline: 0; /* prevent dotted border in Firefox */
 
158
  }
159
  ul.tabs .selected{
160
  background: #6D6D6D url(../images/menu-bits.gif) repeat-x scroll left top;
@@ -207,4 +162,9 @@ ul.tabs a:hover, ul.tabs a:focus, ul.tabs a:active { /* @ Opera, we need to be e
207
  display: inline-block;
208
  }
209
 
210
- .cptabs_wrapper .cptab { border:1px solid #919B9C; height:125px; padding: 5px; background: #fefefe; }
 
 
 
 
 
1
  body {
2
+ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;
3
  background:#f1f1f1;
4
  padding:0;
5
  margin:8px 8px 0 8px;
6
  }
7
 
8
  html {background:#f1f1f1;}
9
+ td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;}
10
  textarea {resize:none;outline:none;}
11
  a:link, a:visited {color:black;}
12
  a:hover {color:#2B6FB6;}
13
  .nowrap {white-space: nowrap}
14
+ table {width:100%; border-collapse:collapse;}
15
+ table td { padding:4px 0;}
16
  /* Forms */
17
+ fieldset {margin:0; padding:10px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:12px;}
18
  legend {color:#2B6FB6; font-weight:bold;}
19
+ input {background:#FFF; border:1px solid #dfdfdf; padding:3px 6px;}
20
+ select {padding:3px 6px;}
21
+ input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;}
22
+ input, select, textarea {border:1px solid #dfdfdf; width:100%;}
 
 
 
 
 
23
 
24
  /* Buttons */
25
  #insert, #cancel, #apply, .mceActionPanel .button, input.mceButton, .updateButton {
30
  font-size: 11px;
31
  width:94px;
32
  height:24px;
33
+ background-image:url(img/fade-butt.png);
34
  color:#000;
35
  cursor:pointer;
36
  -moz-border-radius: 3px;
37
  -khtml-border-radius: 3px;
38
  -webkit-border-radius: 3px;
39
  border-radius: 3px;
40
+ text-shadow: none !important;
41
  }
42
  #insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover,
43
  #insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus {
44
  border: 1px solid #555;
45
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  .mceActionPanel {margin-top:5px;}
47
 
48
  /* Tabs classes */
60
  .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
61
  .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ul#tabs{
64
  display: block;
65
  background:#F1F1F1 none repeat scroll 0%;
66
+ font-size:14px;
67
  overflow:hidden;
68
  width: auto;
69
+ height:auto;
70
  padding: 0 0 0 5px;
71
  /* border-bottom: 1px solid #000000; */
72
  margin-bottom: 0;
91
  }
92
  ul.tabs li {
93
  float: left;
94
+ padding: 3px 6px 5px;
95
  margin: 2px 2px -1px 1px !important;
96
  text-decoration: none;
97
  list-style: none;
109
  text-decoration: none;
110
  white-space: nowrap; /* required in IE 6 */
111
  outline: 0; /* prevent dotted border in Firefox */
112
+ font-size: 12px;
113
  }
114
  ul.tabs .selected{
115
  background: #6D6D6D url(../images/menu-bits.gif) repeat-x scroll left top;
162
  display: inline-block;
163
  }
164
 
165
+ .cptabs_wrapper .cptab { border:1px solid #919B9C; padding: 15px; background: #fefefe; }
166
+
167
+ li.albumchoosed { display:none !important; }
168
+ .selectize-control.multi input {width:100% !important;}
169
+ .selectize-control.multi input {width:100% !important;}
170
+ .selectize-control.multi .has-items input {width:4px !important;}
admin/tinymce/tinymce.php CHANGED
@@ -11,7 +11,7 @@ class add_flag_button {
11
 
12
  var $pluginname = 'FlAG';
13
  var $path = '';
14
- var $internalVersion = 100;
15
 
16
  /**
17
  * add_flag_button::add_flag_button()
@@ -112,9 +112,9 @@ class add_flag_button {
112
  jQuery("#ed_toolbar").before('<div class="quicktags-toolbar" style="float:right;"><input type="button" class="ed_button" id="qt_FlAGallery_button" onClick="wpflagins();" value="FlAGallery" /></div>');
113
  });
114
  function wpflagins() {
115
- tb_show("<?php _e('Insert Flash Album with one or more galleries', 'flag'); ?>","<?php echo FLAG_URLPATH; ?>admin/tinymce/window.php?riched=false&TB_iframe=true&width=360&height=210",false);
116
- jQuery("#TB_window").css({width:"460px", height:"310px", marginTop:"-160px", marginLeft:"-230px", top:"50%"});
117
- jQuery("#TB_iframeContent").css({width:"460px", height:"310px"});
118
  jQuery(window).unbind("resize");
119
  }
120
  function bind_resize() {
11
 
12
  var $pluginname = 'FlAG';
13
  var $path = '';
14
+ var $internalVersion = 430;
15
 
16
  /**
17
  * add_flag_button::add_flag_button()
112
  jQuery("#ed_toolbar").before('<div class="quicktags-toolbar" style="float:right;"><input type="button" class="ed_button" id="qt_FlAGallery_button" onClick="wpflagins();" value="FlAGallery" /></div>');
113
  });
114
  function wpflagins() {
115
+ tb_show("<?php _e('Insert Flash Album with one or more galleries', 'flag'); ?>","<?php echo FLAG_URLPATH; ?>admin/tinymce/window.php?riched=false&TB_iframe=true&width=640&height=310",false);
116
+ jQuery("#TB_window").css({width:"640px", height:"310px", marginTop:"-160px", marginLeft:"-320px", top:"50%"});
117
+ jQuery("#TB_iframeContent").css({width:"640px", height:"310px"});
118
  jQuery(window).unbind("resize");
119
  }
120
  function bind_resize() {
admin/tinymce/window.php CHANGED
@@ -23,6 +23,9 @@ if($riched) {
23
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
24
  <script language="javascript" type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/tabs.js"></script>
25
  <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/tinymce/popup.css" />
 
 
 
26
  <base target="_self" />
27
  </head>
28
  <body id="link">
@@ -33,17 +36,16 @@ if($riched) {
33
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
34
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
35
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
36
- <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
37
- <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
38
-
 
 
39
  <base target="_self" />
40
  </head>
41
  <body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('galleries').focus();" style="display: none; font-size: 13px;">
42
  <?php } ?>
43
  <form name="FlAG" action="#">
44
- <?php
45
- if($riched) {
46
- ?>
47
  <div class="cptabs_wrapper">
48
  <ul id="tabs" class="tabs">
49
  <li class="selected"><a href="#" rel="gallery_panel"><span><?php _e( 'Galleries', 'flag' ); ?></span></a></li>
@@ -52,30 +54,18 @@ if($riched) {
52
  <li><a href="#" rel="custom_panel"><span><?php _e( 'Skin', 'flag' ); ?></span></a></li>
53
  <li><a href="#" rel="music_panel"><span><?php _e( 'Music', 'flag' ); ?></span></a></li>
54
  </ul>
55
- <?php } else { ?>
56
- <div class="tabs" style="position:relative; overflow:hidden; margin-bottom:-1px;">
57
- <ul>
58
- <li id="gallery_tab" class="current"><span><a href="javascript:mcTabs.displayTab('gallery_tab','gallery_panel');" onmousedown="return false;"><?php _e( 'Galleries', 'flag' ); ?></a></span></li>
59
- <li id="album_tab"><span><a href="javascript:mcTabs.displayTab('album_tab','album_panel');" onmousedown="return false;"><?php _e( 'Albums', 'flag' ); ?></a></span></li>
60
- <li id="sort_tab"><span><a href="javascript:mcTabs.displayTab('sort_tab','sort_panel');" onmousedown="return false;"><?php _e('Sort', 'flag'); ?></a></span></li>
61
- <li id="custom_tab"><span><a href="javascript:mcTabs.displayTab('custom_tab','custom_panel');" onmousedown="return false;"><?php _e( 'Skin', 'flag' ); ?></a></span></li>
62
- <li id="music_tab"><span><a href="javascript:mcTabs.displayTab('music_tab','music_panel');" onmousedown="return false;"><?php _e( 'Music', 'flag' ); ?></a></span></li>
63
- </ul>
64
- </div>
65
- <div class="panel_wrapper" style="border:1px solid #919B9C; height:130px;">
66
- <?php } ?>
67
-
68
  <!-- gallery panel -->
69
  <div id="gallery_panel" class="panel cptab current">
70
  <table border="0" cellpadding="4" cellspacing="0">
71
  <tr>
72
- <td nowrap="nowrap" valign="middle"><label for="galleryname"><?php _e("Album Name", 'flag'); ?>:<span style="color:red;"> *</span></label></td>
73
- <td valign="middle"><input id="galleryname" name="galleryname" value="Gallery" type="text" style="width: 200px" /></td>
74
  </tr>
75
  <tr>
76
- <td nowrap="nowrap" valign="top"><label for="galleries"><?php _e("Select galleries", 'flag'); ?>:<span style="color:red;"> *</span></label><br /><small><?php _e("(album categories)", 'flag'); ?></small></td>
77
- <td><select id="galleries" name="galleries" style="width: 200px" size="6" multiple="multiple">
78
- <option value="all" selected="selected" onclick="javascript:document.getElementById('sort_tab').style.display='block'" style="font-weight:bold">* - <?php _e("all galleries", 'flag'); ?></option>
79
  <?php
80
  $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']);
81
  if(is_array($gallerylist)) {
@@ -96,9 +86,9 @@ if($riched) {
96
  <div id="album_panel" class="panel cptab">
97
  <table border="0" cellpadding="4" cellspacing="0">
98
  <tr>
99
- <td nowrap="nowrap" valign="top"><label for="album"><?php _e("Select album", 'flag'); ?>:</label></td>
100
- <td><select id="album" name="album" style="width: 200px" size="8">
101
- <option value="" selected="selected"><?php _e("choose album", 'flag'); ?></option>
102
  <?php
103
  $albumlist = $flagdb->find_all_albums('id', 'ASC');
104
  if(is_array($albumlist)) {
@@ -117,8 +107,8 @@ if($riched) {
117
  <div id="custom_panel" class="panel cptab">
118
  <table border="0" cellpadding="4" cellspacing="0">
119
  <tr>
120
- <td nowrap="nowrap" valign="middle"><label for="skinname"><?php _e("Choose skin", 'flag'); ?>:</label></td>
121
- <td valign="middle"><select id="skinname" name="skinname" style="width: 200px">
122
  <option value="" selected="selected"><?php _e("choose custom skin", 'flag'); ?></option>
123
  <?php
124
  foreach ( (array)$all_skins as $skin_file => $skin_data) {
@@ -133,7 +123,7 @@ if($riched) {
133
  </tr>
134
  <tr>
135
  <td valign="top"><label><?php _e("Skin align", 'flag'); ?>:</label></td>
136
- <td valign="top"><select id="skinalign" name="skinalign" style="width: 200px">
137
  <option value="" selected="selected"><?php _e("default", 'flag'); ?></option>
138
  <option value="left"><?php _e("align left", 'flag'); ?></option>
139
  <option value="center"><?php _e("align center", 'flag'); ?></option>
@@ -147,8 +137,8 @@ if($riched) {
147
  <div id="sort_panel" class="panel cptab">
148
  <table border="0" cellpadding="4" cellspacing="0">
149
  <tr>
150
- <td nowrap="nowrap" valign="middle"><label for="galorderby"><?php _e("Order galleries by", 'flag'); ?>:</label></td>
151
- <td valign="middle"><select id="galorderby" name="galorderby" style="width: 200px">
152
  <option value="" selected="selected"><?php _e("Gallery IDs (default)", 'flag'); ?></option>
153
  <option value="title"><?php _e("Gallery Title", 'flag'); ?></option>
154
  <!-- <option value="sortorder"><?php _e("User Defined", 'flag'); ?></option> -->
@@ -157,14 +147,14 @@ if($riched) {
157
  </tr>
158
  <tr>
159
  <td nowrap="nowrap" valign="middle"><label for="galorder"><?php _e("Order", 'flag'); ?>:</label></td>
160
- <td valign="middle"><select id="galorder" name="galorder" style="width: 200px">
161
  <option value="" selected="selected"><?php _e("DESC (default)", 'flag'); ?></option>
162
  <option value="ASC"><?php _e("ASC", 'flag'); ?></option>
163
  </select></td>
164
  </tr>
165
  <tr>
166
  <td nowrap="nowrap" valign="middle"><label for="galexclude"><?php _e("Exclude Gallery", 'flag'); ?>:</label></td>
167
- <td valign="middle"><input id="galexclude" name="galexclude" type="text" style="width: 200px" /></td>
168
  </tr>
169
  </table>
170
  </div>
@@ -173,8 +163,8 @@ if($riched) {
173
  <div id="music_panel" class="panel cptab">
174
  <table border="0" cellpadding="4" cellspacing="0">
175
  <tr>
176
- <td nowrap="nowrap" valign="top"><div style="display: block; width: 100px; white-space: normal;"><?php _e("Choose playlist for background music", 'flag'); ?>:</div></td>
177
- <td valign="middle" valign="top"><select id="playlist" name="playlist" style="width: 200px">
178
  <option value="" selected="selected"><?php _e("choose playlist", 'flag'); ?></option>
179
  <?php
180
  foreach((array)$all_playlists as $playlist_file => $playlist_data) {
@@ -184,7 +174,7 @@ if($riched) {
184
  <?php
185
  }
186
  ?>
187
- </select><p style="padding-top: 10px; margin: 0; font-size: 10px;"><?php _e('Read Skin specification for supporting this function.') ?></p></td>
188
  </tr>
189
  </table>
190
  </div>
@@ -196,7 +186,6 @@ if($riched) {
196
  <input type="button" id="insert" name="insert" value="<?php _e("Insert", 'flag'); ?>" />
197
  </div>
198
  </div>
199
- <?php if($riched) { ?>
200
  <script type="text/javascript">
201
  /* <![CDATA[ */
202
  var cptabs=new ddtabcontent("tabs");
@@ -205,9 +194,36 @@ if($riched) {
205
  cptabs.init();
206
  /* ]]> */
207
  </script>
208
- <?php } ?>
209
  <script type="text/javascript">
210
  /* <![CDATA[ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  var win = window.dialogArguments || opener || parent || top;
212
  jQuery('#insert').click(function(){
213
  var tagtext;
@@ -225,16 +241,21 @@ if($riched) {
225
  var len = gallery.length;
226
  var galleryid="";
227
  var gallerysize="";
228
- if(!album){
229
- for(i=0;i<len;i++)
230
- {
231
- if(gallery.options[i].selected) {
232
- if(galleryid=="") {
233
- galleryid = " gid=" + galleryid + gallery.options[i].value;
234
- } else {
235
- galleryid = galleryid + "," + gallery.options[i].value;
 
 
 
236
  }
237
  }
 
 
238
  }
239
  } else {
240
  galleryname = jQuery('#album option:selected').text();
@@ -287,16 +308,6 @@ if($riched) {
287
  });
288
  /* ]]> */
289
  </script>
290
- <script type="text/javascript">
291
- /* <![CDATA[ */
292
- jQuery('#galleries').change(function(){
293
- jQuery('#sort_tab').hide();
294
- if(jQuery('#galleries option[value=all]:selected')) {
295
- jQuery('#galleries option[value=all]:selected').siblings().removeAttr('selected');
296
- }
297
- });
298
- /* ]]> */
299
- </script>
300
  </form>
301
  </body>
302
  </html>
23
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
24
  <script language="javascript" type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/tabs.js"></script>
25
  <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/tinymce/popup.css" />
26
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/selectize/selectize.css" />
27
+ <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
28
+ <script language="javascript" type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/selectize/selectize.min.js"></script>
29
  <base target="_self" />
30
  </head>
31
  <body id="link">
36
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
37
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
38
  <script language="javascript" type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
39
+ <script language="javascript" type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/tabs.js"></script>
40
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/tinymce/popup.css" />
41
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/selectize/selectize.css" />
42
+ <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
43
+ <script language="javascript" type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/selectize/selectize.min.js"></script>
44
  <base target="_self" />
45
  </head>
46
  <body id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';document.getElementById('galleries').focus();" style="display: none; font-size: 13px;">
47
  <?php } ?>
48
  <form name="FlAG" action="#">
 
 
 
49
  <div class="cptabs_wrapper">
50
  <ul id="tabs" class="tabs">
51
  <li class="selected"><a href="#" rel="gallery_panel"><span><?php _e( 'Galleries', 'flag' ); ?></span></a></li>
54
  <li><a href="#" rel="custom_panel"><span><?php _e( 'Skin', 'flag' ); ?></span></a></li>
55
  <li><a href="#" rel="music_panel"><span><?php _e( 'Music', 'flag' ); ?></span></a></li>
56
  </ul>
57
+
 
 
 
 
 
 
 
 
 
 
 
 
58
  <!-- gallery panel -->
59
  <div id="gallery_panel" class="panel cptab current">
60
  <table border="0" cellpadding="4" cellspacing="0">
61
  <tr>
62
+ <td nowrap="nowrap" valign="middle" width="35%"><label for="galleryname"><?php _e("Album Name", 'flag'); ?>:<span style="color:red;"> *</span></label></td>
63
+ <td valign="middle"><input id="galleryname" name="galleryname" value="Gallery" type="text" /></td>
64
  </tr>
65
  <tr>
66
+ <td nowrap="nowrap" valign="middle"><label for="galleries"><?php _e("Select galleries", 'flag'); ?>:</label><br /><small><?php _e("(album categories)", 'flag'); ?></small></td>
67
+ <td><select id="galleries" name="galleries" size="6" multiple="multiple" placeholder="<?php _e("Leave blank for all galleries", 'flag'); ?>">
68
+ <option value=""><?php _e("Leave blank for all galleries", 'flag'); ?></option>
69
  <?php
70
  $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']);
71
  if(is_array($gallerylist)) {
86
  <div id="album_panel" class="panel cptab">
87
  <table border="0" cellpadding="4" cellspacing="0">
88
  <tr>
89
+ <td nowrap="nowrap" valign="middle" width="35%"><label for="album"><?php _e("Select album", 'flag'); ?>:</label></td>
90
+ <td><select id="album" name="album">
91
+ <option value="galleries"><?php _e("Choose Album or skip to use Galleries", 'flag'); ?></option>
92
  <?php
93
  $albumlist = $flagdb->find_all_albums('id', 'ASC');
94
  if(is_array($albumlist)) {
107
  <div id="custom_panel" class="panel cptab">
108
  <table border="0" cellpadding="4" cellspacing="0">
109
  <tr>
110
+ <td nowrap="nowrap" valign="middle" width="35%"><label for="skinname"><?php _e("Choose skin", 'flag'); ?>:</label></td>
111
+ <td valign="middle"><select id="skinname" name="skinname">
112
  <option value="" selected="selected"><?php _e("choose custom skin", 'flag'); ?></option>
113
  <?php
114
  foreach ( (array)$all_skins as $skin_file => $skin_data) {
123
  </tr>
124
  <tr>
125
  <td valign="top"><label><?php _e("Skin align", 'flag'); ?>:</label></td>
126
+ <td valign="top"><select id="skinalign" name="skinalign">
127
  <option value="" selected="selected"><?php _e("default", 'flag'); ?></option>
128
  <option value="left"><?php _e("align left", 'flag'); ?></option>
129
  <option value="center"><?php _e("align center", 'flag'); ?></option>
137
  <div id="sort_panel" class="panel cptab">
138
  <table border="0" cellpadding="4" cellspacing="0">
139
  <tr>
140
+ <td nowrap="nowrap" valign="middle" width="35%"><label for="galorderby"><?php _e("Order galleries by", 'flag'); ?>:</label></td>
141
+ <td valign="middle"><select id="galorderby" name="galorderby">
142
  <option value="" selected="selected"><?php _e("Gallery IDs (default)", 'flag'); ?></option>
143
  <option value="title"><?php _e("Gallery Title", 'flag'); ?></option>
144
  <!-- <option value="sortorder"><?php _e("User Defined", 'flag'); ?></option> -->
147
  </tr>
148
  <tr>
149
  <td nowrap="nowrap" valign="middle"><label for="galorder"><?php _e("Order", 'flag'); ?>:</label></td>
150
+ <td valign="middle"><select id="galorder" name="galorder">
151
  <option value="" selected="selected"><?php _e("DESC (default)", 'flag'); ?></option>
152
  <option value="ASC"><?php _e("ASC", 'flag'); ?></option>
153
  </select></td>
154
  </tr>
155
  <tr>
156
  <td nowrap="nowrap" valign="middle"><label for="galexclude"><?php _e("Exclude Gallery", 'flag'); ?>:</label></td>
157
+ <td valign="middle"><input id="galexclude" name="galexclude" type="text" /></td>
158
  </tr>
159
  </table>
160
  </div>
163
  <div id="music_panel" class="panel cptab">
164
  <table border="0" cellpadding="4" cellspacing="0">
165
  <tr>
166
+ <td nowrap="nowrap" valign="top" width="35%"><div style="display: block; white-space: normal;"><?php _e("Choose playlist for background music", 'flag'); ?>:</div></td>
167
+ <td valign="middle" valign="top"><select id="playlist" name="playlist">
168
  <option value="" selected="selected"><?php _e("choose playlist", 'flag'); ?></option>
169
  <?php
170
  foreach((array)$all_playlists as $playlist_file => $playlist_data) {
174
  <?php
175
  }
176
  ?>
177
+ </select><p style="padding-top: 10px; margin: 0; font-size: 11px;"><?php _e('Read Skin specification for supporting this function.') ?></p></td>
178
  </tr>
179
  </table>
180
  </div>
186
  <input type="button" id="insert" name="insert" value="<?php _e("Insert", 'flag'); ?>" />
187
  </div>
188
  </div>
 
189
  <script type="text/javascript">
190
  /* <![CDATA[ */
191
  var cptabs=new ddtabcontent("tabs");
194
  cptabs.init();
195
  /* ]]> */
196
  </script>
 
197
  <script type="text/javascript">
198
  /* <![CDATA[ */
199
+
200
+ jQuery('#galleries').selectize({
201
+ plugins: ['drag_drop','remove_button'],
202
+ create: false,
203
+ hideSelected: true,
204
+ onChange: function(value) {
205
+ if (value){
206
+ jQuery('#sort_tab').css('display', 'none');
207
+ } else{
208
+ jQuery('#sort_tab').css('display', 'block');
209
+ }
210
+ }
211
+ });
212
+ jQuery('#album').selectize({
213
+ create: false,
214
+ hideSelected: false,
215
+ onChange: function(value) {
216
+ if (value && (value != 'galleries')){
217
+ jQuery('#sort_tab').css('display', 'none');
218
+ } else{
219
+ if(!jQuery('#galleries').val()){
220
+ jQuery('#sort_tab').css('display', 'block');
221
+ }
222
+ }
223
+ }
224
+ });
225
+
226
+
227
  var win = window.dialogArguments || opener || parent || top;
228
  jQuery('#insert').click(function(){
229
  var tagtext;
241
  var len = gallery.length;
242
  var galleryid="";
243
  var gallerysize="";
244
+ if(!album || 'galleries' == album){
245
+ album = '';
246
+ galleryid = " gid=";
247
+ if(len){
248
+ for(var i = 0; i < len; i++){
249
+ if(gallery.options[i].selected){
250
+ if(galleryid === ' gid='){
251
+ galleryid = galleryid + gallery.options[i].value;
252
+ } else{
253
+ galleryid = galleryid + "," + gallery.options[i].value;
254
+ }
255
  }
256
  }
257
+ } else{
258
+ galleryid = galleryid + "all";
259
  }
260
  } else {
261
  galleryname = jQuery('#album option:selected').text();
308
  });
309
  /* ]]> */
310
  </script>
 
 
 
 
 
 
 
 
 
 
311
  </form>
312
  </body>
313
  </html>
admin/video-box.php CHANGED
@@ -1,59 +1,65 @@
1
  <?php
2
 
3
- if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
 
 
4
 
5
  // check for correct capability
6
- if ( !is_user_logged_in() )
7
  die('-1');
 
8
 
9
  // check for correct FlAG capability
10
- if ( !current_user_can('FlAG Manage video') )
11
- die('-1');
 
12
 
13
 
14
- require_once (dirname (__FILE__) . '/functions.php');
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) && false === strpos($videofolder, '..') )
22
  flagAdmin::import_video($videofolder);
 
23
  }
24
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
25
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
26
- if($action == 'no_action') {
27
  $action = false;
28
  }
29
- switch($mode) {
30
  case 'sort':
31
  check_admin_referer('flag_sort');
32
- include_once (dirname (__FILE__) . '/video-sort.php');
33
  flag_v_playlist_order();
34
- break;
35
  case 'edit':
36
  $file = sanitize_flagname($_GET['playlist']);
37
- if(isset($_POST['updatePlaylist'])) {
38
  check_admin_referer('flag_update');
39
  $title = esc_html($_POST['playlist_title']);
40
  $descr = esc_html($_POST['playlist_descr']);
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;
 
45
  $data[] = $item_id;
46
  }
47
  flagGallery::flagSaveWpMedia();
48
- flagSave_vPlaylist($title,$descr,$data,$file);
49
  }
50
- if(isset($_POST['updatePlaylistSkin'])) {
51
  check_admin_referer('flag_update');
52
  flagSave_vPlaylistSkin($file);
53
  }
54
- include_once (dirname (__FILE__) . '/manage-video.php');
55
  flag_v_playlist_edit();
56
- break;
57
  case 'save':
58
  if(isset($_POST['items_array'])){
59
  check_admin_referer('flag_update');
@@ -62,391 +68,488 @@ function flag_video_controler() {
62
  $data = $_POST['items_array'];
63
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
64
  flagGallery::flagSaveWpMedia();
65
- flagSave_vPlaylist($title,$descr,$data, $file);
66
  }
67
- if(isset($_GET['playlist'])) {
68
- include_once (dirname (__FILE__) . '/manage-video.php');
69
  flag_v_playlist_edit();
70
- } else {
71
  flag_created_v_playlists();
72
  flag_video_wp_media_lib();
73
  }
74
- break;
75
- case 'add':
76
  check_admin_referer('flag_add');
77
- $added = $_POST['items'];
 
 
 
 
 
 
78
  flag_video_wp_media_lib($added);
79
- break;
80
  case 'delete':
81
  check_admin_referer('flag_delete');
82
  flag_v_playlist_delete(sanitize_flagname($_GET['playlist']));
83
- case 'main':
84
- if(isset($_POST['updateMedia'])) {
85
  check_admin_referer('flag_update');
86
  flagGallery::flagSaveWpMedia();
87
- flagGallery::show_message( __('Media updated','flag') );
88
  }
89
  default:
90
  flag_created_v_playlists();
91
  flag_video_wp_media_lib();
92
- break;
93
  }
94
 
95
  }
96
 
97
- function flag_created_v_playlists() {
98
 
99
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
100
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
101
 
102
  $all_playlists = get_v_playlists();
103
  $total_all_playlists = count($all_playlists);
104
- $flag_options = get_option ('flag_options');
105
 
106
- ?>
107
- <div class="wrap">
108
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
109
- <table class="widefat" cellspacing="0">
110
  <thead>
111
  <tr>
112
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
113
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
114
- <th scope="col" ><?php _e('Quantity', 'flag'); ?></th>
115
- <th scope="col" ><?php _e('Shortcode', 'flag'); ?></th>
116
- <th scope="col" ><?php _e('Action', 'flag'); ?></th>
117
  </tr>
118
  </thead>
119
  <tbody>
120
- <?php
121
- if($all_playlists) {
122
- foreach((array)$all_playlists as $playlist_file => $playlist_data) {
123
- $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
124
- $class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
125
- $playlist_name = basename($playlist_file, '.xml');
126
- if(count($query_m) != count($playlist_data['items'])) {
127
- flagSave_vPlaylist($playlist_data['title'],$playlist_data['description'],$playlist_data['items'],$playlist_name);
128
- }
129
- ?>
130
- <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
131
- <td>
132
- <a href="<?php echo esc_url($filepath.'&playlist='.$playlist_name.'&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>" >
133
- <?php echo esc_html($playlist_data['title']); ?>
134
- </a>
135
- </td>
136
- <td><?php echo esc_html($playlist_data['description']); echo '&nbsp;('.__("player", "flag").': <strong>'.esc_html($playlist_data['skin']).'</strong>)' ?></td>
137
- <td><?php echo count($query_m); ?></td>
138
- <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandvideo playlist=<?php echo $playlist_name; ?>]" /></td>
139
- <td>
140
- <a href="<?php echo wp_nonce_url($filepath.'&playlist='.$playlist_name."&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
141
- </td>
142
- </tr>
143
- <?php
144
- }
145
- } else {
146
- echo '<tr><td colspan="5" align="center"><strong>'.__('No playlists found','flag').'</strong></td></tr>';
147
- }
148
- ?>
 
 
149
  </tbody>
150
  </table>
151
  </div>
152
 
153
- <?php } ?>
 
154
 
155
- <?php // *** show media list
156
- function flag_video_wp_media_lib($added=false) {
157
  global $wpdb;
158
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
159
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
160
- if($added!==false) {
161
  $added = preg_replace('/[^\d,]+/', '', $added);
162
- $filepath .= '&playlist='.sanitize_flagname($_GET['playlist']).'&mode=save';
163
  $flag_options = get_option('flag_options');
164
- $playlistPath = $flag_options['galleryPath'].'playlists/video/'.sanitize_flagname($_GET['playlist']).'.xml';
165
- $playlist = get_v_playlist_data(ABSPATH.$playlistPath);
166
  $exclude = explode(',', $added);
167
  $exclude = array_filter($exclude, 'intval');
 
 
 
 
 
 
 
 
 
168
  }
169
  $filepath = esc_url($filepath);
170
- ?>
171
- <script type="text/javascript">
172
- <!--
173
- jQuery(document).ready(function(){
174
- jQuery('.cb :checkbox').click(function() {
175
- var cur, arr, del;
176
- if(jQuery(this).is(':checked')){
177
- cur = jQuery(this).val();
178
- arr = jQuery('#items_array').val();
179
- if(arr) { del = ','; } else { del = ''; }
180
- jQuery('#items_array').val(arr+del+cur);
181
- jQuery(this).closest('tr').css('background-color','#DDFFBB').next().css('background-color','#DDFFBB');
182
- } else {
183
- cur = jQuery(this).val();
184
- arr = jQuery('#items_array').val().split(',');
185
- arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  jQuery('#items_array').val(arr);
187
- jQuery(this).closest('tr').removeAttr('style').next().removeAttr('style');
188
  }
189
- });
190
- jQuery('.del_thumb').click(function(){
191
- var id = jQuery(this).attr('data-id');
192
- jQuery('#flvthumb-'+id).attr('value', '');
193
- jQuery('#thumb-'+id).attr('src', '<?php echo site_url()."/wp-includes/images/crystal/video.png"; ?>');
194
- return false;
195
- })
196
- });
197
- function checkAll(form) {
198
- for (i = 0, n = form.elements.length; i < n; i++) {
199
- if(form.elements[i].type == "checkbox") {
200
- if(form.elements[i].name == "doaction[]") {
201
- if(form.elements[i].checked == true)
202
- form.elements[i].checked = false;
203
- else
204
- form.elements[i].checked = true;
205
  }
206
  }
207
- }
208
- var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
209
- jQuery('#items_array').val(arr);
210
- }
211
- // this function check for a the number of selected images, sumbmit false when no one selected
212
- function checkSelected() {
213
- if(!jQuery('.cb input:checked')) {
214
- alert('<?php echo esc_js(__('No items selected', 'flag')); ?>');
215
- return false;
216
- }
217
- actionId = jQuery('#bulkaction').val();
218
- switch (actionId) {
219
- case "new_playlist":
220
- showDialog('new_playlist', 160);
221
- return false;
222
- break;
223
- }
224
- }
225
 
226
- function showDialog( windowId, height ) {
227
- jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
228
- jQuery("#" + windowId + "_flvid").val(jQuery('#items_array').val());
229
- tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
230
- }
231
- var current_image = '';
232
- function send_to_editor(html) {
233
- var source = html.match(/src=\".*\" alt/);
234
- source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
235
- jQuery('#flvthumb-'+actInp).attr('value', source);
236
- jQuery('#thumb-'+actInp).attr('src', source);
237
- tb_remove();
238
- }
239
- //-->
240
- </script>
241
- <div class="wrap">
242
- <?php if($added===false) { ?>
243
- <?php if( current_user_can('FlAG Import folder') ) {
244
- $defaultpath = basename(WP_CONTENT_DIR).'/';
245
- ?>
246
- <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css" />
247
- <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
248
- <script type="text/javascript">
249
- /* <![CDATA[ */
250
- jQuery(function() {
251
- jQuery("span.browsefiles").show().click(function(){
252
- jQuery("#file_browser").fileTree({
253
- script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
254
- root: jQuery("#videofolder").val()
255
- }, function(file) {
256
- //var path = file.replace("<?php echo WINABSPATH; ?>", "");
257
- jQuery("#videofolder").val(file);
258
- });
259
 
260
- jQuery("#file_browser").show("slide");
261
- });
262
- });
263
- /* ]]> */
264
- </script>
265
 
266
- <!-- import folder -->
267
- <div id="importfolder">
268
- <h2><?php _e('Import video from folder', 'flag'); ?></h2>
269
- <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
270
- <?php wp_nonce_field('flag_addvideo'); ?>
271
- <table class="form-table">
272
- <tr valign="top">
273
- <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
274
- <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>
275
- <div id="file_browser"></div><br />
276
- <p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
277
- <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
278
- </td>
279
- </tr>
280
- </table>
281
- <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
282
- </form>
283
- </div>
284
- <?php } ?>
285
- <?php } ?>
 
 
 
286
 
287
  <h2><?php _e('WordPress Video Library', 'flag'); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
  <form id="videolib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
289
- <?php wp_nonce_field('flag_update'); ?>
290
- <input type="hidden" name="page" value="video-box" />
291
-
292
- <div class="tablenav">
293
-
294
- <div class="actions">
295
- <?php if($added===false) { ?>
296
- <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media','flag'); ?>" />
297
- <?php if ( function_exists('json_encode') ) { ?>
298
- <select name="bulkaction" id="bulkaction">
299
- <option value="no_action" ><?php _e("No action",'flag'); ?></option>
300
- <option value="new_playlist" ><?php _e("Create new playlist",'flag'); ?></option>
301
- </select>
302
- <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
303
- <?php } ?>
304
- <a href="<?php echo admin_url( 'media-new.php'); ?>" class="button"><?php _e('Upload Video','flag'); ?></a>
305
- <input type="hidden" id="items_array" name="items_array" value="" />
306
- <?php } else { ?>
307
- <input type="hidden" name="mode" value="save" />
308
- <input style="width: 80%;" type="text" id="items_array" name="items_array" value="<?php echo $added; ?>" />
309
- <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>" />
310
- <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
311
- <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>" />
312
- <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
313
- <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist','flag'); ?>" />
314
- <?php } ?>
 
 
 
315
  </div>
316
-
317
- </div>
318
- <table class="widefat" cellspacing="0">
319
- <thead>
320
- <tr>
321
- <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
322
- <th class="id" width="134" scope="col"><div><?php _e('ID', 'flag'); ?></div></th>
323
- <th class="size" width="75" scope="col"><div><?php _e('Size', 'flag'); ?></div></th>
324
- <th class="thumb" width="110" scope="col"><div><?php _e('Thumbnail', 'flag'); ?></div></th>
325
- <th class="title_filename" scope="col"><div><?php _e('Filename / Title', 'flag'); ?></div></th>
326
- <th class="description" scope="col"><div><?php _e('Description', 'flag'); ?></div></th>
327
- </tr>
328
- </thead>
329
- <tfoot>
330
- <tr>
331
- <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
332
- <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
333
- <th class="size" scope="col"><?php _e('Size', 'flag'); ?></th>
334
- <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
335
- <th class="title_filename" scope="col"><?php _e('Filename / Title', 'flag'); ?></th>
336
- <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
337
- </tr>
338
- </tfoot>
339
- <tbody>
340
- <?php $videolist = get_posts( $args = array(
341
- 'numberposts' => -1,
342
- 'orderby' => 'ID',
343
- 'order' => 'DESC',
344
- 'post_type' => 'attachment',
345
- 'post_mime_type' => array('video/x-flv') )
346
- );
347
- $uploads = wp_upload_dir();
348
- $flag_options = get_option('flag_options');
349
- if($videolist) {
350
- //echo '<pre>';print_r($videolist); echo '</pre>';
351
- foreach($videolist as $flv) {
352
- $list[] = $flv->ID;
353
- }
354
- $class = ' class="alternate"';
355
- foreach($videolist as $flv) {
356
- $class = ( empty($class) ) ? ' class="alternate"' : '';
357
- $class2 = ( empty($class) ) ? '' : ' alternate';
358
- $ex = $checked = '';
359
- if($added!==false && in_array($flv->ID, $exclude) ) {
360
- $ex = ' style="background-color:#DDFFBB;" title="'.__("Already Added", "flag").'"';
361
- $checked = ' checked="checked"';
362
- }
363
- $bg = ( !isset($class) || $class == 'class="alternate"' ) ? 'f9f9f9' : 'ffffff';
364
- $thumb = $flvthumb = get_post_meta($flv->ID, 'thumbnail', true);
365
- if(empty($thumb)) {
366
- $thumb = site_url().'/wp-includes/images/crystal/video.png';
367
- $flvthumb = '';
368
- }
369
- $url = wp_get_attachment_url($flv->ID);
370
- ?>
371
- <tr id="flv-<?php echo $flv->ID; ?>"<?php echo $class.$ex; ?>>
372
- <th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $flv->ID; ?>" /></th>
373
- <td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $flv->ID; ?></p></td>
374
- <td class="size" style="padding-bottom: 0; border-bottom: none;"><?php
375
- $path = $uploads['basedir'].str_replace($uploads['baseurl'],'',$url);
376
- $size = filesize($path);
377
- if($size){
378
- echo round($size/1024/1024,2).' Mb';
379
- } else {
380
- _e("Can't read file size. Perhaps file is broken.",'flag');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  }
382
- ?></td>
383
- <td class="thumb" rowspan="2">
384
- <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo FLAG_URLPATH; ?>admin/flv_preview.php?vid=<?php echo $flv->ID; ?>&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php echo $flv->ID; ?>" src="<?php echo esc_url($thumb); ?>" width="100" height="100" alt="" /></a>
385
- </td>
386
- <td class="title_filename" rowspan="2">
387
- <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
388
- <textarea title="Title" name="item_a[<?php echo $flv->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($flv->post_title)); ?></textarea><br />
389
- <p><?php _e('Thumb URL:', 'flag'); ?> <input id="flvthumb-<?php echo $flv->ID; ?>" name="item_a[<?php echo $flv->ID; ?>][post_thumb]" type="text" value="<?php echo esc_url($flvthumb); ?>" /> <a class="thickbox" onclick="actInp=<?php echo $flv->ID; ?>" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php _e('Add an Image','flag'); ?>"><?php _e('assist', 'flag'); ?></a></p>
390
- </td>
391
- <td class="description" rowspan="2">
392
- <textarea name="item_a[<?php echo $flv->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1" ><?php echo esc_html(stripslashes($flv->post_content)); ?></textarea>
393
- </td>
394
- </tr>
395
- <tr class="flv-<?php echo $flv->ID.$class2; ?>"<?php echo $ex; ?>>
396
- <td valign="top" class="player" colspan="3"><p style="padding: 7px 3px;">Shortcode:<br /><input type="text" style="width: 240px; font-size: 9px;" class="shortcode1" readonly="readonly" onfocus="this.select()" value="[grandflv id=<?php echo $flv->ID; ?> w=<?php echo $flag_options['vmWidth']; ?> h=<?php echo $flag_options['vmHeight']; ?> autoplay=<?php echo $flag_options['vmAutoplay']; ?>]" /></p></td>
397
- </tr>
398
- <?php
399
- }
400
- } else {
401
- echo '<tr><td colspan="6" align="center"><strong>'.__('No video in WordPress Media Library.','flag').'</strong></td></tr>';
402
- }
403
- ?>
404
- </tbody>
405
- </table>
406
  </form>
407
  </div>
408
 
409
  <!-- #new_playlist -->
410
- <div id="new_playlist" style="display: none;" >
411
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
412
- <?php wp_nonce_field('flag_update'); ?>
413
- <input type="hidden" id="new_playlist_flvid" name="items_array" value="" />
414
- <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value="" />
415
- <input type="hidden" name="mode" value="save" />
416
- <input type="hidden" name="page" value="video-box" />
417
- <table width="100%" border="0" cellspacing="3" cellpadding="3" >
418
- <tr valign="top">
419
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title','flag'); ?></th>
420
- <td><input type="text" class="alignleft" name="playlist_title" value="" />
421
- <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
422
- <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
423
- <?php require_once (dirname(__FILE__) . '/get_skin.php');
424
- $all_skins = get_skins($skin_folder='', $type='v');
425
- if(count($all_skins)) {
426
- foreach ( (array)$all_skins as $skin_file => $skin_data) {
427
- echo '<option value="'.dirname($skin_file).'">'.$skin_data['Name'].'</option>'."\n";
428
- }
429
- } else {
430
- echo '<option value="video_default">'.__("No Skins", "flag").'</option>';
431
- }
432
- ?>
433
- </select>
434
- </div>
435
- </td>
436
- </tr>
437
- <tr valign="top">
438
- <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description','flag'); ?></th>
439
- <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
440
- </tr>
441
- <tr>
442
- <td>&nbsp;</td>
443
- <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
444
- &nbsp; &nbsp; &nbsp;
445
- <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>" />
446
- </td>
447
- </tr>
448
- </table>
 
449
  </form>
450
  </div>
451
- <!-- /#new_playlist -->
452
  <?php }
1
  <?php
2
 
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])){
4
+ die('You are not allowed to call this page directly.');
5
+ }
6
 
7
  // check for correct capability
8
+ if(!is_user_logged_in()){
9
  die('-1');
10
+ }
11
 
12
  // check for correct FlAG capability
13
+ if(!current_user_can('FlAG Manage video')){
14
+ die('-1');
15
+ }
16
 
17
 
18
+ require_once(dirname(__FILE__) . '/functions.php');
19
+ require_once(dirname(__FILE__) . '/video.functions.php');
20
 
21
+ function flag_video_controler(){
22
+ if(isset($_POST['importfolder']) && $_POST['importfolder']){
23
  check_admin_referer('flag_addvideo');
24
  $videofolder = $_POST['videofolder'];
25
+ if(!empty($videofolder) && false === strpos($videofolder, '..')){
26
  flagAdmin::import_video($videofolder);
27
+ }
28
  }
29
  $mode = isset($_REQUEST['mode'])? $_REQUEST['mode'] : 'main';
30
  $action = isset($_REQUEST['bulkaction'])? $_REQUEST['bulkaction'] : false;
31
+ if($action == 'no_action'){
32
  $action = false;
33
  }
34
+ switch($mode){
35
  case 'sort':
36
  check_admin_referer('flag_sort');
37
+ include_once(dirname(__FILE__) . '/video-sort.php');
38
  flag_v_playlist_order();
39
+ break;
40
  case 'edit':
41
  $file = sanitize_flagname($_GET['playlist']);
42
+ if(isset($_POST['updatePlaylist'])){
43
  check_admin_referer('flag_update');
44
  $title = esc_html($_POST['playlist_title']);
45
  $descr = esc_html($_POST['playlist_descr']);
46
  $data = array();
47
+ foreach($_POST['item_a'] as $item_id => $item){
48
+ if($action == 'delete_items' && in_array($item_id, $_POST['doaction'])){
49
  continue;
50
+ }
51
  $data[] = $item_id;
52
  }
53
  flagGallery::flagSaveWpMedia();
54
+ flagSave_vPlaylist($title, $descr, $data, $file);
55
  }
56
+ if(isset($_POST['updatePlaylistSkin'])){
57
  check_admin_referer('flag_update');
58
  flagSave_vPlaylistSkin($file);
59
  }
60
+ include_once(dirname(__FILE__) . '/manage-video.php');
61
  flag_v_playlist_edit();
62
+ break;
63
  case 'save':
64
  if(isset($_POST['items_array'])){
65
  check_admin_referer('flag_update');
68
  $data = $_POST['items_array'];
69
  $file = isset($_REQUEST['playlist'])? sanitize_flagname($_REQUEST['playlist']) : false;
70
  flagGallery::flagSaveWpMedia();
71
+ flagSave_vPlaylist($title, $descr, $data, $file);
72
  }
73
+ if(isset($_GET['playlist'])){
74
+ include_once(dirname(__FILE__) . '/manage-video.php');
75
  flag_v_playlist_edit();
76
+ } else{
77
  flag_created_v_playlists();
78
  flag_video_wp_media_lib();
79
  }
80
+ break;
81
+ case 'add':
82
  check_admin_referer('flag_add');
83
+ if(isset($_POST['items']) && isset($_GET['playlist'])){
84
+ $added = $_POST['items'];
85
+ } elseif(isset($_GET['playlist'])){
86
+ $added = $_COOKIE['videoboxplaylist_' . sanitize_flagname($_GET['playlist'])];
87
+ } else{
88
+ $added = false;
89
+ }
90
  flag_video_wp_media_lib($added);
91
+ break;
92
  case 'delete':
93
  check_admin_referer('flag_delete');
94
  flag_v_playlist_delete(sanitize_flagname($_GET['playlist']));
95
+ case 'main':
96
+ if(isset($_POST['updateMedia'])){
97
  check_admin_referer('flag_update');
98
  flagGallery::flagSaveWpMedia();
99
+ flagGallery::show_message(__('Media updated', 'flag'));
100
  }
101
  default:
102
  flag_created_v_playlists();
103
  flag_video_wp_media_lib();
104
+ break;
105
  }
106
 
107
  }
108
 
109
+ function flag_created_v_playlists(){
110
 
111
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
112
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
113
 
114
  $all_playlists = get_v_playlists();
115
  $total_all_playlists = count($all_playlists);
116
+ $flag_options = get_option('flag_options');
117
 
118
+ ?>
119
+ <div class="flag-wrap">
120
  <h2><?php _e('Created playlists', 'flag'); ?></h2>
121
+ <table class="widefat flag-table" cellspacing="0">
122
  <thead>
123
  <tr>
124
  <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
125
  <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
126
+ <th scope="col"><?php _e('Quantity', 'flag'); ?></th>
127
+ <th scope="col"><?php _e('Shortcode', 'flag'); ?></th>
128
+ <th scope="col"><?php _e('Action', 'flag'); ?></th>
129
  </tr>
130
  </thead>
131
  <tbody>
132
+ <?php
133
+ if($all_playlists){
134
+ foreach((array) $all_playlists as $playlist_file => $playlist_data){
135
+ $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => - 1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
136
+ $class = (!isset($class) || $class == 'class="alternate"')? '' : 'class="alternate"';
137
+ $playlist_name = basename($playlist_file, '.xml');
138
+ if(count($query_m) != count($playlist_data['items'])){
139
+ flagSave_vPlaylist($playlist_data['title'], $playlist_data['description'], $playlist_data['items'], $playlist_name);
140
+ }
141
+ ?>
142
+ <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
143
+ <td>
144
+ <a href="<?php echo esc_url($filepath . '&playlist=' . $playlist_name . '&mode=edit'); ?>" class='edit' title="<?php _e('Edit'); ?>">
145
+ <?php echo esc_html($playlist_data['title']); ?>
146
+ </a>
147
+ </td>
148
+ <td><?php echo esc_html($playlist_data['description']);
149
+ echo '&nbsp;(' . __("player", "flag") . ': <strong>' . esc_html($playlist_data['skin']) . '</strong>)' ?></td>
150
+ <td><?php echo count($query_m); ?></td>
151
+ <td style="white-space: nowrap;"><input type="text" class="shortcode1" style="width: 200px; font-size: 9px;" readonly="readonly" onfocus="this.select()" value="[grandvideo playlist=<?php echo $playlist_name; ?>]"/></td>
152
+ <td>
153
+ <a href="<?php echo wp_nonce_url($filepath . '&playlist=' . $playlist_name . "&mode=delete", 'flag_delete'); ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?", 'flag') ?>');if(check==false) {return false;
154
+ }"><?php _e('Delete', 'flag'); ?></a>
155
+ </td>
156
+ </tr>
157
+ <?php
158
+ }
159
+ } else{
160
+ echo '<tr><td colspan="5" align="center"><strong>' . __('No playlists found', 'flag') . '</strong></td></tr>';
161
+ }
162
+ ?>
163
  </tbody>
164
  </table>
165
  </div>
166
 
167
+ <?php }
168
+
169
 
170
+ // *** show media list
171
+ function flag_video_wp_media_lib($added = false){
172
  global $wpdb;
173
  // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
174
  $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']);
175
+ if($added !== false){
176
  $added = preg_replace('/[^\d,]+/', '', $added);
177
+ $filepath .= '&playlist=' . sanitize_flagname($_GET['playlist']) . '&mode=save';
178
  $flag_options = get_option('flag_options');
179
+ $playlistPath = $flag_options['galleryPath'] . 'playlists/video/' . sanitize_flagname($_GET['playlist']) . '.xml';
180
+ $playlist = get_v_playlist_data(ABSPATH . $playlistPath);
181
  $exclude = explode(',', $added);
182
  $exclude = array_filter($exclude, 'intval');
183
+ } else{
184
+ $items_array_default = isset($_COOKIE['videoboxplaylist_default'])? preg_replace('/[^\d,]+/', '', $_COOKIE['videoboxplaylist_default']) : '';
185
+ $exclude = explode(',', $items_array_default);
186
+ $exclude = array_filter($exclude, 'intval');
187
+ }
188
+ if(isset($_GET['playlist'])){
189
+ $playlist_cookie = sanitize_flagname($_GET['playlist']);
190
+ } else{
191
+ $playlist_cookie = 'default';
192
  }
193
  $filepath = esc_url($filepath);
194
+ ?>
195
+ <script type="text/javascript">
196
+ <!--
197
+ jQuery(document).ready(function(){
198
+ var storedData = getStorage('videoboxplaylist_');
199
+ <?php if(isset($_POST['items'])){
200
+ ?>
201
+ storedData.set('<?php echo $playlist_cookie; ?>', '<?php echo preg_replace('/[^\d,]+/', '', $_POST['items']); ?>');
202
+ <?php } ?>
203
+ jQuery('.cb :checkbox').click(function(){
204
+ var cur, arr, del;
205
+ if(jQuery(this).is(':checked')){
206
+ cur = jQuery(this).val();
207
+ arr = jQuery('#items_array').val();
208
+ if(arr){ del = ','; } else{ del = ''; }
209
+ jQuery('#items_array').val(arr + del + cur);
210
+ jQuery(this).closest('tbody').addClass('already-added');
211
+ } else{
212
+ cur = jQuery(this).val();
213
+ arr = jQuery('#items_array').val().split(',');
214
+ arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
215
+ jQuery('#items_array').val(arr);
216
+ jQuery(this).closest('tbody').removeClass('already-added');
217
+ }
218
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
219
+ });
220
+ jQuery('.clear_selected').click(function(){
221
+ jQuery('#items_array').val('');
222
+ jQuery('.cb :checkbox').each(function(){
223
+ jQuery(this).prop('checked', false).closest('tbody').removeClass('already-added');
224
+ });
225
+ storedData.set('<?php echo $playlist_cookie; ?>', jQuery('#items_array').val());
226
+ });
227
+ jQuery('.del_thumb').click(function(){
228
+ var id = jQuery(this).attr('data-id');
229
+ jQuery('#flvthumb-' + id).attr('value', '');
230
+ jQuery('#thumb-' + id).attr('src', '<?php echo site_url()."/wp-includes/images/crystal/video.png"; ?>');
231
+ return false;
232
+ })
233
+ });
234
+ function getStorage(key_prefix){
235
+ return {
236
+ set: function(id, data){
237
+ document.cookie = key_prefix + id + '=' + encodeURIComponent(data);
238
+ },
239
+ get: function(id, data){
240
+ var cookies = document.cookie, parsed = {};
241
+ cookies.replace(/([^=]+)=([^;]*);?\s*/g, function(whole, key, value){
242
+ parsed[key] = decodeURIComponent(value);
243
+ });
244
+ return parsed[key_prefix + id];
245
+ }
246
+ };
247
+ }
248
+
249
+ function checkAll(form){
250
+ for(i = 0, n = form.elements.length; i < n; i++){
251
+ if(form.elements[i].type == "checkbox"){
252
+ if(form.elements[i].name == "doaction[]"){
253
+ if(form.elements[i].checked == true){
254
+ form.elements[i].checked = false;
255
+ } else{
256
+ form.elements[i].checked = true;
257
+ }
258
+ jQuery(form.elements[i]).closest('tbody').toggleClass('already-added');
259
+ }
260
+ }
261
+ }
262
+ var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
263
  jQuery('#items_array').val(arr);
 
264
  }
265
+ // this function check for a the number of selected images, sumbmit false when no one selected
266
+ function checkSelected(){
267
+ if(!jQuery('#items_array').val()){
268
+ alert('<?php echo esc_js(__('No items selected', 'flag')); ?>');
269
+ return false;
270
+ }
271
+ var actionId = jQuery('#bulkaction').val();
272
+ switch(actionId){
273
+ case "new_playlist":
274
+ showDialog('new_playlist', 160);
275
+ return false;
276
+ break;
 
 
 
 
277
  }
278
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
+ function showDialog(windowId, height){
281
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
282
+ jQuery("#" + windowId + "_flvid").val(jQuery('#items_array').val());
283
+ tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
284
+ }
285
+ var current_image = '';
286
+ function send_to_editor(html){
287
+ var source = html.match(/src=\".*\" alt/);
288
+ source = source[0].replace(/^src=\"/, "").replace(/" alt$/, "");
289
+ jQuery('#flvthumb-' + actInp).attr('value', source);
290
+ jQuery('#thumb-' + actInp).attr('src', source);
291
+ tb_remove();
292
+ }
293
+ //-->
294
+ </script>
295
+ <div class="flag-wrap">
296
+ <?php if($added === false){ ?>
297
+ <?php if(current_user_can('FlAG Import folder')){
298
+ $defaultpath = basename(WP_CONTENT_DIR) . '/';
299
+ ?>
300
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css"/>
301
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
302
+ <script type="text/javascript">
303
+ /* <![CDATA[ */
304
+ jQuery(function(){
305
+ jQuery("span.browsefiles").show().click(function(){
306
+ jQuery("#file_browser").fileTree({
307
+ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
308
+ root: jQuery("#videofolder").val()
309
+ }, function(file){
310
+ //var path = file.replace("<?php echo WINABSPATH; ?>", "");
311
+ jQuery("#videofolder").val(file);
312
+ });
313
 
314
+ jQuery("#file_browser").show("slide");
315
+ });
316
+ });
317
+ /* ]]> */
318
+ </script>
319
 
320
+ <!-- import folder -->
321
+ <div id="importfolder">
322
+ <h2><?php _e('Import video from folder', 'flag'); ?></h2>
323
+
324
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
325
+ <?php wp_nonce_field('flag_addvideo'); ?>
326
+ <table class="form-table">
327
+ <tr valign="top">
328
+ <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
329
+ <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>
330
+
331
+ <div id="file_browser"></div>
332
+ <br/>
333
+ <p><label><input type="checkbox" name="delete_files" value="delete"/> &nbsp;
334
+ <?php _e('delete files after import in WordPress Media Library', 'flag'); ?></label></p>
335
+ </td>
336
+ </tr>
337
+ </table>
338
+ <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
339
+ </form>
340
+ </div>
341
+ <?php } ?>
342
+ <?php } ?>
343
 
344
  <h2><?php _e('WordPress Video Library', 'flag'); ?></h2>
345
+ <?php
346
+ // look for pagination
347
+ if(!isset($_GET['paged']) || $_GET['paged'] < 1){
348
+ $_GET['paged'] = 1;
349
+ }
350
+
351
+ $_GET['paged'] = intval($_GET['paged']);
352
+ $objects_per_page = 25;
353
+ $start = ($_GET['paged'] - 1) * $objects_per_page;
354
+ $img_total_count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE `post_mime_type` = 'video/x-flv' AND `post_type` = 'attachment' AND `post_status` = 'inherit'");
355
+ $videolist = get_posts($args = array(
356
+ 'numberposts' => $objects_per_page,
357
+ 'offset' => $start,
358
+ 'orderby' => 'ID',
359
+ 'order' => 'DESC',
360
+ 'post_type' => 'attachment',
361
+ 'post_mime_type' => 'video/x-flv'
362
+ ));
363
+
364
+ // build pagination
365
+ $page_links = paginate_links(array(
366
+ 'base' => add_query_arg('paged', '%#%'),
367
+ 'format' => '',
368
+ 'prev_text' => __('&laquo;'),
369
+ 'next_text' => __('&raquo;'),
370
+ 'total' => ceil($img_total_count / $objects_per_page),
371
+ 'current' => intval($_GET['paged']),
372
+ 'add_args' => array('_wpnonce' => wp_create_nonce('flag_add'))
373
+ ));
374
+ ?>
375
+ <div class="tablenav" style="overflow: hidden; height: auto;">
376
+ <?php if($added === false){ ?>
377
+ <div class="alignleft"><b><?php _e('Selected Media', 'flag'); ?>: </b><input style="width:500px;" type="text" readonly="readonly" id="items_array" name="items_array" value="<?php echo $items_array_default; ?>"/>
378
+ <span class="clear_selected button"><?php _e('Clear Selected', 'flag'); ?></span></div>
379
+ <?php } ?>
380
+ <div class="tablenav-pages"><?php $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $objects_per_page + 1), number_format_i18n(min($_GET['paged'] * $objects_per_page, $img_total_count)), number_format_i18n($img_total_count), $page_links);
381
+ echo $page_links_text; ?></div>
382
+ </div>
383
  <form id="videolib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
384
+ <?php wp_nonce_field('flag_update'); ?>
385
+ <input type="hidden" name="page" value="video-box"/>
386
+
387
+ <div class="tablenav">
388
+
389
+ <div class="actions">
390
+ <?php if($added === false){ ?>
391
+ <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media', 'flag'); ?>"/>
392
+ <?php if(function_exists('json_encode')){ ?>
393
+ <select name="bulkaction" id="bulkaction">
394
+ <option value="no_action"><?php _e("No action", 'flag'); ?></option>
395
+ <option value="new_playlist"><?php _e("Create new playlist", 'flag'); ?></option>
396
+ </select>
397
+ <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply', 'flag'); ?>" onclick="if ( !checkSelected() ) {return false;
398
+ }"/>
399
+ <?php } ?>
400
+ <a href="<?php echo admin_url('media-new.php'); ?>" class="button"><?php _e('Upload Video', 'flag'); ?></a>
401
+ <input type="hidden" id="items_array" name="items_array" value=""/>
402
+ <?php } else{ ?>
403
+ <input type="hidden" name="mode" value="save"/>
404
+ <input style="width: 80%;" type="text" id="items_array" name="items_array" readonly="readonly" value="<?php echo $added; ?>"/>
405
+ <input type="hidden" name="playlist_title" value="<?php echo esc_html($playlist['title']); ?>"/>
406
+ <input type="hidden" name="skinname" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
407
+ <input type="hidden" name="skinaction" value="<?php echo sanitize_flagname($playlist['skin']); ?>"/>
408
+ <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo esc_html($playlist['description']); ?></textarea>
409
+ <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist', 'flag'); ?>"/>
410
+ <?php } ?>
411
+ </div>
412
+
413
  </div>
414
+ <table class="widefat flag-table" cellspacing="0">
415
+ <thead>
416
+ <tr>
417
+ <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
418
+ <th class="id" width="134" scope="col">
419
+ <div><?php _e('ID', 'flag'); ?></div>
420
+ </th>
421
+ <th class="size" width="75" scope="col">
422
+ <div><?php _e('Size', 'flag'); ?></div>
423
+ </th>
424
+ <th class="thumb" width="110" scope="col">
425
+ <div><?php _e('Thumbnail', 'flag'); ?></div>
426
+ </th>
427
+ <th class="title_filename" scope="col">
428
+ <div><?php _e('Filename / Title', 'flag'); ?></div>
429
+ </th>
430
+ <th class="description" scope="col">
431
+ <div><?php _e('Description', 'flag'); ?></div>
432
+ </th>
433
+ </tr>
434
+ </thead>
435
+ <tfoot>
436
+ <tr>
437
+ <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('videolib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
438
+ <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
439
+ <th class="size" scope="col"><?php _e('Size', 'flag'); ?></th>
440
+ <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
441
+ <th class="title_filename" scope="col"><?php _e('Filename / Title', 'flag'); ?></th>
442
+ <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
443
+ </tr>
444
+ </tfoot>
445
+ <?php
446
+ $uploads = wp_upload_dir();
447
+ $flag_options = get_option('flag_options');
448
+ if($videolist){
449
+ foreach($videolist as $flv){
450
+ $list[] = $flv->ID;
451
+ }
452
+ $class = 'alternate';
453
+ foreach($videolist as $flv){
454
+ $class = (empty($class))? 'alternate' : '';
455
+ $ex = $checked = '';
456
+ if(($added !== false || !empty($items_array_default)) && in_array($flv->ID, $exclude)){
457
+ $class .= ' already-added';
458
+ $ex = ' title="' . __("Already Added", "flag") . '"';
459
+ $checked = ' checked="checked"';
460
+ }
461
+ $thumb = $flvthumb = get_post_meta($flv->ID, 'thumbnail', true);
462
+ if(empty($thumb)){
463
+ $thumb = site_url() . '/wp-includes/images/crystal/video.png';
464
+ $flvthumb = '';
465
+ }
466
+ $url = wp_get_attachment_url($flv->ID);
467
+ ?>
468
+ <tbody class="<?php echo $class; ?>"<?php echo $ex; ?>>
469
+ <tr id="flv-<?php echo $flv->ID; ?>">
470
+ <th class="cb" scope="row" height="24" style="padding-bottom: 0; border-bottom: none;"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $flv->ID; ?>"/></th>
471
+ <td class="id" style="padding-bottom: 0; border-bottom: none;"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $flv->ID; ?></p></td>
472
+ <td class="size" style="padding-bottom: 0; border-bottom: none;"><?php
473
+ $path = $uploads['basedir'] . str_replace($uploads['baseurl'], '', $url);
474
+ $size = filesize($path);
475
+ if($size){
476
+ echo round($size / 1024 / 1024, 2) . ' Mb';
477
+ } else{
478
+ _e("Can't read file size. Perhaps file is broken.", 'flag');
479
+ }
480
+ ?></td>
481
+ <td class="thumb" rowspan="2">
482
+ <a class="thickbox" title="<?php echo basename($url); ?>" href="<?php echo FLAG_URLPATH; ?>admin/flv_preview.php?vid=<?php echo $flv->ID; ?>&amp;TB_iframe=1&amp;width=490&amp;height=293"><img id="thumb-<?php echo $flv->ID; ?>" src="<?php echo esc_url($thumb); ?>" style="width:auto; height:auto; max-width:100px; max-height:100px;" alt=""/></a>
483
+ </td>
484
+ <td class="title_filename" rowspan="2">
485
+ <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br/>
486
+ <textarea title="Title" name="item_a[<?php echo $flv->ID; ?>][post_title]" cols="20" rows="1" style="width:95%; height: 25px; overflow:hidden;"><?php echo esc_html(stripslashes($flv->post_title)); ?></textarea><br/>
487
+ <p><?php _e('Thumb URL:', 'flag'); ?> <input id="flvthumb-<?php echo $flv->ID; ?>" name="item_a[<?php echo $flv->ID; ?>][post_thumb]" type="text" value="<?php echo esc_url($flvthumb); ?>"/>
488
+ <a class="thickbox" onclick="actInp=<?php echo $flv->ID; ?>" href="media-upload.php?type=image&amp;TB_iframe=1&amp;width=640&amp;height=400" title="<?php _e('Add an Image', 'flag'); ?>"><?php _e('assist', 'flag'); ?></a>
489
+ </p>
490
+ </td>
491
+ <td class="description" rowspan="2">
492
+ <textarea name="item_a[<?php echo $flv->ID; ?>][post_content]" style="width:95%; height: 96px; margin-top: 2px; font-size:12px; line-height:115%;" rows="1"><?php echo esc_html(stripslashes($flv->post_content)); ?></textarea>
493
+ </td>
494
+ </tr>
495
+ <tr class="flv-<?php echo $flv->ID; ?>">
496
+ <td valign="top" class="player" colspan="3">
497
+ <p style="padding: 7px 3px;">Shortcode:<br/><input type="text" style="width: 240px; font-size: 9px;" class="shortcode1" readonly="readonly" onfocus="this.select()" value="[grandflv id=<?php echo $flv->ID; ?> w=<?php echo $flag_options['vmWidth']; ?> h=<?php echo $flag_options['vmHeight']; ?> autoplay=<?php echo $flag_options['vmAutoplay']; ?>]"/>
498
+ </p></td>
499
+ </tr>
500
+ </tbody>
501
+ <?php
502
+ }
503
+ } else{
504
+ echo '<tr><td colspan="6" align="center"><strong>' . __('No video in WordPress Media Library.', 'flag') . '</strong></td></tr>';
505
  }
506
+ ?>
507
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  </form>
509
  </div>
510
 
511
  <!-- #new_playlist -->
512
+ <div id="new_playlist" style="display: none;">
513
  <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
514
+ <?php wp_nonce_field('flag_update'); ?>
515
+ <input type="hidden" id="new_playlist_flvid" name="items_array" value=""/>
516
+ <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value=""/>
517
+ <input type="hidden" name="mode" value="save"/>
518
+ <input type="hidden" name="page" value="video-box"/>
519
+ <table width="100%" border="0" cellspacing="3" cellpadding="3">
520
+ <tr valign="top">
521
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title', 'flag'); ?></th>
522
+ <td><input type="text" class="alignleft" name="playlist_title" value=""/>
523
+
524
+ <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
525
+ <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
526
+ <?php require_once(dirname(__FILE__) . '/get_skin.php');
527
+ $all_skins = get_skins($skin_folder = '', $type = 'v');
528
+ if(count($all_skins)){
529
+ foreach((array) $all_skins as $skin_file => $skin_data){
530
+ echo '<option value="' . dirname($skin_file) . '">' . $skin_data['Name'] . '</option>' . "\n";
531
+ }
532
+ } else{
533
+ echo '<option value="video_default">' . __("No Skins", "flag") . '</option>';
534
+ }
535
+ ?>
536
+ </select>
537
+ </div>
538
+ </td>
539
+ </tr>
540
+ <tr valign="top">
541
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description', 'flag'); ?></th>
542
+ <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
543
+ </tr>
544
+ <tr>
545
+ <td>&nbsp;</td>
546
+ <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
547
+ &nbsp; &nbsp; &nbsp;
548
+ <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>"/>
549
+ </td>
550
+ </tr>
551
+ </table>
552
  </form>
553
  </div>
554
+ <!-- /#new_playlist -->
555
  <?php }
admin/video-sort.php CHANGED
@@ -19,7 +19,7 @@ function flag_v_playlist_order($playlist = 'deprecated'){
19
  ?>
20
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
21
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
22
- <div class="wrap">
23
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
24
 
25
  <div class="alignright tablenav" style="margin-bottom: -36px;">
@@ -64,22 +64,22 @@ jQuery(document).ready(function($) {
64
  });
65
  /*]]>*/
66
  </script>
67
- <table id="flag-listitems" class="widefat fixed" cellspacing="0" >
68
 
69
  <thead>
70
  <tr>
71
  <th class="header" width="54"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
72
- <th width="260"><div><?php _e('Play', 'flag'); ?></div></th>
73
  <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
74
  <th class="header"><p><?php _e('Title', 'flag'); ?></p></th>
75
  </tr>
76
  </thead>
77
  <tfoot>
78
  <tr>
79
- <th><?php _e('ID', 'flag'); ?></th>
80
- <th><?php _e('Play', 'flag'); ?></th>
81
- <th><?php _e('Filename', 'flag'); ?></th>
82
- <th><?php _e('Title', 'flag'); ?></th>
83
  </tr>
84
  </tfoot>
85
  <tbody id="listitems">
19
  ?>
20
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
21
  <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
22
+ <div class="flag-wrap">
23
  <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
24
 
25
  <div class="alignright tablenav" style="margin-bottom: -36px;">
64
  });
65
  /*]]>*/
66
  </script>
67
+ <table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >
68
 
69
  <thead>
70
  <tr>
71
  <th class="header" width="54"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
72
+ <th width="260"><p><?php _e('Play', 'flag'); ?></p></th>
73
  <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
74
  <th class="header"><p><?php _e('Title', 'flag'); ?></p></th>
75
  </tr>
76
  </thead>
77
  <tfoot>
78
  <tr>
79
+ <th><p><?php _e('ID', 'flag'); ?></p></th>
80
+ <th><p><?php _e('Play', 'flag'); ?></p></th>
81
+ <th><p><?php _e('Filename', 'flag'); ?></p></th>
82
+ <th><p><?php _e('Title', 'flag'); ?></p></th>
83
  </tr>
84
  </tfoot>
85
  <tbody id="listitems">
flag.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: GRAND Flash Album Gallery
4
  Plugin URI: http://codeasily.com/wordpress-plugins/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: 4.29
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
@@ -23,7 +23,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
- var $version = '4.29';
27
  var $dbversion = '2.75';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '3.0';
@@ -289,12 +289,6 @@ class flagLoad {
289
  }
290
 
291
  function activate() {
292
- //Since version 0.40 it's tested only with PHP5.2, currently we keep PHP4 support a while
293
- //if (version_compare(PHP_VERSION, '5.2.0', '<')) {
294
- // deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
295
- // wp_die("Sorry, but you can't run this plugin, it requires PHP 5.2 or higher.");
296
- // return;
297
- //}
298
  include_once (dirname (__FILE__) . '/admin/flag_install.php');
299
  // check for tables
300
  flag_install();
3
  Plugin Name: GRAND Flash Album Gallery
4
  Plugin URI: http://codeasily.com/wordpress-plugins/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: 4.30
7
  Author: Rattus
8
  Author URI: http://codeasily.com/
9
 
23
  if (!class_exists('flagLoad')) {
24
  class flagLoad {
25
 
26
+ var $version = '4.30';
27
  var $dbversion = '2.75';
28
  var $minium_WP = '3.0';
29
  var $minium_WPMU = '3.0';
289
  }
290
 
291
  function activate() {
 
 
 
 
 
 
292
  include_once (dirname (__FILE__) . '/admin/flag_install.php');
293
  // check for tables
294
  flag_install();
lib/app.php CHANGED
@@ -12,11 +12,10 @@ if(isset($_REQUEST['account'])){
12
  $flag_options = get_option ('flag_options');
13
  if(empty($flag_options['access_key']) || $account->access_key != $flag_options['access_key']){ die('{"status":"key_error"}'); }
14
 
 
15
  $current_plugins = get_option('active_plugins', array());
16
  if (!in_array('flash-album-gallery/flag.php', (array) $current_plugins)) {
17
- if(isset($account->add_category)) {
18
- die('{"status":"gallery_error"}');
19
- }
20
  echo json_encode($r);
21
  die();
22
  }
@@ -219,7 +218,6 @@ if(isset($_REQUEST['account'])){
219
  }
220
  }
221
  $r['data'] = stripslashes_deep($r['data']);
222
- $r['flag_version'] = get_option('flagVersion');
223
 
224
  echo json_encode($r);
225
  die();
12
  $flag_options = get_option ('flag_options');
13
  if(empty($flag_options['access_key']) || $account->access_key != $flag_options['access_key']){ die('{"status":"key_error"}'); }
14
 
15
+ $r['flag_version'] = get_option('flagVersion');
16
  $current_plugins = get_option('active_plugins', array());
17
  if (!in_array('flash-album-gallery/flag.php', (array) $current_plugins)) {
18
+ $r['status'] = 'plugin_error';
 
 
19
  echo json_encode($r);
20
  die();
21
  }
218
  }
219
  }
220
  $r['data'] = stripslashes_deep($r['data']);
 
221
 
222
  echo json_encode($r);
223
  die();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Rattus
3
  Donate link: http://photogallerycreator.com/grand-flagallery/
4
  Tags: admin, flash gallery, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, photo gallery, slider, plugin, slideshow, video, widget, iphone gallery, best gallery, portfolio, image rotator
5
  Requires at least: 3.0
6
- Tested up to: 4.1.0
7
  Stable tag: trunk
8
 
9
  Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your image galleries and media content
@@ -52,6 +52,11 @@ Also available mp3 players and widgets.
52
 
53
  == Changelog ==
54
 
 
 
 
 
 
55
  = v4.29 - 21.01.2015 =
56
  * Fixed warning on Skins page when open_basedir = 'Off'
57
 
3
  Donate link: http://photogallerycreator.com/grand-flagallery/
4
  Tags: admin, flash gallery, fullscreen gallery, gallery, image, images, image gallery, mp3, music, page, photo, photo gallery, slider, plugin, slideshow, video, widget, iphone gallery, best gallery, portfolio, image rotator
5
  Requires at least: 3.0
6
+ Tested up to: 4.1.1
7
  Stable tag: trunk
8
 
9
  Photo Gallery, Video Gallery, Music Album & Banner Rotator plugin with powerfull admin to manage your image galleries and media content
52
 
53
  == Changelog ==
54
 
55
+ = v4.30 - 18.02.2015 =
56
+ * Added Combobox for search and insert galleries when insert shortcode
57
+ (Select gallerires in order you need for shortcode, drag'n'drop galleries inside combobox)
58
+ * Fixed and improved CSS on all admin pages
59
+
60
  = v4.29 - 21.01.2015 =
61
  * Fixed warning on Skins page when open_basedir = 'Off'
62