Gallery – Flagallery Photo Portfolio - Version 2.11

Version Description

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

Release Info

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

Version 2.11

Files changed (177) hide show
  1. admin/addgallery.php +301 -0
  2. admin/admin.php +301 -0
  3. admin/ajax.php +266 -0
  4. admin/banner-box.php +460 -0
  5. admin/banner-sort.php +120 -0
  6. admin/banner.functions.php +179 -0
  7. admin/css/flagSorter.css +76 -0
  8. admin/css/flagadmin.css +260 -0
  9. admin/css/flagallery.css +8 -0
  10. admin/css/flagallery_nocrawler.css +12 -0
  11. admin/css/flagallery_noflash.css +19 -0
  12. admin/css/tabs.css +126 -0
  13. admin/db_skin_color_scheme.php +122 -0
  14. admin/facebook-tool.php +272 -0
  15. admin/flag_install.php +330 -0
  16. admin/flv_preview.php +19 -0
  17. admin/functions.php +1316 -0
  18. admin/get_skin.php +140 -0
  19. admin/grab_meta.php +38 -0
  20. admin/images/asc.gif +0 -0
  21. admin/images/browser.png +0 -0
  22. admin/images/desc.gif +0 -0
  23. admin/images/fail.png +0 -0
  24. admin/images/flag.png +0 -0
  25. admin/images/hits.png +0 -0
  26. admin/images/loadingAnimation.gif +0 -0
  27. admin/images/lock.png +0 -0
  28. admin/images/mail.png +0 -0
  29. admin/images/map.png +0 -0
  30. admin/images/menu-bits.gif +0 -0
  31. admin/images/notes.png +0 -0
  32. admin/images/reset.png +0 -0
  33. admin/images/sortbg.gif +0 -0
  34. admin/images/wallpaper.png +0 -0
  35. admin/jgallery.php +110 -0
  36. admin/js/Jcrop/css/Jcrop.gif +0 -0
  37. admin/js/Jcrop/css/jquery.Jcrop.css +37 -0
  38. admin/js/Jcrop/js/jquery.Jcrop.js +255 -0
  39. admin/js/disablescroll.js +55 -0
  40. admin/js/farbtastic-nosharp.js +345 -0
  41. admin/js/flag.ajax.js +116 -0
  42. admin/js/flag.progressbar.js +80 -0
  43. admin/js/flagscroll.js +33 -0
  44. admin/js/images/arrows.png +0 -0
  45. admin/js/images/blank.gif +0 -0
  46. admin/js/images/bullets.png +0 -0
  47. admin/js/images/fancy_close.png +0 -0
  48. admin/js/images/fancy_loading.png +0 -0
  49. admin/js/images/fancy_nav_left.png +0 -0
  50. admin/js/images/fancy_nav_right.png +0 -0
  51. admin/js/images/fancy_nav_slide.png +0 -0
  52. admin/js/images/fancy_shadow_e.png +0 -0
  53. admin/js/images/fancy_shadow_n.png +0 -0
  54. admin/js/images/fancy_shadow_ne.png +0 -0
  55. admin/js/images/fancy_shadow_nw.png +0 -0
  56. admin/js/images/fancy_shadow_s.png +0 -0
  57. admin/js/images/fancy_shadow_se.png +0 -0
  58. admin/js/images/fancy_shadow_sw.png +0 -0
  59. admin/js/images/fancy_shadow_w.png +0 -0
  60. admin/js/images/fancy_title_left.png +0 -0
  61. admin/js/images/fancy_title_main.png +0 -0
  62. admin/js/images/fancy_title_over.png +0 -0
  63. admin/js/images/fancy_title_right.png +0 -0
  64. admin/js/images/fancybox-x.png +0 -0
  65. admin/js/images/fancybox-y.png +0 -0
  66. admin/js/images/fancybox.png +0 -0
  67. admin/js/images/loading.gif +0 -0
  68. admin/js/jquery.MultiFile.js +535 -0
  69. admin/js/jquery.MultiFile.pack.js +11 -0
  70. admin/js/jquery.dataset.js +167 -0
  71. admin/js/jquery.easing-1.3.pack.js +72 -0
  72. admin/js/jquery.fancybox-1.3.4.css +91 -0
  73. admin/js/jquery.fancybox-1.3.4.pack.js +46 -0
  74. admin/js/jquery.js +18 -0
  75. admin/js/jquery.nivo.slider.pack.js +10 -0
  76. admin/js/jquery.tablednd_0_5.js +382 -0
  77. admin/js/jquery.tablesorter.js +852 -0
  78. admin/js/jqueryFileTree/images/application.png +0 -0
  79. admin/js/jqueryFileTree/images/directory.png +0 -0
  80. admin/js/jqueryFileTree/images/film.png +0 -0
  81. admin/js/jqueryFileTree/images/flash.png +0 -0
  82. admin/js/jqueryFileTree/images/folder_open.png +0 -0
  83. admin/js/jqueryFileTree/images/music.png +0 -0
  84. admin/js/jqueryFileTree/images/pdf.png +0 -0
  85. admin/js/jqueryFileTree/images/picture.png +0 -0
  86. admin/js/jqueryFileTree/images/spinner.gif +0 -0
  87. admin/js/jqueryFileTree/images/zip.png +0 -0
  88. admin/js/jqueryFileTree/jqueryFileTree.css +81 -0
  89. admin/js/jqueryFileTree/jqueryFileTree.js +98 -0
  90. admin/js/loader.swf +0 -0
  91. admin/js/nivo-slider.css +120 -0
  92. admin/js/photoswipe/MIT-license.txt +21 -0
  93. admin/js/photoswipe/code.photoswipe.jquery-3.0.5.min.js +164 -0
  94. admin/js/photoswipe/images/error.gif +0 -0
  95. admin/js/photoswipe/images/icons.png +0 -0
  96. admin/js/photoswipe/images/icons@2x.png +0 -0
  97. admin/js/photoswipe/images/loader.gif +0 -0
  98. admin/js/photoswipe/klass.min.js +8 -0
  99. admin/js/photoswipe/photoswipe.css +196 -0
  100. admin/js/script.js +278 -0
  101. admin/js/swfaddress-optimizer.js +1 -0
  102. admin/js/swfaddress.js +1 -0
  103. admin/js/swfmousewheel.js +51 -0
  104. admin/js/swfobject.js +31 -0
  105. admin/js/swfupload.handler.js +153 -0
  106. admin/js/swfupload.js +986 -0
  107. admin/js/swfupload.swf +0 -0
  108. admin/js/tabcontent.js +159 -0
  109. admin/js/tabs.js +159 -0
  110. admin/js/themes/bar/arrows.png +0 -0
  111. admin/js/themes/bar/bullets.png +0 -0
  112. admin/js/themes/bar/loading.gif +0 -0
  113. admin/js/themes/bar/styles.css +132 -0
  114. admin/js/themes/dark/arrows.png +0 -0
  115. admin/js/themes/dark/bullets.png +0 -0
  116. admin/js/themes/dark/loading.gif +0 -0
  117. admin/js/themes/dark/styles.css +102 -0
  118. admin/js/themes/default/arrows.png +0 -0
  119. admin/js/themes/default/bullets.png +0 -0
  120. admin/js/themes/default/loading.gif +0 -0
  121. admin/js/themes/default/styles.css +101 -0
  122. admin/js/themes/light/arrows.png +0 -0
  123. admin/js/themes/light/bullets.png +0 -0
  124. admin/js/themes/light/loading.gif +0 -0
  125. admin/js/themes/light/styles.css +102 -0
  126. admin/js/widgets_admin.js +20 -0
  127. admin/manage-banner.php +254 -0
  128. admin/manage-galleries.php +367 -0
  129. admin/manage-images.php +609 -0
  130. admin/manage-playlist.php +265 -0
  131. admin/manage-sort.php +153 -0
  132. admin/manage-video.php +260 -0
  133. admin/manage.php +422 -0
  134. admin/manage_thumbnail.php +174 -0
  135. admin/media-upload.php +234 -0
  136. admin/meta_box.php +167 -0
  137. admin/music-box.php +443 -0
  138. admin/news.php +13 -0
  139. admin/overview.php +468 -0
  140. admin/playlist-sort.php +118 -0
  141. admin/playlist.functions.php +149 -0
  142. admin/settings.php +460 -0
  143. admin/showmeta.php +123 -0
  144. admin/skin_install.php +143 -0
  145. admin/skin_options.php +83 -0
  146. admin/skins.php +484 -0
  147. admin/tinymce/editor_plugin.js +78 -0
  148. admin/tinymce/flag.gif +0 -0
  149. admin/tinymce/img/butt2.png +0 -0
  150. admin/tinymce/img/button_bg.png +0 -0
  151. admin/tinymce/img/down_arrow.gif +0 -0
  152. admin/tinymce/img/fade-butt.png +0 -0
  153. admin/tinymce/img/separator.gif +0 -0
  154. admin/tinymce/img/tabs.gif +0 -0
  155. admin/tinymce/langs/de.js +6 -0
  156. admin/tinymce/langs/de_de.js +6 -0
  157. admin/tinymce/langs/en.js +6 -0
  158. admin/tinymce/langs/en_US.js +6 -0
  159. admin/tinymce/popup.css +210 -0
  160. admin/tinymce/tinymce.php +133 -0
  161. admin/tinymce/window.php +296 -0
  162. admin/tuning.php +55 -0
  163. admin/upgrade.php +198 -0
  164. admin/upload.php +48 -0
  165. admin/video-box.php +440 -0
  166. admin/video-sort.php +120 -0
  167. admin/video.functions.php +149 -0
  168. admin/wpmu.php +70 -0
  169. changelog.txt +430 -0
  170. facebook.php +101 -0
  171. flag-config.php +32 -0
  172. flag.php +461 -0
  173. flagshow.php +38 -0
  174. full_window_template.php +36 -0
  175. index.php +3 -0
  176. lang/flag-az_AZ.mo +0 -0
  177. lang/flag-az_AZ.po +1286 -0
admin/addgallery.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ // sometimes a error feedback is better than a white screen
5
+ @ini_set('error_reporting', E_ALL ^ E_NOTICE);
6
+
7
+ function flag_admin_add_gallery() {
8
+
9
+ global $wpdb, $flagdb, $flag;
10
+
11
+ // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
12
+ $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
13
+
14
+ // check for the max image size
15
+ $maxsize = flagGallery::check_memory_limit();
16
+
17
+ // link for the flash file
18
+ $swf_upload_link = FLAG_URLPATH . 'admin/upload.php';
19
+ $swf_upload_link = wp_nonce_url($swf_upload_link, 'flag_swfupload');
20
+ //flash doesn't seem to like encoded ampersands, so convert them back here
21
+ $swf_upload_link = str_replace('&#038;', '&', $swf_upload_link);
22
+
23
+ $defaultpath = $flag->options['galleryPath'];
24
+
25
+ if ($_POST['addgallery']){
26
+ check_admin_referer('flag_addgallery');
27
+ $newgallery = attribute_escape( $_POST['galleryname']);
28
+ if ( !empty($newgallery) )
29
+ flagAdmin::create_gallery($newgallery, $defaultpath);
30
+ }
31
+ if ($_POST['uploadimage']){
32
+ check_admin_referer('flag_addgallery');
33
+ if ($_FILES['MF__F_0_0']['error'] == 0) {
34
+ $messagetext = flagAdmin::upload_images();
35
+ }
36
+ else
37
+ flagGallery::show_error( __('Upload failed!','flag') );
38
+ }
39
+ if ($_POST['importfolder']){
40
+ check_admin_referer('flag_addgallery');
41
+ $galleryfolder = $_POST['galleryfolder'];
42
+ if ( ( !empty($galleryfolder) ) AND ($defaultpath != $galleryfolder) )
43
+ flagAdmin::import_gallery($galleryfolder);
44
+ }
45
+
46
+
47
+ if (isset($_POST['swf_callback'])){
48
+ if ($_POST['galleryselect'] == "0" )
49
+ flagGallery::show_error(__('No gallery selected !','flag'));
50
+ else {
51
+ // get the path to the gallery
52
+ $galleryID = (int) $_POST['galleryselect'];
53
+ $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->flaggallery WHERE gid = '$galleryID' ");
54
+ flagAdmin::import_gallery($gallerypath);
55
+ }
56
+ }
57
+
58
+ if ( isset($_POST['disable_flash']) ){
59
+ check_admin_referer('flag_addgallery');
60
+ $flag->options['swfUpload'] = false;
61
+ update_option('flag_options', $flag->options);
62
+ }
63
+
64
+ if ( isset($_POST['enable_flash']) ){
65
+ check_admin_referer('flag_addgallery');
66
+ $flag->options['swfUpload'] = true;
67
+ update_option('flag_options', $flag->options);
68
+ }
69
+
70
+ //get all galleries (after we added new ones)
71
+ $gallerylist = $flagdb->find_all_galleries('gid', 'DESC');
72
+
73
+ ?>
74
+
75
+ <?php if( !IS_WPMU || current_user_can('FlAG Import folder') ) { ?>
76
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css" />
77
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
78
+ <script type="text/javascript">
79
+ /* <![CDATA[ */
80
+ jQuery(function() {
81
+ jQuery("span.browsefiles").show().click(function(){
82
+ jQuery("#file_browser").fileTree({
83
+ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce( 'flag-ajax' ) ;?>",
84
+ root: jQuery("#galleryfolder").val(),
85
+ }, function(file) {
86
+ //var path = file.replace("<?php echo WINABSPATH; ?>", "");
87
+ jQuery("#galleryfolder").val(file);
88
+ });
89
+
90
+ jQuery("#file_browser").show("slide");
91
+ });
92
+ });
93
+ /* ]]> */
94
+ </script>
95
+ <?php }
96
+ if($flag->options['swfUpload']) { ?>
97
+ <!-- SWFUpload script -->
98
+ <script type="text/javascript">
99
+ /* <![CDATA[ */
100
+ var flag_swf_upload;
101
+
102
+ window.onload = function () {
103
+ flag_swf_upload = new SWFUpload({
104
+ // Backend settings
105
+ upload_url : "<?php echo $swf_upload_link; ?>",
106
+ flash_url : "<?php echo FLAG_URLPATH; ?>admin/js/swfupload.swf",
107
+
108
+ // Button Settings
109
+ button_placeholder_id : "spanButtonPlaceholder",
110
+ button_width: 300,
111
+ button_height: 27,
112
+ button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
113
+ button_cursor: SWFUpload.CURSOR.HAND,
114
+
115
+ // File Upload Settings
116
+ file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
117
+ file_types : "*.jpg;*.gif;*.png",
118
+ file_types_description : "<?php _e('Image Files', 'flag'); ?>",
119
+
120
+ // Queue handler
121
+ file_queued_handler : fileQueued,
122
+
123
+ // Upload handler
124
+ upload_start_handler : uploadStart,
125
+ upload_progress_handler : uploadProgress,
126
+ upload_error_handler : uploadError,
127
+ upload_success_handler : uploadSuccess,
128
+ upload_complete_handler : uploadComplete,
129
+
130
+ post_params : {
131
+ "auth_cookie" : "<?php echo (is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE]); ?>",
132
+ "logged_in_cookie": "<?php echo $_COOKIE[LOGGED_IN_COOKIE]; ?>",
133
+ "_wpnonce" : "<?php echo wp_create_nonce('flag_swfupload'); ?>",
134
+ "galleryselect" : "0"
135
+ },
136
+
137
+ // i18names
138
+ custom_settings : {
139
+ "remove" : "<?php _e('remove', 'flag'); ?>",
140
+ "browse" : "<?php _e('Browse...', 'flag'); ?>",
141
+ "upload" : "<?php _e('Upload images', 'flag'); ?>"
142
+ },
143
+
144
+ // Debug settings
145
+ debug: false
146
+
147
+ });
148
+
149
+ // on load change the upload to swfupload
150
+ initSWFUpload();
151
+
152
+ };
153
+ /* ]]> */
154
+ </script>
155
+ <div class="wrap" id="progressbar-wrap" style="display:none;">
156
+ <div class="progressborder">
157
+ <div class="progressbar" id="progressbar">
158
+ <span>0%</span>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ <?php } else { ?>
163
+ <!-- MultiFile script -->
164
+ <script type="text/javascript">
165
+ /* <![CDATA[ */
166
+ jQuery(document).ready(function(){
167
+ jQuery('#imagefiles').MultiFile({
168
+ STRING: {
169
+ remove:'<?php _e('remove', 'flag'); ?>'
170
+ }
171
+ });
172
+ });
173
+ /* ]]> */
174
+ </script>
175
+ <?php } ?>
176
+
177
+ <div id="slider" class="wrap">
178
+
179
+ <ul id="tabs" class="tabs">
180
+ <li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?></a></li>
181
+ <li><a href="#" rel="uploadimage"><?php _e('Upload Images', 'flag'); ?></a></li>
182
+ <?php if( !IS_WPMU || current_user_can('FlAG Import folder') ) { ?>
183
+ <li><a href="#" rel="importfolder"><?php _e('Import image folder', 'flag'); ?></a></li>
184
+ <?php } ?>
185
+ </ul>
186
+
187
+ <!-- create gallery -->
188
+ <div id="addgallery" class="cptab">
189
+ <h2><?php _e('Create a new gallery', 'flag'); ?></h2>
190
+ <form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
191
+ <?php wp_nonce_field('flag_addgallery'); ?>
192
+ <table class="form-table" style="width: auto;">
193
+ <tr>
194
+ <th scope="col" colspan="2" style="padding-bottom: 0;"><strong><?php _e('New Gallery', 'flag'); ?></strong></th>
195
+ </tr>
196
+ <tr valign="top">
197
+ <td><input type="text" size="65" name="galleryname" value="" /><br />
198
+ <?php if(!IS_WPMU) { ?>
199
+ <?php _e('Create a new , empty gallery below the folder', 'flag'); ?> <strong><?php echo $defaultpath; ?></strong><br />
200
+ <?php } ?>
201
+ <i>( <?php _e('Allowed characters for file and folder names are', 'flag'); ?>: a-z, A-Z, 0-9, -, _ )</i></td>
202
+ <?php do_action('flag_add_new_gallery_form'); ?>
203
+ <td><div class="submit" style="margin: 0; padding: 0;"><input class="button-primary" type="submit" name= "addgallery" value="<?php _e('Add gallery', 'flag'); ?>"/></div></td>
204
+ </tr>
205
+ </table>
206
+ <p>&nbsp;</p>
207
+ </form>
208
+ </div>
209
+ <!-- upload images -->
210
+ <div id="uploadimage" class="cptab">
211
+ <h2><?php _e('Upload images', 'flag'); ?></h2>
212
+ <script type="text/javascript">
213
+ /* <![CDATA[ */
214
+ jQuery(document).ready(function(){
215
+ if(jQuery("#galleryselect").val() == 0) {
216
+ jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
217
+ jQuery("#choosegalfirst .disabledbut").show();
218
+ }
219
+ jQuery("#choosegalfirst .disabledbut").click(function () {
220
+ alert("Choose gallery, please.")
221
+ });
222
+ jQuery("#galleryselect").change(function () {
223
+ if(jQuery(this).val() == 0) {
224
+ jQuery("#choosegalfirst .disabledbut").show();
225
+ jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600);
226
+ } else {
227
+ jQuery("#choosegalfirst .disabledbut").hide();
228
+ jQuery("#choosegalfirst").animate({opacity: "1"}, 600);
229
+ }
230
+ });
231
+ });
232
+ /* ]]> */
233
+ </script>
234
+ <form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
235
+ <?php wp_nonce_field('flag_addgallery'); ?>
236
+ <table class="form-table">
237
+ <tr valign="top">
238
+ <th scope="row"><strong><?php _e('Upload image(s):', 'flag'); ?></strong></th>
239
+ <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td>
240
+ </tr>
241
+ <tr valign="top">
242
+ <td colspan="2"><label for="galleryselect"><?php _e('in to', 'flag'); ?></label>
243
+ <select name="galleryselect" id="galleryselect">
244
+ <option value="0" ><?php _e('Choose gallery', 'flag'); ?></option>
245
+ <?php $ingallery = isset($_GET['gid']) ? (int) $_GET['gid'] : '';
246
+ foreach($gallerylist as $gallery) {
247
+ if ( !flagAdmin::can_manage_this_gallery($gallery->author) )
248
+ continue;
249
+ $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
250
+ $sel = ($ingallery == $gallery->gid) ? 'selected="selected" ' : '';
251
+ echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . $name . '</option>' . "\n";
252
+ } ?>
253
+ </select>
254
+ <?php echo $maxsize; ?>
255
+ <br /><?php if ((IS_WPMU) && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) display_space_usage(); ?>
256
+ </td>
257
+ </tr>
258
+ </table>
259
+ <div class="submit">
260
+ <span class="useflashupload">
261
+ <?php if ($flag->options['swfUpload']) { ?>
262
+ <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload requires Adobe Flash 10, disable it if you have problems','flag'); ?>" value="<?php _e('Disable flash upload', 'flag'); ?>" />
263
+ <?php } else { ?>
264
+ <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('Enable flash based upload', 'flag'); ?>" />
265
+ <?php } ?>
266
+ </span>
267
+ <span id="choosegalfirst"><input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'flag'); ?>" /><span class="disabledbut" style="display: none;"></span></span>
268
+ <div class="clear"></div>
269
+ </div>
270
+ </form>
271
+ </div>
272
+ <?php if( !IS_WPMU || current_user_can('FlAG Import folder') ) { ?>
273
+ <!-- import folder -->
274
+ <div id="importfolder" class="cptab">
275
+ <h2><?php _e('Import image folder', 'flag'); ?></h2>
276
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
277
+ <?php wp_nonce_field('flag_addgallery'); ?>
278
+ <table class="form-table">
279
+ <tr valign="top">
280
+ <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
281
+ <td><input type="text" size="35" id="galleryfolder" name="galleryfolder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Browse...',"flag"); ?></span>
282
+ <div id="file_browser"></div>
283
+ <div><?php echo $maxsize; ?>
284
+ <?php if (SAFE_MODE) {?><br /><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag'); ?><?php }; ?></div></td>
285
+ </tr>
286
+ </table>
287
+ <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
288
+ </form>
289
+ </div>
290
+ <?php } ?>
291
+
292
+ <script type="text/javascript">
293
+ var cptabs=new ddtabcontent("tabs");
294
+ cptabs.setpersist(true);
295
+ cptabs.setselectedClassTarget("linkparent");
296
+ cptabs.init();
297
+ </script>
298
+ </div>
299
+ <?php
300
+ }
301
+ ?>
admin/admin.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * flagAdminPanel - Admin Section for Flash Album Gallery
4
+ *
5
+ */
6
+ class flagAdminPanel{
7
+
8
+ // constructor
9
+ function flagAdminPanel() {
10
+
11
+ // Add the admin menu
12
+ add_action( 'admin_menu', array(&$this, 'add_menu') );
13
+ add_action('init', array(&$this, 'wp_flag_check_options'),2);
14
+
15
+ // Add the script and style files
16
+ add_action('admin_print_scripts', array(&$this, 'load_scripts') );
17
+ add_action('admin_print_styles', array(&$this, 'load_styles') );
18
+
19
+ add_filter('contextual_help', array(&$this, 'show_help'), 10, 2);
20
+ add_filter('screen_meta_screen', array(&$this, 'edit_screen_meta'));
21
+ }
22
+
23
+ function wp_flag_check_options() {
24
+ global $flag;
25
+ require_once(dirname (__FILE__) . '/flag_install.php' );
26
+ $default_options = flag_list_options();
27
+ $flag_db_options = get_option('flag_options');
28
+ if(function_exists('array_diff_key')) {
29
+ $flag_new_options = array_diff_key($default_options, $flag_db_options);
30
+ } else {
31
+ $flag_new_options = $this->PHP4_array_diff_key($default_options, $flag_db_options);
32
+ }
33
+ $flag_options = array_merge($flag_db_options, $flag_new_options);
34
+ update_option('flag_options', $flag_options);
35
+ }
36
+
37
+ function PHP4_array_diff_key() {
38
+ $arrs = func_get_args();
39
+ $result = array_shift($arrs);
40
+ foreach ($arrs as $array) {
41
+ foreach ($result as $key => $v) {
42
+ if (array_key_exists($key, $array)) {
43
+ unset($result[$key]);
44
+ }
45
+ }
46
+ }
47
+ return $result;
48
+ }
49
+
50
+ // integrate the menu
51
+ function add_menu() {
52
+
53
+ add_menu_page( __('GRAND Flash Album Gallery overview','flag'), __('FlAGallery'), 'FlAG overview', 'flag-overview', array (&$this, 'show_menu'), FLAG_URLPATH .'admin/images/flag.png' );
54
+ add_submenu_page( 'flag-overview' , __('GRAND Flash Album Gallery overview', 'flag'), __('Overview', 'flag'), 'FlAG overview', 'flag-overview', array (&$this, 'show_menu'));
55
+ add_submenu_page( 'flag-overview' , __('FlAG Manage gallery', 'flag'), __('Manage Galleries', 'flag'), 'FlAG Manage gallery', 'flag-manage-gallery', array (&$this, 'show_menu'));
56
+ add_submenu_page( 'flag-overview' , __('FlAG Music Box', 'flag'), __('Music Box', 'flag'), 'FlAG Manage music', 'flag-music-box', array (&$this, 'show_menu'));
57
+ add_submenu_page( 'flag-overview' , __('FlAG Video Box', 'flag'), __('Video Box', 'flag'), 'FlAG Manage video', 'flag-video-box', array (&$this, 'show_menu'));
58
+ add_submenu_page( 'flag-overview' , __('FlAG Banner Box', 'flag'), __('Banner Box', 'flag'), 'FlAG Manage banners', 'flag-banner-box', array (&$this, 'show_menu'));
59
+ add_submenu_page( 'flag-overview' , __('FlAG Manage skins', 'flag'), __('Skins', 'flag'), 'FlAG Change skin', 'flag-skins', array (&$this, 'show_menu'));
60
+ add_submenu_page( 'flag-overview' , __('FlAG Change options', 'flag'), __('Options', 'flag'), 'FlAG Change options', 'flag-options', array (&$this, 'show_menu'));
61
+ add_submenu_page( 'flag-overview' , __('FlAG Facebook Integration', 'flag'), __('Facebook', 'flag'), 'FlAG Facebook page', 'flag-facebook', array (&$this, 'show_menu'));
62
+ if ( flag_wpmu_site_admin() )
63
+ add_submenu_page( 'wpmu-admin.php' , __('GRAND Flash Album Gallery', 'flag'), __('GRAND FlAGallery', 'flag'), 'activate_plugins', 'flag-wpmu', array (&$this, 'show_menu'));
64
+
65
+ //register the column fields
66
+ $this->register_columns();
67
+
68
+ }
69
+
70
+ // load the script for the defined page and load only this code
71
+ function show_menu() {
72
+
73
+ global $flag;
74
+
75
+ // check for upgrade
76
+ /*if( get_option( 'flag_db_version' ) != FLAG_DBVERSION ) {
77
+ include_once ( dirname (__FILE__) . '/functions.php' );
78
+ include_once ( dirname (__FILE__) . '/upgrade.php' );
79
+ flag_upgrade_page();
80
+ return;
81
+ }*/
82
+
83
+ // Set installation date
84
+ if( empty($flag->options['installDate']) ) {
85
+ $flag->options['installDate'] = time();
86
+ update_option('flag_options', $flag->options);
87
+ }
88
+
89
+ switch ($_GET['page']){
90
+ case "flag-manage-gallery" :
91
+ include_once ( dirname (__FILE__) . '/functions.php' ); // admin functions
92
+ include_once ( dirname (__FILE__) . '/manage.php' ); // flag_admin_manage_gallery
93
+ // Initate the Manage Gallery page
94
+ $flag->manage_page = new flagManageGallery ();
95
+ // Render the output now, because you cannot access a object during the constructor is not finished
96
+ $flag->manage_page->controller();
97
+
98
+ break;
99
+ case "flag-music-box" :
100
+ include_once ( dirname (__FILE__) . '/music-box.php' ); // flag_music_box
101
+ flag_music_controler();
102
+ break;
103
+ case "flag-video-box" :
104
+ include_once ( dirname (__FILE__) . '/video-box.php' ); // flag_video_box
105
+ flag_video_controler();
106
+ break;
107
+ case "flag-banner-box" :
108
+ include_once ( dirname (__FILE__) . '/banner-box.php' ); // flag_banner_box
109
+ flag_banner_controler();
110
+ break;
111
+ case "flag-options" :
112
+ include_once ( dirname (__FILE__) . '/settings.php' ); // flag_admin_options
113
+ flag_admin_options();
114
+ break;
115
+ case "flag-skins" :
116
+ include_once ( dirname (__FILE__) . '/skins.php' ); // flag_manage_skins
117
+ break;
118
+ case "flag-facebook" :
119
+ include_once ( dirname(__FILE__) . '/facebook-tool.php' ); // flag_facebook
120
+ break;
121
+ case "flag-wpmu" :
122
+ include_once ( dirname (__FILE__) . '/wpmu.php' ); // flag_wpmu_admin
123
+ flag_wpmu_setup();
124
+ break;
125
+ default :
126
+ include_once ( dirname (__FILE__) . '/overview.php' ); // flag_admin_overview
127
+ flag_admin_overview();
128
+ break;
129
+ }
130
+ }
131
+
132
+ function load_scripts() {
133
+
134
+ wp_register_script('flag-ajax', FLAG_URLPATH .'admin/js/flag.ajax.js', array('jquery'), '1.4.0');
135
+ wp_localize_script('flag-ajax', 'flagAjaxSetup', array(
136
+ 'url' => admin_url('admin-ajax.php'),
137
+ 'action' => 'flag_ajax_operation',
138
+ 'operation' => '',
139
+ 'nonce' => wp_create_nonce( 'flag-ajax' ),
140
+ 'ids' => '',
141
+ 'permission' => __('You do not have the correct permission', 'flag'),
142
+ 'error' => __('Unexpected Error', 'flag'),
143
+ 'failure' => __('A failure occurred', 'flag')
144
+ ) );
145
+ wp_register_script('flag-progressbar', FLAG_URLPATH .'admin/js/flag.progressbar.js', array('jquery'), '1.0.0');
146
+ wp_register_script('swfupload_f10', FLAG_URLPATH .'admin/js/swfupload.js', array('jquery'), '2.2.0');
147
+
148
+ if (isset($_GET['page'])) {
149
+ switch ($_GET['page']) {
150
+ case 'flag-overview' :
151
+ wp_enqueue_script( 'postbox' );
152
+ case "flag-manage-gallery" :
153
+ print "<script type='text/javascript' src='".FLAG_URLPATH."admin/js/tabs.js'></script>\n";
154
+ wp_enqueue_script( 'jquery-ui-core' );
155
+ wp_enqueue_script( 'jquery-ui-draggable' );
156
+ wp_enqueue_script( 'jquery-ui-droppable' );
157
+ wp_enqueue_script( 'multifile', FLAG_URLPATH .'admin/js/jquery.MultiFile.js', array('jquery'), '1.4.6' );
158
+ wp_enqueue_script( 'flag-swfupload-handler', FLAG_URLPATH .'admin/js/swfupload.handler.js', array('swfupload_f10'), '2.2.0' );
159
+ wp_enqueue_script('dataset', FLAG_URLPATH .'admin/js/jquery.dataset.js', array('jquery'), '0.1.0');
160
+ wp_enqueue_script( 'postbox' );
161
+ wp_enqueue_script( 'flag-ajax' );
162
+ wp_enqueue_script( 'flag-progressbar' );
163
+ add_thickbox();
164
+ break;
165
+ case "flag-music-box" :
166
+ wp_enqueue_script( 'swfobject' );
167
+ wp_enqueue_script( 'thickbox' );
168
+ break;
169
+ case "flag-video-box" :
170
+ wp_enqueue_script( 'swfobject' );
171
+ wp_enqueue_script( 'thickbox' );
172
+ break;
173
+ case "flag-banner-box" :
174
+ wp_enqueue_script( 'thickbox' );
175
+ break;
176
+ case "flag-options" :
177
+ wp_enqueue_script('farbtastic-nosharp', FLAG_URLPATH.'admin/js/farbtastic-nosharp.js', array('jquery'), '1.2');
178
+ print "<script type='text/javascript' src='".FLAG_URLPATH."admin/js/tabs.js'></script>\n";
179
+ break;
180
+ case "flag-skins" :
181
+ wp_enqueue_script( 'thickbox' );
182
+ wp_enqueue_script('farbtastic-nosharp', FLAG_URLPATH.'admin/js/farbtastic-nosharp.js', array('jquery'), '1.2');
183
+ //wp_enqueue_script( 'farbtastic' );
184
+ print "<script type='text/javascript' src='".FLAG_URLPATH."admin/js/tabs.js'></script>\n";
185
+ break;
186
+ }
187
+ }
188
+ }
189
+
190
+ function load_styles() {
191
+
192
+ if (isset($_GET['page'])) {
193
+ switch ($_GET['page']) {
194
+ case 'flag-overview' :
195
+ wp_enqueue_style( 'flagadmin', FLAG_URLPATH .'admin/css/flagadmin.css', false, '2.8.1', 'screen' );
196
+ wp_admin_css( 'css/dashboard' );
197
+ break;
198
+ case "flag-options" :
199
+ wp_enqueue_style( 'farbtastic' );
200
+ case "flag-manage-gallery" :
201
+ wp_enqueue_style( 'flagtabs', FLAG_URLPATH .'admin/css/tabs.css', false, '1.0.0', 'screen' );
202
+ case "flag-music-box" :
203
+ case "flag-video-box" :
204
+ case "flag-banner-box" :
205
+ wp_enqueue_style( 'thickbox' );
206
+ wp_enqueue_style( 'flagadmin', FLAG_URLPATH .'admin/css/flagadmin.css', false, '2.8.1', 'screen' );
207
+ break;
208
+ case "flag-skins" :
209
+ wp_enqueue_style( 'thickbox' );
210
+ wp_enqueue_style( 'farbtastic' );
211
+ wp_enqueue_style( 'flagtabs', FLAG_URLPATH .'admin/css/tabs.css', false, '1.0.0', 'screen' );
212
+ wp_enqueue_style( 'flagadmin', FLAG_URLPATH .'admin/css/flagadmin.css', false, '2.8.1', 'screen' );
213
+ wp_admin_css( 'css/dashboard' );
214
+ break;
215
+ }
216
+ }
217
+ }
218
+
219
+ function show_help($help, $screen) {
220
+
221
+ $link ='';
222
+ // menu title is localized...
223
+ $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'flag' ) );
224
+
225
+ switch ($screen) {
226
+ case 'toplevel_page_' . 'flag-overview' :
227
+ case "{$i18n}_page_flag-manage-gallery" :
228
+ case "flag-manage-gallery":
229
+ case "flag-manage-images":
230
+ case "{$i18n}_page_flag-skins" :
231
+ case "{$i18n}_page_flag-options" :
232
+ $link = '<a href="http://codeasily.com/wordpress-plugins/flag" target="_blank">CodEasily.com</a>';
233
+ break;
234
+ }
235
+
236
+ if ( !empty($link) ) {
237
+ $help = '<h5>' . __('Get help with GRAND FlAGallery', 'flag') . '</h5>';
238
+ $help .= '<div class="metabox-prefs">';
239
+ $help .= $link;
240
+ $help .= "</div>\n";
241
+ $help .= '<h5>' . __('More Help & Info', 'flag') . '</h5>';
242
+ $help .= '<div class="metabox-prefs">';
243
+ $help .= '<a href="http://codeasily.com/wordpress-plugins/flash-album-gallery/grand-flash-album-gallery-wordpress-plugin-video-tutorial" target="_blank">' . __('GRAND FlAGallery Video Tutorial', 'flag') . '</a>';
244
+ $help .= ' | <a href="http://codeasily.com/wordpress-plugins/flash-album-gallery/faq" target="_blank">' . __('FAQ', 'flag') . '</a>';
245
+ $help .= ' | <a href="http://codeasily.com/wordpress-plugins/flash-album-gallery/flag-review" target="_blank">' . __('GRAND FlAGallery Review', 'flag') . '</a>';
246
+ $help .= ' | <a href="http://codeasily.com/wordpress-plugins/flash-album-gallery/languages" target="_blank">' . __('Get your language pack', 'flag') . '</a>';
247
+ $help .= ' | <a href="http://photogallerycreator.com/2009/07/skins-for-flash-album-gallery" target="_blank">' . __('Skins for GRAND FlAGallery', 'flag') . '</a>';
248
+ $help .= "</div>\n";
249
+ }
250
+
251
+ return $help;
252
+ }
253
+
254
+ function edit_screen_meta($screen) {
255
+
256
+ // menu title is localized, so we need to change the toplevel name
257
+ $i18n = strtolower ( _n( 'Gallery', 'Galleries', 1, 'flag' ) );
258
+
259
+ switch ($screen) {
260
+ case "{$i18n}_page_flag-manage-gallery" :
261
+ // we would like to have screen option only at the manage images / gallery page
262
+ if ( isset ($_POST['sortGallery']) )
263
+ $screen = $screen;
264
+ else if ( ($_GET['mode'] == 'edit') || isset ($_POST['backToGallery']) )
265
+ $screen = 'flag-manage-images';
266
+ else if ( ($_GET['mode'] == 'sort') )
267
+ $screen = $screen;
268
+ else
269
+ $screen = 'flag-manage-gallery';
270
+ break;
271
+ }
272
+
273
+ return $screen;
274
+ }
275
+
276
+ function register_column_headers($screen, $columns) {
277
+ global $_wp_column_headers;
278
+
279
+ if ( !isset($_wp_column_headers) )
280
+ $_wp_column_headers = array();
281
+
282
+ $_wp_column_headers[$screen] = $columns;
283
+ }
284
+
285
+ function register_columns() {
286
+ include_once ( dirname (__FILE__) . '/manage-images.php' );
287
+ $this->register_column_headers('flag-manage-images', flag_manage_gallery_columns() );
288
+ }
289
+
290
+ }
291
+
292
+ function flag_wpmu_site_admin() {
293
+ // Check for site admin
294
+ if ( function_exists('is_site_admin') )
295
+ if ( is_site_admin() )
296
+ return true;
297
+
298
+ return false;
299
+ }
300
+
301
+ ?>
admin/ajax.php ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action('wp_ajax_flag_ajax_operation', 'flag_ajax_operation' );
4
+
5
+ function flag_ajax_operation() {
6
+ global $wpdb;
7
+ // if nonce is not correct it returns -1
8
+ check_ajax_referer( "flag-ajax" );
9
+ // check for correct capability
10
+ if ( !is_user_logged_in() )
11
+ die('-1');
12
+ // check for correct FlAG capability
13
+ if ( !current_user_can('FlAG Upload images') || !current_user_can('FlAG Manage gallery') )
14
+ die('-1');
15
+ // include the flag function
16
+ include_once (dirname (__FILE__). '/functions.php');
17
+ // Get the image id
18
+ if ( isset($_POST['image'])) {
19
+ $id = (int) $_POST['image'];
20
+ // let's get the image data
21
+ $picture = flagdb::find_image($id);
22
+ // what do you want to do ?
23
+ switch ( $_POST['operation'] ) {
24
+ case 'create_thumbnail' :
25
+ $result = flagAdmin::create_thumbnail($picture);
26
+ break;
27
+ case 'resize_image' :
28
+ $result = flagAdmin::resize_image($picture);
29
+ break;
30
+ case 'import_metadata' :
31
+ $result = flagAdmin::import_MetaData( $id );
32
+ break;
33
+ case 'copy_metadata' :
34
+ $result = flagAdmin::copy_MetaData( $id );
35
+ break;
36
+ case 'get_image_ids' :
37
+ $result = flagAdmin::get_image_ids( $id );
38
+ break;
39
+ default :
40
+ do_action( 'flag_ajax_' . $_POST['operation'] );
41
+ die('-1');
42
+ break;
43
+ }
44
+ // A success should return a '1'
45
+ die ($result);
46
+ }
47
+ // The script should never stop here
48
+ die('0');
49
+ }
50
+
51
+ add_action('wp_ajax_flagCreateNewThumb', 'flagCreateNewThumb');
52
+
53
+ function flagCreateNewThumb() {
54
+
55
+ global $wpdb;
56
+
57
+ // check for correct capability
58
+ if ( !is_user_logged_in() )
59
+ die('-1');
60
+ // check for correct FlAG capability
61
+ if ( !current_user_can('FlAG Manage gallery') )
62
+ die('-1');
63
+
64
+ require_once( dirname( dirname(__FILE__) ) . '/flag-config.php');
65
+ include_once( flagGallery::graphic_library() );
66
+
67
+ $flag_options=get_option('flag_options');
68
+
69
+ $id = (int) $_POST['id'];
70
+ $picture = flagdb::find_image($id);
71
+
72
+ $x = round( $_POST['x'] * $_POST['rr'], 0);
73
+ $y = round( $_POST['y'] * $_POST['rr'], 0);
74
+ $w = round( $_POST['w'] * $_POST['rr'], 0);
75
+ $h = round( $_POST['h'] * $_POST['rr'], 0);
76
+
77
+ $thumb = new flag_Thumbnail($picture->imagePath, TRUE);
78
+
79
+ $thumb->crop($x, $y, $w, $h);
80
+
81
+ if ($flag_options['thumbFix']) {
82
+ if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
83
+ $thumb->resize($flag_options['thumbWidth'], 0);
84
+ } else {
85
+ $thumb->resize(0,$flag_options['thumbHeight']);
86
+ }
87
+ } else {
88
+ $thumb->resize($flag_options['thumbWidth'],$flag_options['thumbHeight'],$flag_options['thumbResampleMode']);
89
+ }
90
+
91
+ if ( $thumb->save($picture->thumbPath, 100)) {
92
+ //read the new sizes
93
+ $new_size = @getimagesize ( $picture->thumbPath );
94
+ $size['width'] = $new_size[0];
95
+ $size['height'] = $new_size[1];
96
+
97
+ // add them to the database
98
+ flagdb::update_image_meta($picture->pid, array( 'thumbnail' => $size) );
99
+
100
+ echo "OK";
101
+ } else {
102
+ header('HTTP/1.1 500 Internal Server Error');
103
+ echo "KO";
104
+ }
105
+
106
+ exit();
107
+
108
+ }
109
+
110
+ add_action('wp_ajax_flag_save_album', 'flag_save_album');
111
+
112
+ function flag_save_album() {
113
+
114
+ global $wpdb;
115
+
116
+ // check for correct capability
117
+ if ( !is_user_logged_in() )
118
+ die('-1');
119
+ // check for correct FlAG capability
120
+ if ( !current_user_can('FlAG Manage gallery') )
121
+ die('-1');
122
+
123
+ $g = array();
124
+ if(isset($_POST['form']))
125
+ parse_str($_POST['form']);
126
+ if($album_name && $album_id) {
127
+ if(count($g))
128
+ $galstring = implode(',', $g);
129
+ else
130
+ $galstring = '';
131
+ $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagalbum SET name = %s, categories = %s WHERE id = %s", $album_name, $galstring, $album_id) );
132
+ }
133
+
134
+ if($result) {
135
+ _e('Success','flag');
136
+ }
137
+
138
+ exit();
139
+
140
+ }
141
+
142
+ add_action('wp_ajax_flag_delete_album', 'flag_delete_album');
143
+
144
+ function flag_delete_album() {
145
+
146
+ global $wpdb;
147
+
148
+ // check for correct capability
149
+ if ( !is_user_logged_in() )
150
+ die('-1');
151
+ // check for correct FlAG capability
152
+ if ( !current_user_can('FlAG Manage gallery') )
153
+ die('-1');
154
+
155
+ if(isset($_POST['post'])) {
156
+ $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->flagalbum WHERE id = %d", $_POST['post']) );
157
+ }
158
+
159
+ if($result) {
160
+ _e('Success','flag');
161
+ }
162
+
163
+ exit();
164
+
165
+ }
166
+
167
+ add_action('wp_ajax_flag_banner_crunch', 'flag_banner_crunch');
168
+
169
+ function flag_banner_crunch() {
170
+
171
+ global $wpdb;
172
+
173
+ // check for correct capability
174
+ if ( !is_user_logged_in() )
175
+ die('-1');
176
+ // check for correct FlAG capability
177
+ if ( !current_user_can('FlAG Manage gallery') )
178
+ die('-1');
179
+
180
+ if(isset($_POST['path'])) {
181
+ include_once (dirname (__FILE__). '/functions.php');
182
+ $id = flagAdmin::handle_import_file($_POST['path']);
183
+ $file = basename($_POST['path']);
184
+ if ( is_wp_error($id) ) {
185
+ echo '<p class="error">' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flag'), $file, $id->get_error_message() ) . '</p>';
186
+ } else {
187
+ echo '<p class="success">' . sprintf(__('<em>%s</em> has been added to Media library', 'flag'), $file) . '</p>';
188
+ }
189
+ }
190
+
191
+ exit();
192
+ }
193
+
194
+ add_action('wp_ajax_flag_file_browser', 'flag_ajax_file_browser');
195
+
196
+ /**
197
+ * jQuery File Tree PHP Connector
198
+ * @author Cory S.N. LaViska - A Beautiful Site (http://abeautifulsite.net/)
199
+ * @version 1.0.1
200
+ *
201
+ * @return string folder content
202
+ */
203
+ function flag_ajax_file_browser() {
204
+
205
+ global $flag;
206
+
207
+ // check for correct NextGEN capability
208
+ if ( !current_user_can('FlAG Import folder') )
209
+ die('No access');
210
+
211
+ if ( !defined('ABSPATH') )
212
+ die('No access');
213
+
214
+ // if nonce is not correct it returns -1
215
+ check_ajax_referer( 'flag-ajax', 'nonce' );
216
+
217
+ //PHP4 compat script
218
+ if (!function_exists('scandir')) {
219
+ function scandir($dir, $listDirectories = false, $skipDots = true ) {
220
+ $dirArray = array();
221
+ if ($handle = opendir($dir) ) {
222
+ while (false !== ($file = readdir($handle))) {
223
+ if (($file != '.' && $file != '..' ) || $skipDots == true) {
224
+ if($listDirectories == false) { if(is_dir($file)) { continue; } }
225
+ array_push($dirArray, basename($file) );
226
+ }
227
+ }
228
+ closedir($handle);
229
+ }
230
+ return $dirArray;
231
+ }
232
+ }
233
+
234
+ // start from the default path
235
+ $root = trailingslashit ( WINABSPATH );
236
+ // get the current directory
237
+ $dir = trailingslashit ( urldecode($_POST['dir']) );
238
+
239
+ if( file_exists($root . $dir) ) {
240
+ $files = scandir($root . $dir);
241
+ natcasesort($files);
242
+
243
+ // The 2 counts for . and ..
244
+ if( count($files) > 2 ) {
245
+ echo "<ul class=\"jqueryDirTree\" style=\"display: none;\">";
246
+
247
+ // return only directories
248
+ foreach( $files as $file ) {
249
+
250
+ //reserved name for the thumnbnails, don't use it as folder name
251
+ if ( $file == 'thumbs')
252
+ continue;
253
+
254
+ if ( file_exists($root . $dir . $file) && $file != '.' && $file != '..' && is_dir($root . $dir . $file) ) {
255
+ echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . esc_html($dir . $file) . "/\">" . esc_html($file) . "</a></li>";
256
+ }
257
+ }
258
+
259
+ echo "</ul>";
260
+ }
261
+ }
262
+
263
+ die();
264
+ }
265
+
266
+ ?>
admin/banner-box.php ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ($_POST['importfolder']){
20
+ check_admin_referer('flag_addbanner');
21
+ $bannerfolder = $_POST['bannerfolder'];
22
+ if ( !empty($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
+ include_once (dirname (__FILE__) . '/banner-sort.php');
34
+ flag_b_playlist_order($_GET['playlist']);
35
+ break;
36
+ case 'edit':
37
+ if(isset($_POST['updatePlaylist'])) {
38
+ $title = $_POST['playlist_title'];
39
+ $descr = $_POST['playlist_descr'];
40
+ $file = $_GET['playlist'];
41
+ foreach($_POST['item_a'] as $item_id => $item) {
42
+ if($action=='delete_items' && in_array($item_id, $_POST['doaction']))
43
+ continue;
44
+ $data[] = $item_id;
45
+ }
46
+ flagGallery::flagSaveWpMedia();
47
+ flagSave_bPlaylist($title,$descr,$data,$file);
48
+ }
49
+ if(isset($_POST['updatePlaylistSkin'])) {
50
+ $file = $_GET['playlist'];
51
+ flagSave_bPlaylistSkin($file);
52
+ }
53
+ include_once (dirname (__FILE__) . '/manage-banner.php');
54
+ flag_b_playlist_edit($_GET['playlist']);
55
+ break;
56
+ case 'save':
57
+ $title = $_POST['playlist_title'];
58
+ $descr = $_POST['playlist_descr'];
59
+ $data = $_POST['items_array'];
60
+ $file = isset($_REQUEST['playlist'])? $_REQUEST['playlist'] : false;
61
+ flagGallery::flagSaveWpMedia();
62
+ flagSave_bPlaylist($title,$descr,$data, $file);
63
+ if(isset($_GET['playlist'])) {
64
+ include_once (dirname (__FILE__) . '/manage-banner.php');
65
+ flag_b_playlist_edit($_GET['playlist']);
66
+ } else {
67
+ flag_created_b_playlists();
68
+ flag_banner_wp_media_lib();
69
+ }
70
+ break;
71
+ case 'add':
72
+ $added = $_POST['items'];
73
+ flag_banner_wp_media_lib($added);
74
+ break;
75
+ case 'delete':
76
+ flag_b_playlist_delete($_GET['playlist']);
77
+ case 'import':
78
+ flag_crunch($crunch_list);
79
+ case 'main':
80
+ if(isset($_POST['updateMedia'])) {
81
+ flagGallery::flagSaveWpMedia();
82
+ flagGallery::show_message( __('Media updated','flag') );
83
+ }
84
+ default:
85
+ flag_created_b_playlists();
86
+ flag_banner_wp_media_lib();
87
+ break;
88
+ }
89
+
90
+ }
91
+ function flag_crunch($crunch_list) {
92
+ if(!$crunch_list) {
93
+ return;
94
+ }
95
+ $crunch_string = implode(',', $crunch_list);
96
+ $folder = rtrim($_POST['bannerfolder'], '/');
97
+ $path = WINABSPATH . $folder.'/';
98
+ ?>
99
+ <script type="text/javascript">
100
+ <!--
101
+ jQuery(document).ready(function(){
102
+ var crunch_string = '<?php echo $crunch_string; ?>';
103
+ var bannerfolder = '<?php echo $path; ?>';
104
+ var crunch_list = crunch_string.split(',');
105
+ var parts = crunch_list.length;
106
+ function flag_crunch() {
107
+ if(crunch_list.length) {
108
+ jQuery.post(
109
+ ajaxurl,
110
+ {
111
+ action: "flag_banner_crunch",
112
+ _wpnonce: "<?php echo wp_create_nonce( 'flag-ajax' ); ?>",
113
+ path: encodeURI(bannerfolder + crunch_list[0])
114
+ },
115
+ function( response ) {
116
+ crunch_list.shift()
117
+ var parts_done = parts - crunch_list.length;
118
+ jQuery(".flag_crunching .flag_progress .flag_complete").animate({width:parts_done*(100/parts)+'%'}, 400);
119
+ jQuery(".flag_crunching").append(response);
120
+ flag_crunch();
121
+ }
122
+ );
123
+ } else {
124
+ var refpage = window.location.href;
125
+ jQuery(".flag_crunching .txt").html('<a href="'+refpage+'"><?php _e("Import folder is complete. The page reloads after 5 seconds.", "flag"); ?></a>');
126
+ //alert('<?php _e("Import folder complete. Refresh page.", "flag"); ?>');
127
+ setTimeout(function(){ window.location.href=window.location.href }, 5000);
128
+ }
129
+ }
130
+ flag_crunch();
131
+ });
132
+ //-->
133
+ </script>
134
+
135
+ <?php }
136
+
137
+ function flag_created_b_playlists() {
138
+
139
+ $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
140
+
141
+ $all_playlists = get_b_playlists();
142
+ $total_all_playlists = count($all_playlists);
143
+ $flag_options = get_option ('flag_options');
144
+
145
+ ?>
146
+ <div class="wrap">
147
+ <h2><?php _e('Created playlists', 'flag'); ?></h2>
148
+ <table class="widefat" cellspacing="0">
149
+ <thead>
150
+ <tr>
151
+ <th scope="col" width="25%"><?php _e('Title', 'flag'); ?></th>
152
+ <th scope="col" width="55%"><?php _e('Description', 'flag'); ?></th>
153
+ <th scope="col" ><?php _e('Quantity', 'flag'); ?></th>
154
+ <th scope="col" ><?php _e('Shortcode', 'flag'); ?></th>
155
+ <th scope="col" ><?php _e('Action', 'flag'); ?></th>
156
+ </tr>
157
+ </thead>
158
+ <tbody>
159
+ <?php
160
+ if($all_playlists) {
161
+ foreach((array)$all_playlists as $playlist_file => $playlist_data) {
162
+ $query_m = get_posts(array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, 'post__in' => $playlist_data['items']));
163
+ $class = ( !isset($class) || $class == 'class="alternate"' ) ? '' : 'class="alternate"';
164
+ $playlist_name = basename($playlist_file, '.xml');
165
+ if(count($query_m) != count($playlist_data['items'])) {
166
+ flagSave_bPlaylist($playlist_data['title'],$playlist_data['description'],$playlist_data['items'],$playlist_name);
167
+ }
168
+ ?>
169
+ <tr id="<?php echo $playlist_name; ?>" <?php echo $class; ?> >
170
+ <td>
171
+ <a href="<?php echo $filepath.'&amp;playlist='.$playlist_name.'&amp;mode=edit'; ?>" class='edit' title="<?php _e('Edit'); ?>" >
172
+ <?php echo $playlist_data['title']; ?>
173
+ </a>
174
+ </td>
175
+ <td><?php echo $playlist_data['description']; echo '&nbsp;('.__("player", "flag").': <strong>'.$playlist_data['skin'].'</strong>)' ?></td>
176
+ <td><?php echo count($query_m); ?></td>
177
+ <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>
178
+ <td>
179
+ <a href="<?php echo $filepath.'&amp;playlist='.$playlist_name."&amp;mode=delete"; ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this playlist?",'flag')?>');if(check==false) return false;"><?php _e('Delete','flag'); ?></a>
180
+ </td>
181
+ </tr>
182
+ <?php
183
+ }
184
+ } else {
185
+ echo '<tr><td colspan="5" align="center"><strong>'.__('No playlists found','flag').'</strong></td></tr>';
186
+ }
187
+ ?>
188
+ </tbody>
189
+ </table>
190
+ </div>
191
+
192
+ <?php } ?>
193
+
194
+ <?php // *** show media list
195
+ function flag_banner_wp_media_lib($added=false) {
196
+ global $wpdb;
197
+ // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
198
+ $filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
199
+ if($added!==false) {
200
+ $filepath .= '&amp;playlist='.$_GET['playlist'].'&amp;mode=save';
201
+ $flag_options = get_option('flag_options');
202
+ $playlistPath = $flag_options['galleryPath'].'playlists/banner/'.$_GET['playlist'].'.xml';
203
+ $playlist = get_b_playlist_data(ABSPATH.$playlistPath);
204
+ $exclude = explode(',', $added);
205
+ }
206
+ ?>
207
+ <script type="text/javascript">
208
+ <!--
209
+ jQuery(document).ready(function(){
210
+ jQuery('.cb :checkbox').click(function() {
211
+ if(jQuery(this).is(':checked')){
212
+ var cur = jQuery(this).val();
213
+ var arr = jQuery('#items_array').val();
214
+ if(arr) { var del = ','; } else { var del = ''; }
215
+ jQuery('#items_array').val(arr+del+cur);
216
+ } else {
217
+ var cur = jQuery(this).val();
218
+ var arr = jQuery('#items_array').val().split(',');
219
+ arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
220
+ jQuery('#items_array').val(arr);
221
+ };
222
+ });
223
+ });
224
+ function checkAll(form) {
225
+ for (i = 0, n = form.elements.length; i < n; i++) {
226
+ if(form.elements[i].type == "checkbox") {
227
+ if(form.elements[i].name == "doaction[]") {
228
+ if(form.elements[i].checked == true)
229
+ form.elements[i].checked = false;
230
+ else
231
+ form.elements[i].checked = true;
232
+ }
233
+ }
234
+ }
235
+ var arr = jQuery('.cb input:checked').map(function(){return jQuery(this).val();}).get().join(',');
236
+ jQuery('#items_array').val(arr);
237
+ }
238
+ // this function check for a the number of selected images, sumbmit false when no one selected
239
+ function checkSelected() {
240
+ if(!jQuery('.cb input:checked')) {
241
+ alert('<?php echo js_escape(__("No items selected", "flag")); ?>');
242
+ return false;
243
+ }
244
+ actionId = jQuery('#bulkaction').val();
245
+ switch (actionId) {
246
+ case "new_playlist":
247
+ showDialog('new_playlist', 160);
248
+ return false;
249
+ break;
250
+ case "add_to_playlist":
251
+ return confirm('<?php echo sprintf(js_escape(__("You are about to add %s items to playlist \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
252
+ break;
253
+ }
254
+ return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s items \n \n 'Cancel' to stop, 'OK' to proceed.",'flag')), "' + numchecked + '") ; ?>');
255
+ }
256
+
257
+ function showDialog( windowId, height ) {
258
+ jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
259
+ jQuery("#" + windowId + "_banid").val(jQuery('#items_array').val());
260
+ tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
261
+ }
262
+ //-->
263
+ </script>
264
+ <div class="wrap">
265
+
266
+ <?php if( current_user_can('FlAG Import folder') ) {
267
+ $defaultpath = 'wp-content/';
268
+ ?>
269
+ <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.css" />
270
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/jqueryFileTree.js"></script>
271
+ <script type="text/javascript">
272
+ /* <![CDATA[ */
273
+ jQuery(function() {
274
+ jQuery("#file_browser").fileTree({
275
+ root: "<?php echo WINABSPATH; ?>",
276
+ script: "<?php echo FLAG_URLPATH; ?>admin/js/jqueryFileTree/connectors/jqueryFileTree.php",
277
+ }, function(file) {
278
+ var path = file.replace("<?php echo WINABSPATH; ?>", "");
279
+ jQuery("#bannerfolder").val(path);
280
+ });
281
+
282
+ jQuery("span.browsefiles").show().click(function(){
283
+ jQuery("#file_browser").slideToggle();
284
+ });
285
+ });
286
+ /* ]]> */
287
+ </script>
288
+
289
+ <!-- import folder -->
290
+ <div id="importfolder">
291
+ <h2><?php _e('Import banners from folder', 'flag'); ?></h2>
292
+ <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8" >
293
+ <?php wp_nonce_field('flag_addbanner'); ?>
294
+ <table class="form-table">
295
+ <tr valign="top">
296
+ <th scope="row"><?php _e('Import from Server path:', 'flag'); ?></th>
297
+ <td><input type="text" size="35" id="bannerfolder" name="bannerfolder" value="<?php echo $defaultpath; ?>" /><span class="browsefiles button" style="display:none"><?php _e('Toggle DIR Browser',"flag"); ?></span>
298
+ <div id="file_browser"></div><br />
299
+ <p><label><input type="checkbox" name="delete_files" value="delete" /> &nbsp;
300
+ <?php _e('delete files after import in WordPress Media Library','flag'); ?></label></p>
301
+ </td>
302
+ </tr>
303
+ </table>
304
+ <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?>"/></div>
305
+ </form>
306
+ </div>
307
+ <?php } ?>
308
+
309
+ <h2><?php _e('WordPress Image Library', 'flag'); ?></h2>
310
+ <form id="bannerlib" class="flagform" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
311
+ <?php wp_nonce_field('flag_bulkbanner'); ?>
312
+ <input type="hidden" name="page" value="banner-box" />
313
+
314
+ <div class="tablenav">
315
+
316
+ <div class="actions">
317
+ <?php if($added===false) { ?>
318
+ <input name="updateMedia" class="button-primary" style="float: right;" type="submit" value="<?php _e('Update Media','flag'); ?>" />
319
+ <?php if ( function_exists('json_encode') ) { ?>
320
+ <select name="bulkaction" id="bulkaction">
321
+ <option value="no_action" ><?php _e("No action",'flag'); ?></option>
322
+ <option value="new_playlist" ><?php _e("Create new playlist",'flag'); ?></option>
323
+ </select>
324
+ <input name="showThickbox" class="button-secondary" type="submit" value="<?php _e('Apply','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
325
+ <?php } ?>
326
+ <a href="<?php echo admin_url( 'media-new.php'); ?>" class="button"><?php _e('Upload Banner(s)','flag'); ?></a>
327
+ <input type="hidden" id="items_array" name="items_array" value="" />
328
+ <?php } else { ?>
329
+ <input type="hidden" name="mode" value="save" />
330
+ <input style="width: 80%;" type="text" id="items_array" name="items_array" value="<?php echo $added; ?>" />
331
+ <input type="hidden" name="playlist_title" value="<?php echo $playlist['title']; ?>" />
332
+ <input type="hidden" name="skinname" value="<?php echo $playlist['skin']; ?>" />
333
+ <input type="hidden" name="skinaction" value="<?php echo $playlist['skin']; ?>" />
334
+ <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo $playlist['description']; ?></textarea>
335
+ <input name="addToPlaylist" class="button-secondary" type="submit" value="<?php _e('Update Playlist','flag'); ?>" onclick="if ( !checkSelected() ) return false;" />
336
+ <?php } ?>
337
+ </div>
338
+
339
+ </div>
340
+ <table class="widefat" cellspacing="0">
341
+ <thead>
342
+ <tr>
343
+ <th class="cb" width="54" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
344
+ <th class="id" width="64" scope="col"><div><?php _e('ID', 'flag'); ?></div></th>
345
+ <th class="thumb" width="110" scope="col"><div><?php _e('Thumbnail', 'flag'); ?></div></th>
346
+ <th class="title_filename" scope="col"><div><?php _e('Filename / Title / Link', 'flag'); ?></div></th>
347
+ <th class="description" scope="col"><div><?php _e('Description', 'flag'); ?></div></th>
348
+ </tr>
349
+ </thead>
350
+ <tfoot>
351
+ <tr>
352
+ <th class="cb" scope="col"><a href="#" onclick="checkAll(document.getElementById('bannerlib'));return false;"><?php _e('Check', 'flag'); ?></a></th>
353
+ <th class="id" scope="col"><?php _e('ID', 'flag'); ?></th>
354
+ <th class="thumb" scope="col"><?php _e('Thumbnail', 'flag'); ?></th>
355
+ <th class="title_filename" scope="col"><?php _e('Filename / Title / Link', 'flag'); ?></th>
356
+ <th class="description" scope="col"><?php _e('Description', 'flag'); ?></th>
357
+ </tr>
358
+ </tfoot>
359
+ <tbody>
360
+ <?php $bannerlist = get_posts( $args = array(
361
+ 'numberposts' => -1,
362
+ 'orderby' => 'ID',
363
+ 'order' => 'DESC',
364
+ 'post_type' => 'attachment',
365
+ 'post_mime_type' => array('image') )
366
+ );
367
+ $uploads = wp_upload_dir();
368
+ $flag_options = get_option('flag_options');
369
+ if($bannerlist) {
370
+ foreach($bannerlist as $ban) {
371
+ $list[] = $ban->ID;
372
+ }
373
+ $class = ' class="alternate"';
374
+ foreach($bannerlist as $ban) {
375
+ $class = ( empty($class) ) ? ' class="alternate"' : '';
376
+ $class2 = ( empty($class) ) ? '' : ' alternate';
377
+ $ex = $checked = '';
378
+ if($added!==false && in_array($ban->ID, $exclude) ) {
379
+ $ex = ' style="background-color:#DDFFBB;" title="'.__("Already Added", "flag").'"';
380
+ $checked = ' checked="checked"';
381
+ }
382
+ $bg = ( !isset($class) || $class == 'class="alternate"' ) ? 'f9f9f9' : 'ffffff';
383
+ $thumb = $banthumb = get_post_meta($ban->ID, 'thumbnail', true);
384
+ $link = get_post_meta($ban->ID, 'link', true);
385
+ if(empty($thumb)) {
386
+ $thumb = wp_get_attachment_thumb_url($ban->ID);
387
+ $banthumb = '';
388
+ }
389
+ $url = wp_get_attachment_url($ban->ID);
390
+ ?>
391
+ <tr id="ban-<?php echo $ban->ID; ?>"<?php echo $class.$ex; ?>>
392
+ <td class="cb"><input name="doaction[]" type="checkbox"<?php echo $checked; ?> value="<?php echo $ban->ID; ?>" /></td>
393
+ <td class="id"><p style="margin-bottom: 3px; white-space: nowrap;">ID: <?php echo $ban->ID; ?></p></td>
394
+ <td class="thumb">
395
+ <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>
396
+ </td>
397
+ <td class="title_filename">
398
+ <strong><a href="<?php echo $url; ?>"><?php echo basename($url); ?></a></strong><br />
399
+ <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 $ban->post_title; ?></textarea><br />
400
+ <?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 $link; ?>" /><br />
401
+ </td>
402
+ <td class="description">
403
+ <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 $ban->post_content; ?></textarea>
404
+ </td>
405
+ </tr>
406
+ <?php
407
+ }
408
+ } else {
409
+ echo '<tr><td colspan="5" align="center"><strong>'.__('No images in WordPress Media Library.','flag').'</strong></td></tr>';
410
+ }
411
+ ?>
412
+ </tbody>
413
+ </table>
414
+ </form>
415
+ </div>
416
+
417
+ <!-- #new_playlist -->
418
+ <div id="new_playlist" style="display: none;" >
419
+ <form id="form_new_playlist" method="POST" action="<?php echo $filepath; ?>" accept-charset="utf-8">
420
+ <?php wp_nonce_field('flag_thickbox_form'); ?>
421
+ <input type="hidden" id="new_playlist_banid" name="items_array" value="" />
422
+ <input type="hidden" id="new_playlist_bulkaction" name="TB_bulkaction" value="" />
423
+ <input type="hidden" name="mode" value="save" />
424
+ <input type="hidden" name="page" value="banner-box" />
425
+ <table width="100%" border="0" cellspacing="3" cellpadding="3" >
426
+ <tr valign="top">
427
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Title','flag'); ?></th>
428
+ <td><input type="text" class="alignleft" name="playlist_title" value="" />
429
+ <div class="alignright"><strong><?php _e("Choose skin", 'flag'); ?>:</strong>
430
+ <select id="skinname" name="skinname" style="width: 200px; height: 24px; font-size: 11px;">
431
+ <?php require_once (dirname(__FILE__) . '/get_skin.php');
432
+ $all_skins = get_skins($skin_folder='', $type='b');
433
+ if(count($all_skins)) {
434
+ foreach ( (array)$all_skins as $skin_file => $skin_data) {
435
+ echo '<option value="'.dirname($skin_file).'">'.$skin_data['Name'].'</option>'."\n";
436
+ }
437
+ } else {
438
+ echo '<option value="banner_default">'.__("No Skins", "flag").'</option>';
439
+ }
440
+ ?>
441
+ </select>
442
+ </div>
443
+ </td>
444
+ </tr>
445
+ <tr valign="top">
446
+ <th align="left" style="padding-top: 5px;"><?php _e('Playlist Description','flag'); ?></th>
447
+ <td><textarea style="width:100%;" rows="3" cols="60" name="playlist_descr"></textarea></td>
448
+ </tr>
449
+ <tr>
450
+ <td>&nbsp;</td>
451
+ <td align="right"><input class="button-secondary" type="reset" value="&nbsp;<?php _e('Cancel', 'flag'); ?>&nbsp;" onclick="tb_remove()"/>
452
+ &nbsp; &nbsp; &nbsp;
453
+ <input class="button-primary " type="submit" name="TB_NewPlaylist" value="<?php _e('OK', 'flag'); ?>" />
454
+ </td>
455
+ </tr>
456
+ </table>
457
+ </form>
458
+ </div>
459
+ <!-- /#new_playlist -->
460
+ <?php } ?>
admin/banner-sort.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author Sergey Pasyuk
5
+ * @copyright 2011
6
+ */
7
+
8
+ function flag_b_playlist_order($playlist){
9
+ global $wpdb;
10
+
11
+ //this is the url without any presort variable
12
+ $base_url = admin_url() . 'admin.php?page=' . $_GET['page'];
13
+ $flag_options = get_option('flag_options');
14
+ $playlistPath = $flag_options['galleryPath'].'playlists/banner/'.$_GET['playlist'].'.xml';
15
+ $playlist = get_b_playlist_data(ABSPATH.$playlistPath);
16
+ $items_a = $playlist['items'];
17
+ $items = implode(',',$playlist['items']);
18
+ ?>
19
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablednd_0_5.js"></script>
20
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/jquery.tablesorter.js"></script>
21
+ <div class="wrap">
22
+ <h2><?php _e('Sort Gallery', 'flag'); ?></h2>
23
+
24
+ <div class="alignright tablenav" style="margin-bottom: -36px;">
25
+ <a href="<?php echo $base_url.'&amp;playlist='.$_GET['playlist'].'&amp;mode=edit'; ?>" class="button-secondary action"><?php _e('Back to playlist', 'flag'); ?></a>
26
+ </div>
27
+ <form id="sortPlaylist" method="POST" action="<?php echo $base_url.'&amp;playlist='.$_GET['playlist'].'&amp;mode=edit'; ?>" accept-charset="utf-8">
28
+ <div class="alignleft tablenav">
29
+ <?php wp_nonce_field('flag_updatesortorder'); ?>
30
+ <input class="button-primary action" type="submit" name="updatePlaylist" value="<?php _e('Update Sort Order', 'flag'); ?>" />
31
+ </div>
32
+ <br clear="all" />
33
+ <input type="hidden" name="playlist_title" value="<?php echo $playlist['title']; ?>" />
34
+ <input type="hidden" name="skinname" value="<?php echo $playlist['skin']; ?>" />
35
+ <input type="hidden" name="skinaction" value="<?php echo $playlist['skin']; ?>" />
36
+ <textarea style="display: none;" name="playlist_descr" cols="40" rows="1"><?php echo $playlist['description']; ?></textarea>
37
+ <script type="text/javascript">
38
+ /*<![CDATA[*/
39
+ jQuery(document).ready(function($) {
40
+ // Initialise the table
41
+ jQuery("#listitems").tableDnD({
42
+ onDragClass: "myDragClass",
43
+ onDrop: function() {
44
+ jQuery("#listitems tr:even").addClass('alternate');
45
+ jQuery("#listitems tr:odd").removeClass('alternate');
46
+ }
47
+ });
48
+ $("#flag-listitems").tablesorter({
49
+ // pass the headers argument and assing a object
50
+ headers: {
51
+ // assign the secound column (we start counting zero)
52
+ 1: {
53
+ // disable it by setting the property sorter to false
54
+ sorter: false
55
+ }
56
+ }
57
+ });
58
+ $("#flag-listitems").bind("sortEnd",function() {
59
+ jQuery("#listitems tr:even").addClass('alternate');
60
+ jQuery("#listitems tr:odd").removeClass('alternate');
61
+ });
62
+
63
+ });
64
+ /*]]>*/
65
+ </script>
66
+ <table id="flag-listitems" class="widefat fixed" cellspacing="0" >
67
+
68
+ <thead>
69
+ <tr>
70
+ <th class="header" width="54"><p style="margin-right:-10px;"><?php _e('ID', 'flag'); ?></p></th>
71
+ <th width="50"><div><?php _e('Thumb', 'flag'); ?></div></th>
72
+ <th class="header"><p><?php _e('Filename', 'flag'); ?></p></th>
73
+ <th class="header"><p><?php _e('Title', 'flag'); ?></p></th>
74
+ </tr>
75
+ </thead>
76
+ <tfoot>
77
+ <tr>
78
+ <th><?php _e('ID', 'flag'); ?></th>
79
+ <th><?php _e('Thumb', 'flag'); ?></th>
80
+ <th><?php _e('Filename', 'flag'); ?></th>
81
+ <th><?php _e('Title', 'flag'); ?></th>
82
+ </tr>
83
+ </tfoot>
84
+ <tbody id="listitems">
85
+ <?php
86
+ if(count($items_a)) {
87
+ $counter = 0;
88
+ foreach($items_a as $item) {
89
+ $ban = get_post($item);
90
+ $thumb = get_post_meta($item, 'thumbnail', true);
91
+ if(empty($thumb)) {
92
+ $thumb = wp_get_attachment_thumb_url($ban->ID);
93
+ }
94
+ $alternate = ( !isset($alternate) || $alternate == 'alternate' ) ? '' : 'alternate';
95
+ $counter++;
96
+ $bg = ( !isset($alternate) || $alternate == 'alternate' ) ? 'f9f9f9' : 'ffffff';
97
+ $url = wp_get_attachment_url($ban->ID);
98
+ ?>
99
+ <tr id="$ban-<?php echo $ban->ID; ?>" class="<?php echo $alternate; ?> iedit" valign="top">
100
+ <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>
101
+ <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>
102
+ <td><?php echo basename($url); ?></td>
103
+ <td><?php echo $ban->post_title; ?></td>
104
+ </tr>
105
+ <?php
106
+ }
107
+ } else {
108
+ echo '<tr><td colspan="4" align="center"><strong>'.__('No entries found','flag').'</strong></td></tr>';
109
+ }
110
+ ?>
111
+ </tbody>
112
+ </table>
113
+ <p class="actions"><input type="submit" class="button-primary action" name="updatePlaylist" value="<?php _e('Update Sort Order', 'flag'); ?>" /></p>
114
+ </form>
115
+ <br class="clear"/>
116
+ </div><!-- /#wrap -->
117
+
118
+ <?php
119
+ }
120
+ ?>
admin/banner.functions.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
3
+
4
+ function get_b_playlist_data( $playlist_file ) {
5
+ global $wpdb;
6
+ $playlist_content = file_get_contents($playlist_file);
7
+
8
+ $playlist_data['title'] = flagGallery::flagGetBetween($playlist_content,'<title><![CDATA[',']]></title>');
9
+ $playlist_data['skin'] = flagGallery::flagGetBetween($playlist_content,'<skin><![CDATA[',']]></skin>');
10
+ $playlist_data['width'] = flagGallery::flagGetBetween($playlist_content,'<width><![CDATA[',']]></width>');
11
+ $playlist_data['height'] = flagGallery::flagGetBetween($playlist_content,'<height><![CDATA[',']]></height>');
12
+ $playlist_data['description'] = flagGallery::flagGetBetween($playlist_content,'<description><![CDATA[',']]></description>');
13
+ preg_match_all( '|<item id="(.*)">|', $playlist_content, $items );
14
+ $playlist_data['items'] = $items[1];
15
+ return $playlist_data;
16
+ }
17
+
18
+ /**
19
+ * Check the playlists directory and retrieve all playlist files with playlist data.
20
+ *
21
+ */
22
+ function get_b_playlists($playlist_folder = '') {
23
+
24
+ $flag_options = get_option('flag_options');
25
+ $flag_playlists = array ();
26
+ $playlist_root = ABSPATH.$flag_options['galleryPath'].'playlists/banner';
27
+ if( !empty($playlist_folder) )
28
+ $playlist_root = $playlist_folder;
29
+
30
+ // Files in flagallery/playlists directory
31
+ $playlists_dir = @ opendir( $playlist_root);
32
+ $playlist_files = array();
33
+ if ( $playlists_dir ) {
34
+ while (($file = readdir( $playlists_dir ) ) !== false ) {
35
+ if ( substr($file, 0, 1) == '.' )
36
+ continue;
37
+ if ( substr($file, -4) == '.xml' )
38
+ $playlist_files[] = $file;
39
+ }
40
+ }
41
+ @closedir( $playlists_dir );
42
+
43
+ if ( !$playlists_dir || empty($playlist_files) )
44
+ return $flag_playlists;
45
+
46
+ foreach ( $playlist_files as $playlist_file ) {
47
+ if ( !is_readable( "$playlist_root/$playlist_file" ) )
48
+ continue;
49
+
50
+ $playlist_data = get_b_playlist_data( "$playlist_root/$playlist_file" );
51
+
52
+ if ( empty ( $playlist_data['title'] ) )
53
+ continue;
54
+
55
+ $flag_playlists[basename( $playlist_file, ".xml" )] = $playlist_data;
56
+ }
57
+ uasort( $flag_playlists, create_function( '$a, $b', 'return strnatcasecmp( $a["title"], $b["title"] );' ));
58
+
59
+ return $flag_playlists;
60
+ }
61
+
62
+ function flagSave_bPlaylist($title,$descr,$data,$file='',$skinaction='') {
63
+ global $wpdb;
64
+ require_once(ABSPATH . '/wp-admin/includes/image.php');
65
+ if(!trim($title)) {
66
+ $title = 'default';
67
+ }
68
+ if (!$file) {
69
+ $file = sanitize_title($title);
70
+ }
71
+ if(!is_array($data))
72
+ $data = explode(',', $data);
73
+
74
+ $flag_options = get_option('flag_options');
75
+ $skin = isset($_POST['skinname'])? $_POST['skinname'] : 'banner_default';
76
+ if(!$skinaction) {
77
+ $skinaction = isset($_POST['skinaction'])? $_POST['skinaction'] : 'update';
78
+ }
79
+ $skinpath = trailingslashit( $flag_options['skinsDirABS'] ).$skin;
80
+ $playlistPath = ABSPATH.$flag_options['galleryPath'].'playlists/banner/'.$file.'.xml';
81
+ if( file_exists($playlistPath) && ($skin == $skinaction) ) {
82
+ $settings = file_get_contents($playlistPath);
83
+ } else {
84
+ $settings = file_get_contents($skinpath . "/settings/settings.xml");
85
+ }
86
+ $properties = flagGallery::flagGetBetween($settings,'<properties>','</properties>');
87
+ $w = flagGallery::flagGetBetween($properties,'<width><![CDATA[',']]></width>');
88
+ $h = flagGallery::flagGetBetween($properties,'<height><![CDATA[',']]></height>');
89
+ $suffix = $w.'x'.$h;
90
+ if(count($data)) {
91
+ $content = '<gallery>
92
+ <properties>'.$properties.'</properties>
93
+ <category id="'.$file.'">
94
+ <properties>
95
+ <title><![CDATA['.$title.']]></title>
96
+ <description><![CDATA['.$descr.']]></description>
97
+ <skin><![CDATA['.$skin.']]></skin>
98
+ </properties>
99
+ <items>';
100
+
101
+ foreach( (array) $data as $id) {
102
+ $ban = get_post($id);
103
+ if($ban->ID) {
104
+ $url = wp_get_attachment_url($ban->ID);
105
+ if($skin == 'banner_default') {
106
+ $path = get_attached_file($ban->ID);
107
+ $info = pathinfo($path);
108
+ $dir = $info['dirname'];
109
+ $ext = $info['extension'];
110
+ $name = urldecode( basename( str_replace( '%2F', '/', urlencode( $path ) ), ".$ext" ) );
111
+ $img_file = "{$dir}/{$name}-{$suffix}.{$ext}";
112
+ if(!file_exists($img_file)){
113
+ $thumb = image_resize($path,$w,$h,$cut=true,$suffix);
114
+ if(is_string($thumb)) {
115
+ $img = substr($thumb, strpos($thumb, 'wp-content'));
116
+ $track = get_bloginfo('wpurl') . '/' . $img;
117
+ } else {
118
+ $track = $url;
119
+ }
120
+
121
+ } else {
122
+ $track = dirname($url)."/{$name}-{$suffix}.{$ext}";
123
+ }
124
+ } else {
125
+ $track = $url;
126
+ }
127
+ $thumbnail = get_post_meta($id, 'thumbnail', true);
128
+ $link = get_post_meta($id, 'link', true);
129
+ $preview = get_post_meta($id, 'preview', true);
130
+ $content .= '
131
+ <item id="'.$ban->ID.'">
132
+ <track>'.$track.'</track>
133
+ <title><![CDATA['.$ban->post_title.']]></title>
134
+ <link>'.$link.'</link>
135
+ <preview>'.$preview.'</preview>
136
+ <description><![CDATA['.$ban->post_content.']]></description>
137
+ <thumbnail>'.$thumbnail.'</thumbnail>
138
+ </item>';
139
+ }
140
+ }
141
+ $content .= '
142
+ </items>
143
+ </category>
144
+ </gallery>';
145
+ // Save options
146
+ $flag_options = get_option('flag_options');
147
+ if(wp_mkdir_p(ABSPATH.$flag_options['galleryPath'].'playlists/banner/')) {
148
+ if( flagGallery::saveFile($playlistPath,$content,'w') ){
149
+ flagGallery::show_message(__('Playlist Saved Successfully','flag'));
150
+ }
151
+ } else {
152
+ flagGallery::show_message(__('Create directory please:','flag').'"/'.$flag_options['galleryPath'].'playlists/banner/"');
153
+ }
154
+ }
155
+ }
156
+
157
+ function flagSave_bPlaylistSkin($file) {
158
+ global $wpdb;
159
+ $flag_options = get_option('flag_options');
160
+ $playlistPath = ABSPATH.$flag_options['galleryPath'].'playlists/banner/'.$file.'.xml';
161
+ // Save options
162
+ $title = $_POST['playlist_title'];
163
+ $descr = $_POST['playlist_descr'];
164
+ $items = get_b_playlist_data($playlistPath);
165
+ $data = $items['items'];
166
+ flagSave_bPlaylist($title,$descr,$data,$file,$skinaction='update');
167
+ }
168
+
169
+ function flag_b_playlist_delete($playlist) {
170
+ $flag_options = get_option('flag_options');
171
+ $playlistXML = ABSPATH.$flag_options['galleryPath'].'playlists/banner/'.$playlist.'.xml';
172
+ if(file_exists($playlistXML)){
173
+ if(unlink($playlistXML)) {
174
+ flagGallery::show_message("'".$playlist.".xml' ".__('deleted','flag'));
175
+ }
176
+ }
177
+ }
178
+
179
+ ?>
admin/css/flagSorter.css ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .imageBox,.imageBoxHighlighted{
2
+ width:130px; /* Total width of each image box */
3
+ height:160px; /* Total height of each image box */
4
+ float:left;
5
+ }
6
+ .imageBox_theImage{
7
+ width:110px; /* Width of image */
8
+ height:125px; /* Height of image */
9
+
10
+ /*
11
+ Don't change these values *
12
+ */
13
+ background-position: center;
14
+ background-repeat: no-repeat;
15
+ margin: 0 auto;
16
+ margin-bottom:2px;
17
+ }
18
+
19
+ .imageBox .imageBox_theImage{
20
+ border:1px solid #DDD; /* Border color for not selected images */
21
+ padding:2px;
22
+ }
23
+ .imageBoxHighlighted .imageBox_theImage{
24
+ border:3px solid #316AC5; /* Border color for selected image */
25
+ padding:0px;
26
+
27
+ }
28
+ .imageBoxHighlighted span{ /* Title of selected image */
29
+ background-color: #316AC5;
30
+ color:#FFFFFF;
31
+ padding:2px;
32
+ }
33
+
34
+ .imageBox_label{ /* Title of images - both selected and not selected */
35
+ text-align:center;
36
+ font-family: arial;
37
+ font-size:11px;
38
+ padding-top:2px;
39
+ margin: 0 auto;
40
+ }
41
+
42
+ /*
43
+ DIV that indicates where the dragged image will be placed
44
+ */
45
+ #insertionMarker{
46
+ height:150px;
47
+ width:6px;
48
+ position:absolute;
49
+ }
50
+
51
+ #insertionMarkerLine{
52
+ width:6px; /* No need to change this value */
53
+ height:145px; /* To adjust the height of the div that indicates where the dragged image will be dropped */
54
+
55
+ }
56
+
57
+ #insertionMarker img{
58
+ float:left;
59
+ }
60
+
61
+ /*
62
+ DIV that shows the image as you drag it
63
+ */
64
+ #dragDropContent{
65
+
66
+ opacity:0.4; /* 40 % opacity */
67
+ filter:alpha(opacity=40); /* 40 % opacity */
68
+
69
+ /*
70
+ No need to change these three values
71
+ */
72
+ position:absolute;
73
+ z-index:10;
74
+ display:none;
75
+
76
+ }
admin/css/flagadmin.css ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ** Flash Album Gallery Admin StyleSheet
3
+ */
4
+
5
+ /* SETTINGS FOR SKIN PAGE */
6
+ .skins .inactive,
7
+ .skins .inactive th,
8
+ .skins .inactive td {
9
+ background-color: #ebeeef;
10
+ }
11
+ .skins .active,
12
+ .skins .active th,
13
+ .skins .active td {
14
+ color: #000;
15
+ }
16
+ .skins .inactive a {
17
+ color: #557799;
18
+ }
19
+ .skins .inactive a:hover {
20
+ color: #d54e21;
21
+ }
22
+ .skins tr.first td {border-bottom:1px solid #F9F9F9;}
23
+ .skins tr.second td {border-top:none;}
24
+
25
+
26
+ /* SETTINGS FOR Overview Gallery */
27
+ .has-sidebar {
28
+ clear:left;
29
+ float:left;
30
+ width:100%;
31
+ }
32
+ .has-sidebar .has-sidebar-content {
33
+ padding-right:300px;
34
+ }
35
+
36
+ .postbox .misc-pub-section .icon { background-position:left top;background-repeat:no-repeat;padding-left:18px;}
37
+ #plugin-home {background-image:url(../images/browser.png)}
38
+ #plugin-comments {background-image:url(../images/notes.png)}
39
+ #rate-plugin {background-image:url(../images/wallpaper.png)}
40
+ #my-plugins {background-image:url(../images/map.png)}
41
+ #contact-me {background-image:url(../images/mail.png)}
42
+
43
+ #dashboard_server_settings ul.settings span {
44
+ padding-left : 10px;
45
+ color:#2583AD;
46
+ font-weight:bold;
47
+ }
48
+
49
+ .flag-overview .postbox .handlediv {
50
+ float:right;
51
+ height:24px;
52
+ width:24px;
53
+ }
54
+
55
+ #dashboard_primary .inside { margin: 0; }
56
+
57
+ #photogallerycreator .theme > p { margin: 0; padding: 0; }
58
+ #photogallerycreator .theme { overflow: hidden; padding: 7px 0; border-bottom: 1px solid #000000; }
59
+ #photogallerycreator .theme .img { margin-top: 25px; }
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;
66
+ z-index:1;
67
+ vertical-align:top;
68
+ }
69
+ #uploadQueue {}
70
+ #choosegalfirst {position:relative; float:left; margin-left:15px; overflow:hidden;}
71
+ #choosegalfirst .disabledbut {position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%;}
72
+
73
+ /* SETTINGS FOR THE OPTIONS TABLE */
74
+ .flag-options th {
75
+ width:22%;
76
+ }
77
+
78
+ /* SETTINGS FOR MANAGE TABLE */
79
+
80
+ p#flag-inlinebutton {
81
+ float:right;
82
+ margin:0pt;
83
+ position:relative;
84
+ top:-25pt;
85
+ }
86
+
87
+ .flag-tablenav .button-secondary {
88
+ padding:2px 8px;
89
+ vertical-align: top;
90
+ }
91
+
92
+ #flag-listitems td, #flag-listitems th {
93
+
94
+ }
95
+
96
+ .fixed tbody th.column-cb {
97
+ padding:7px 0 22px;
98
+ }
99
+ .fixed .column-cb {
100
+ padding:0;
101
+ width:2.2em;
102
+ }
103
+
104
+ .fixed .column-thumbnail{
105
+ width:80px;
106
+ }
107
+
108
+ .fixed .column-thumbnail img{
109
+ max-height:60px;
110
+ max-width:80px;
111
+ }
112
+
113
+ .fixed .column-id {
114
+ width: 3em;
115
+ }
116
+
117
+ .fixed .column-rating { width:100px; text-align: center; }
118
+ .fixed td.column-rating { background-color: #CCFFCC; }
119
+ .fixed .column-views_likes { width:150px; padding-left: 0; padding-right: 0; }
120
+ .fixed .column-views_likes input { width:45px; font-size: 10px; }
121
+
122
+ .fixed .column-alt_title_desc {
123
+
124
+ }
125
+
126
+ .fixed .column-exclude, .fixed .column-action, .fixed .column-delete {
127
+ width: 2.2em; text-align: center;
128
+ }
129
+ .fixed .column-exclude input {
130
+ margin-top:4px;
131
+ }
132
+ .fixed .column-views {
133
+ width: 4em; text-align: center;
134
+ }
135
+
136
+ .flagform .widefat thead th { padding: 7px 0 8px; }
137
+ .flagform .widefat tfoot th { padding: 7px 0 8px; }
138
+ .flagform .widefat thead th > div, .flagform .widefat thead th > p { margin-left: 7px; padding: 0; }
139
+ .flagform .widefat thead th.cb { width: 54px; text-align: center; }
140
+ .flagform .widefat tfoot th.cb { text-align: center; }
141
+
142
+ .albums_table { width: 600px; position: relative; background: #ffffff; border: 1px solid #cccccc; border-radius: 4px; margin: 7px 0; padding: 1px 3px; float: left; }
143
+ .albums_table .album { position: relative; background: #f8f8f8; border: 1px solid #cccccc; border-radius: 4px; margin:2px 0; padding: 3px 3px 3px 36px; }
144
+ .albums_table .album form { margin: 0; padding: 0; display: inline; }
145
+ .albums_table .albID { position: absolute; display: block; width: 30px; top: 6px; left: 0px; text-align: right; }
146
+ .albums_table .album_actions { position: absolute; display: block; top: 3px; right: 3px; text-align: right; }
147
+ .albums_table .album_categoties { background: #fefefe; border: 1px solid #cccccc; margin:1px 0; padding: 0px; min-height: 14px; }
148
+ .albums_table .album_categoties .acat { border-top: 1px solid #cccccc; padding: 3px 6px; cursor: move; position: relative; }
149
+ .albums_table .album_categoties .acat .drop { display: none; position: absolute; right: 3px; top: 1px; font-size: 18px; line-height: 100%; color: #ff0000; cursor: pointer; }
150
+ .albums_table .album_categoties .acat:hover { background-color: #FFFFEE; }
151
+ .albums_table .album_categoties .acat:hover .drop { display: block; }
152
+ .albums_table .album_categoties .acat:first-child { border-top: none; }
153
+
154
+ .alb_msg { font-size: 10px; color: #006600; }
155
+ .flag-ajax-post { cursor: pointer; text-decoration: underline; }
156
+ .flag-ajax-post:hover { color: #ff0000; }
157
+
158
+ .all_galleries { float: left; white-space: nowrap; margin: 7px 0 0px 50px; }
159
+ .all_galleries .acat { border: 1px solid #cccccc; padding: 3px 6px; margin: 3px 0; background: #fefefe; cursor: move; }
160
+ .all_galleries .acat .drop { display: none; }
161
+ .all_galleries .acat:hover { background-color: #FFFFEE; }
162
+
163
+ .floatholder { overflow: hidden; }
164
+ /* SETTINGS FOR PROGRESS BAR */
165
+
166
+ div .progressborder {
167
+ border: 1px inset ;
168
+ display: block;
169
+ height: 20px;
170
+ background-color: #464646;
171
+ width: 100%;
172
+ margin-top: 15px;
173
+ margin-bottom: 15px;
174
+ }
175
+
176
+ div .progressbar {
177
+ border: medium none ;
178
+ display: block;
179
+ height: 20px;
180
+ background-color: #D54E21;
181
+ width: 0%;
182
+ }
183
+
184
+ div .progressbar span {
185
+ display: inline;
186
+ position: relative;
187
+ color: white;
188
+ font-weight: bold;
189
+ padding-left: 5px;
190
+ }
191
+
192
+
193
+ .show_details
194
+ {
195
+ height: 16px;
196
+ line-height: 20px;
197
+ overflow: hidden;
198
+ min-width: 8em;
199
+ padding: 3px;
200
+ cursor:pointer;
201
+ }
202
+
203
+ .show_details span
204
+ {
205
+ border-bottom:1px solid #999;
206
+ white-space:pre;
207
+ }
208
+ .show_details:hover
209
+ {
210
+ height: auto;
211
+ overflow: visible;
212
+ border: 1px solid #999;
213
+ }
214
+
215
+ /* SETTINGS FOR SORT GALLERY */
216
+ #flag-listitems .header p {
217
+ background-image:url(../images/sortbg.gif);
218
+ background-position:right center;
219
+ background-repeat:no-repeat;
220
+ cursor:pointer;
221
+ margin:0;
222
+ }
223
+ #flag-listitems .headerSortDown p {
224
+ background-image:url(../images/desc.gif) !important;
225
+ background-position:right center;
226
+ background-repeat:no-repeat;
227
+ cursor:pointer;
228
+ margin:0;
229
+ }
230
+ #flag-listitems .headerSortUp p {
231
+ background-image:url(../images/asc.gif) !important;
232
+ background-position:right center;
233
+ background-repeat:no-repeat;
234
+ cursor:pointer;
235
+ margin:0;
236
+ }
237
+
238
+ /* UPGRADE PAGE */
239
+
240
+ .error_inline {
241
+ background:#FFEBE8 none repeat scroll 0%;
242
+ border:1px solid #CC0000;
243
+ margin:5px auto;
244
+ padding:10px;
245
+ }
246
+
247
+ /* MEDIA BOX */
248
+
249
+ p.row-actions {
250
+ margin:0px;
251
+ padding:10px 4px 0;
252
+ }
253
+
254
+ div#TB_window iframe#TB_iframeContent { width: 100% !important; }
255
+ div.message { background: #ffffee; border: 1px solid #cccccc; border-radius: 4px; padding: 1px 10px; margin: 24px 20px 10px 0; font-size: 12px; }
256
+ div.message .flag_progress { position: relative; height: 18px; width: 400px; border: 1px solid #0066FF; background-color: #ffffff; margin: 7px 0; }
257
+ div.message .flag_progress .txt { position: absolute; left: 10px; top: 0; line-height: 18px; font-weight: bold; height: 18px; z-index: 10; }
258
+ div.message .flag_progress .flag_complete { position: absolute; left: 0; top: 0; height: 18px; width: 0px; overflow: hidden; background: #00FFB7; z-index: 5; }
259
+ div#license div p { font-size: 13px; }
260
+ .highlight_new { background-color: #E4F2FD; color: #000000; font-weight: bold; }
admin/css/flagallery.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /*
2
+ ** Flash Album Gallery StyleSheet
3
+ */
4
+ .flashalbum { overflow:hidden; position:relative;}
5
+ .grandmusic, .grandvideo, .grandflv, .grandmp3, .grandbanner { overflow:hidden; position:relative; }
6
+ body.FlAG { margin: 0; padding: 0; font-size: 0; line-height: 0; }
7
+ body.FlAG .FlAGd * { margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; font-size: 0 !important; line-height: 0 !important; height: 0 !important; border-style: none !important; }
8
+ body.FlAG .FlAGd img { display: none !important; }
admin/css/flagallery_nocrawler.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ** Flash Album Gallery StyleSheet (if is not crawler)
3
+ */
4
+ .flag_alternate { display: none; }
5
+ .flag_alternate .flagcatlinks { padding: 3px; margin:0 0 3px; background-color: #292929; text-align: left; }
6
+ .flag_alternate .flagcatlinks a.flagcat { display: inline-block; padding: 4px 10px; margin: 2px; border: none; font: 14px/16px Tahoma; text-decoration: none; background: none; color: #ffffff; background-color: #292929; }
7
+ .flag_alternate .flagcatlinks a.flagcat:hover { text-decoration: none; background: none; }
8
+ .flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #ffffff; background-color: #737373; outline: none; }
9
+ .flag_alternate .flagcatlinks a.flagcat:first-child { }
10
+ .flag_alternate .flagcategory { display: none; font-size: 0; line-height: 0; }
11
+ .flagcatlinks a.backlink { display: inline-block; padding: 4px 10px; margin: 2px text-decoration: none; outline: none; font-size: 12px; font-family: Verdana; font-weight: bold; line-height: 16px; }
12
+ .flagcatlinks a.backlink:hover { text-decoration: underline; }
admin/css/flagallery_noflash.css ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ** Flash Album Gallery StyleSheet (no flash)
3
+ */
4
+ .flashalbum {
5
+ -webkit-user-select: none;
6
+ -khtml-user-select: none;
7
+ -moz-user-select: -moz-none;
8
+ -ms-user-select: none;
9
+ -o-user-select: none;
10
+ user-select: none;
11
+ }
12
+ .flag_alternate { background-color: <?php echo $bg; ?>; margin: 7px 0; }
13
+ .flag_alternate .flagcategory { width: 100%; height: auto; position: relative; text-align: center; padding-bottom: 4px; }
14
+ .flag_alternate .flagcategory a.flag_pic_alt { display: inline-block; margin: 1px 0 0 1px; padding: 0; height: 100px; width: 115px; line-height: 96px; position:relative; z-index: 2; text-align: center; z-index:99; cursor:pointer; background-color: #ffffff; border: 2px solid #ffffff; text-decoration: none; background-image: url(../images/loadingAnimation.gif); background-repeat: no-repeat; background-position: 50% 50%; font-size: 8px; color: #ffffff; }
15
+ .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc { display: none; padding: 4px; line-height: 140%; font-size: 12px; }
16
+ .flag_alternate .flagcategory a.flag_pic_alt > .flag_pic_desc * { display: none; line-height: 140%; font-size: 12px !important; }
17
+ .flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #ffffff; border: 2px solid #4a4a4a; color: #4a4a4a; text-decoration: none; z-index: 3; }
18
+ .flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #4a4a4a; }
19
+ .flag_alternate .flagcategory a.flag_pic_alt > img { vertical-align: middle; display:inline-block; position: static; margin: 0 auto; padding: 0; border: none; height: 100px !important; width: 115px !important; max-width: 115px; min-width: 115px; }
admin/css/tabs.css ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #slider {
2
+ border-color:#EBEBEB rgb(204, 204, 204) rgb(204, 204, 204) rgb(235, 235, 235);
3
+ border-style:solid;
4
+ border-width:1px;
5
+ padding:2px;
6
+ margin-top:45px;
7
+
8
+ -moz-border-radius-topright: 6px;
9
+ -khtml-border-top-right-radius: 6px;
10
+ -webkit-border-top-right-radius: 6px;
11
+ border-top-right-radius: 6px;
12
+ -moz-border-radius-topleft: 6px;
13
+ -khtml-border-top-left-radius: 6px;
14
+ -webkit-border-top-left-radius: 6px;
15
+ border-top-left-radius: 6px;
16
+ }
17
+ .cptab {
18
+ display: none;
19
+ padding:0 15px;
20
+ }
21
+ .cptab h2 {margin-top:-85px; margin-bottom:45px;}
22
+
23
+ #tabs{
24
+ display: block;
25
+ background:#F1F1F1 none repeat scroll 0%;
26
+ font-size:14px;
27
+ overflow:hidden;
28
+
29
+ -moz-border-radius-topright: 6px;
30
+ -khtml-border-top-right-radius: 6px;
31
+ -webkit-border-top-right-radius: 6px;
32
+ border-top-right-radius: 6px;
33
+ -moz-border-radius-topleft: 6px;
34
+ -khtml-border-top-left-radius: 6px;
35
+ -webkit-border-top-left-radius: 6px;
36
+ border-top-left-radius: 6px;
37
+ }
38
+
39
+ .tabs {
40
+ list-style: none;
41
+ margin: 0;
42
+ padding: 0 0 0 10px;
43
+ }
44
+ .tabs:after { /* clearing without presentational markup, IE gets extra treatment */
45
+ display: block;
46
+ clear: both;
47
+ content: " ";
48
+ }
49
+ .tabs li {
50
+ float: left;
51
+ padding: 6px 5px;
52
+ min-width: 84px; /* be nice to Opera */
53
+ margin: 2px 2px 0px 1px !important;
54
+ text-decoration: none;
55
+ list-style: none;
56
+ }
57
+ .tabs a, .tabs a span {
58
+ display: block;
59
+ padding: 0 1px;
60
+ }
61
+
62
+ .tabs a {
63
+ margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
64
+ padding-left: 0;
65
+ color: #2583AD;
66
+ line-height: 1.2;
67
+ text-align: center;
68
+ text-decoration: none;
69
+ white-space: nowrap; /* required in IE 6 */
70
+ outline: 0; /* prevent dotted border in Firefox */
71
+ }
72
+ .tabs .selected{
73
+ background: #6D6D6D url(../images/menu-bits.gif) repeat-x scroll left top;
74
+ border-color: #6D6D6D;
75
+ color: #FFFFFF;
76
+ text-shadow:0 -1px 0 #666666;
77
+
78
+ -moz-border-radius-topright: 6px;
79
+ -khtml-border-top-right-radius: 6px;
80
+ -webkit-border-top-right-radius: 6px;
81
+ border-top-right-radius: 6px;
82
+ -moz-border-radius-topleft: 6px;
83
+ -khtml-border-top-left-radius: 6px;
84
+ -webkit-border-top-left-radius: 6px;
85
+ border-top-left-radius: 6px;
86
+ }
87
+
88
+ .selected a,
89
+ .selected a:hover {
90
+ color:#FFFFFF !important;
91
+ }
92
+
93
+ .tabs .selected a,
94
+ .tabs .selected a:hover {
95
+ position: relative;
96
+ top: 1px;
97
+ z-index: 2;
98
+ margin-top: 0;
99
+ }
100
+
101
+ .tabs li a:hover {
102
+ color:#D54E21;
103
+ }
104
+
105
+ .tabs .selected a, .tabs a:hover, .tabs a:focus, .tabs a:active {
106
+ background-position: 100% -150px;
107
+ }
108
+ .tabs a {
109
+ background-position: 100% -100px;
110
+ }
111
+ .tabs .selected a:link, .tabs .selected a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
112
+ cursor: text;
113
+ }
114
+ .tabs a:hover, .tabs a:focus, .tabs a:active { /* @ Opera, we need to be explicit again here now... */
115
+ cursor: pointer;
116
+ }
117
+
118
+
119
+ /* Additional IE specific bug fixes... */
120
+ * html .tabs { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
121
+ display: inline-block;
122
+ }
123
+ *:first-child+html .tabs { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
124
+ display: inline-block;
125
+ }
126
+
admin/db_skin_color_scheme.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php function flag_skin_options() {
2
+ $flag_options = get_option('flag_options');
3
+ $flashBacktransparent = $flag_options['flashBacktransparent'];
4
+ $flashBackcolor = str_replace('#','',$flag_options['flashBackcolor']);
5
+ $buttonsBG = str_replace('#','',$flag_options['buttonsBG']);
6
+ $buttonsMouseOver = str_replace('#','',$flag_options['buttonsMouseOver']);
7
+ $buttonsMouseOut = str_replace('#','',$flag_options['buttonsMouseOut']);
8
+ $catButtonsMouseOver = str_replace('#','',$flag_options['catButtonsMouseOver']);
9
+ $catButtonsMouseOut = str_replace('#','',$flag_options['catButtonsMouseOut']);
10
+ $catButtonsTextMouseOver = str_replace('#','',$flag_options['catButtonsTextMouseOver']);
11
+ $catButtonsTextMouseOut = str_replace('#','',$flag_options['catButtonsTextMouseOut']);
12
+ $thumbMouseOver = str_replace('#','',$flag_options['thumbMouseOver']);
13
+ $thumbMouseOut = str_replace('#','',$flag_options['thumbMouseOut']);
14
+ $mainTitle = str_replace('#','',$flag_options['mainTitle']);
15
+ $categoryTitle = str_replace('#','',$flag_options['categoryTitle']);
16
+ $itemBG = str_replace('#','',$flag_options['itemBG']);
17
+ $itemTitle = str_replace('#','',$flag_options['itemTitle']);
18
+ $itemDescription = str_replace('#','',$flag_options['itemDescription']);
19
+ ?>
20
+ <script type="text/javascript">
21
+ jQuery(document).ready(function() {
22
+ jQuery('#colors .colorPick').each( function(){
23
+ var inpID = jQuery(this).attr('name');
24
+ jQuery('#cp_'+inpID).farbtastic('#'+inpID);
25
+ jQuery('#'+inpID).focus( function(){
26
+ jQuery('#cp_'+inpID).show();
27
+ });
28
+ jQuery('#'+inpID).blur( function(){
29
+ jQuery('#cp_'+inpID).hide();
30
+ });
31
+ });
32
+ function tChecked() {
33
+ if( jQuery('#flashBacktransparent').attr('checked') ) {
34
+ var dclone=jQuery('#flashBackcolor').clone();
35
+ jQuery('#flashBackcolor').hide();
36
+ dclone.removeAttr('style').removeAttr('id').removeAttr('name').addClass('flashBackcolor').attr('disabled','disabled').insertAfter('#flashBackcolor');
37
+ } else {
38
+ jQuery('.flashBackcolor').remove();
39
+ jQuery('#flashBackcolor').show();
40
+ }
41
+ }
42
+ tChecked();
43
+ jQuery("#flashBacktransparent").click(tChecked);
44
+ });
45
+ </script>
46
+ <form method="POST"><div>
47
+ <?php wp_nonce_field('flag_settings'); ?>
48
+ <input type="hidden" name="page_options" value="flashBackcolor,buttonsBG,flashBacktransparent,buttonsMouseOver,buttonsMouseOut,catButtonsMouseOver,catButtonsMouseOut,catButtonsTextMouseOver,catButtonsTextMouseOut,thumbMouseOver,thumbMouseOut,mainTitle,categoryTitle,itemBG,itemTitle,itemDescription" />
49
+
50
+ <!-- Color settings -->
51
+ <h3><?php _e('Color Settings','flag'); ?></h3>
52
+ <table id="colors" class="form-table flag-options">
53
+ <tr>
54
+ <th style="width: 30%;"><?php _e('Background Color','flag'); ?>:</th>
55
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="flashBackcolor" name="flashBackcolor" value="<?php echo $flashBackcolor?>" /><div id="cp_flashBackcolor" style="background:#F9F9F9;position:absolute;display:none;"></div> <label><input type="checkbox" id="flashBacktransparent" name="flashBacktransparent" value="transparent" <?php checked('transparent', $flashBacktransparent); ?> /> transparent</label></td>
56
+ </tr>
57
+ <tr>
58
+ <th><?php _e('Buttons Background Color','flag'); ?>:</th>
59
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="buttonsBG" name="buttonsBG" value="<?php echo $buttonsBG; ?>" /><div id="cp_buttonsBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
60
+ </tr>
61
+ <tr>
62
+ <th><?php _e('Buttons Text Color','flag'); ?>:</th>
63
+ <td>
64
+ <input class="colorPick" type="text" size="7" maxlength="6" id="buttonsMouseOver" name="buttonsMouseOver" value="<?php echo $buttonsMouseOver; ?>" /> mouseOver<br />
65
+ <div id="cp_buttonsMouseOver" style="background:#F9F9F9;position:absolute;display:none;"></div>
66
+ <input class="colorPick" type="text" size="7" maxlength="6" id="buttonsMouseOut" name="buttonsMouseOut" value="<?php echo $buttonsMouseOut; ?>" /> mouseOut<br />
67
+ <div id="cp_buttonsMouseOut" style="background:#F9F9F9;position:absolute;display:none;"></div>
68
+ </td>
69
+ </tr>
70
+ <tr>
71
+ <th><?php _e('Category Buttons Color','flag'); ?>:</th>
72
+ <td>
73
+ <input class="colorPick" type="text" size="7" maxlength="6" id="catButtonsMouseOver" name="catButtonsMouseOver" value="<?php echo $catButtonsMouseOver; ?>" /> mouseOver<br />
74
+ <div id="cp_catButtonsMouseOver" style="background:#F9F9F9;position:absolute;display:none;"></div>
75
+ <input class="colorPick" type="text" size="7" maxlength="6" id="catButtonsMouseOut" name="catButtonsMouseOut" value="<?php echo $catButtonsMouseOut; ?>" /> mouseOut<br />
76
+ <div id="cp_catButtonsMouseOut" style="background:#F9F9F9;position:absolute;display:none;"></div>
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ <th><?php _e('Category Buttons Text Color','flag'); ?>:</th>
81
+ <td>
82
+ <input class="colorPick" type="text" size="7" maxlength="6" id="catButtonsTextMouseOver" name="catButtonsTextMouseOver" value="<?php echo $catButtonsTextMouseOver; ?>" /> mouseOver<br />
83
+ <div id="cp_catButtonsTextMouseOver" style="background:#F9F9F9;position:absolute;display:none;"></div>
84
+ <input class="colorPick" type="text" size="7" maxlength="6" id="catButtonsTextMouseOut" name="catButtonsTextMouseOut" value="<?php echo $catButtonsTextMouseOut; ?>" /> mouseOut<br />
85
+ <div id="cp_catButtonsTextMouseOut" style="background:#F9F9F9;position:absolute;display:none;"></div>
86
+ </td>
87
+ </tr>
88
+ <tr>
89
+ <th><?php _e('Thumbs Rollover Color','flag'); ?>:</th>
90
+ <td>
91
+ <input class="colorPick" type="text" size="7" maxlength="6" id="thumbMouseOver" name="thumbMouseOver" value="<?php echo $thumbMouseOver; ?>" /> mouseOver<br />
92
+ <div id="cp_thumbMouseOver" style="background:#F9F9F9;position:absolute;display:none;"></div>
93
+ <input class="colorPick" type="text" size="7" maxlength="6" id="thumbMouseOut" name="thumbMouseOut" value="<?php echo $thumbMouseOut; ?>" /> mouseOut<br />
94
+ <div id="cp_thumbMouseOut" style="background:#F9F9F9;position:absolute;display:none;"></div>
95
+ </td>
96
+ </tr>
97
+ <tr>
98
+ <th><?php _e('Main Title','flag'); ?>:</th>
99
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="mainTitle" name="mainTitle" value="<?php echo $mainTitle; ?>" /><div id="cp_mainTitle" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
100
+ </tr>
101
+ <tr>
102
+ <th><?php _e('Category Title','flag'); ?>:</th>
103
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="categoryTitle" name="categoryTitle" value="<?php echo $categoryTitle; ?>" /><div id="cp_categoryTitle" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
104
+ </tr>
105
+ <tr>
106
+ <th><?php _e('Item Background','flag'); ?>:</th>
107
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="itemBG" name="itemBG" value="<?php echo $itemBG; ?>" /><div id="cp_itemBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
108
+ </tr>
109
+ <tr>
110
+ <th><?php _e('Item Title','flag'); ?>:</th>
111
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="itemTitle" name="itemTitle" value="<?php echo $itemTitle; ?>" /><div id="cp_itemTitle" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
112
+ </tr>
113
+ <tr>
114
+ <th><?php _e('Item Description','flag'); ?>:</th>
115
+ <td><input class="colorPick" type="text" size="7" maxlength="6" id="itemDescription" name="itemDescription" value="<?php echo $itemDescription; ?>" /><div id="cp_itemDescription" style="background:#F9F9F9;position:absolute;display:none;"></div></td>
116
+ </tr>
117
+ </table>
118
+
119
+ <div class="clear"> &nbsp; </div>
120
+ <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes', 'flag'); ?>"/></div>
121
+ </div></form>
122
+ <?php } ?>
admin/facebook-tool.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
2
+
3
+ // check for correct capability
4
+ if ( !is_user_logged_in() )
5
+ die('-1');
6
+
7
+ // check for correct FlAG capability
8
+ if ( !current_user_can('FlAG Facebook page') )
9
+ die('-1');
10
+
11
+ if(isset($_POST['copy_file'])) {
12
+ if(copy(FLAG_ABSPATH.'facebook.php',ABSPATH.'facebook.php')) {
13
+ flagGallery::show_message(__('Success','flag'));
14
+ } else {
15
+ flagGallery::show_error(__('Failure','flag'));
16
+ }
17
+ }
18
+ global $flagdb;
19
+ require_once (dirname(__FILE__) . '/get_skin.php');
20
+ require_once (dirname(__FILE__) . '/playlist.functions.php');
21
+ require_once (dirname(__FILE__) . '/video.functions.php');
22
+ require_once (dirname(__FILE__) . '/banner.functions.php');
23
+ $i_skins = get_skins();
24
+ $all_m_playlists = get_playlists();
25
+ $all_v_playlists = get_v_playlists();
26
+ $all_b_playlists = get_b_playlists();
27
+ $fb_url = FLAG_URLPATH.'facebook.php';
28
+ if(file_exists(ABSPATH.'facebook.php')) {
29
+ $fb_url = home_url().'/facebook.php';
30
+ }
31
+ ?>
32
+ <script type="text/javascript">/*<![CDATA[*/
33
+ var url = '<?php echo $fb_url; ?>';
34
+ jQuery(document).ready(function() {
35
+ jQuery('#galleries input[value="all"]').attr('checked','checked').parent().siblings('.row').find('input').removeAttr('checked');
36
+ jQuery('#items_array').val('all');
37
+ var galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
38
+ var skin = jQuery('#skinname option:selected').val();
39
+ if(skin) skin = '&f='+skin; else skin = '';
40
+ var h = parseInt(jQuery('#galleryheight').val());
41
+ if(h) h = '&h='+h; else h = '';
42
+ var l = parseInt(jQuery('#postid').val());
43
+ if(l) l = '&l='+l; else l = '';
44
+ fb_url(galleries,skin,h,l);
45
+ jQuery('#galleries :checkbox').click(function(){
46
+ if(jQuery(this).is(':checked')){
47
+ var cur = jQuery(this).val();
48
+ if(cur == 'all') {
49
+ jQuery(this).parent().siblings('.row').find('input').removeAttr('checked');
50
+ jQuery('#items_array').val(cur);
51
+ } else {
52
+ jQuery('#galleries input[value="all"]').removeAttr('checked');
53
+ var arr = jQuery('#items_array').val();
54
+ if(arr && arr != 'all') { var del = ','; } else { arr = ''; var del = ''; }
55
+ jQuery('#items_array').val(arr+del+cur);
56
+ }
57
+ } else {
58
+ var cur = jQuery(this).val();
59
+ var arr = jQuery('#items_array').val().split(',');
60
+ arr = jQuery.grep(arr, function(a){ return a != cur; }).join(',');
61
+ if(arr) {
62
+ jQuery('#items_array').val(arr);
63
+ } else {
64
+ jQuery('#galleries input[value="all"]').attr('checked','checked');
65
+ jQuery('#items_array').val('all');
66
+ }
67
+ }
68
+ galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
69
+ skin = jQuery('#skinname option:selected').val(); if(skin) skin = '&f='+skin; else skin = '';
70
+ h = parseInt(jQuery('#galleryheight').val()); if(h) h = '&h='+h; else h = '';
71
+ l = parseInt(jQuery('#postid').val()); if(l) l = '&l='+l; else l = '';
72
+ fb_url(galleries,skin,h,l);
73
+ });
74
+ jQuery('#skinname').change(function(){
75
+ var skin = jQuery(this).val();
76
+ if(skin) {
77
+ skin = '&f='+skin;
78
+ } else {
79
+ skin = '';
80
+ }
81
+ galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
82
+ h = parseInt(jQuery('#galleryheight').val()); if(h) h = '&h='+h; else h = '';
83
+ l = parseInt(jQuery('#postid').val()); if(l) l = '&l='+l; else l = '';
84
+ fb_url(galleries,skin,h,l);
85
+ });
86
+ jQuery('#galleryheight').bind('keyup',function(){
87
+ var h = parseInt(jQuery(this).val());
88
+ if(h) {
89
+ h = '&h='+h;
90
+ } else {
91
+ h = '';
92
+ }
93
+ galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
94
+ skin = jQuery('#skinname option:selected').val(); if(skin) skin = '&f='+skin; else skin = '';
95
+ l = parseInt(jQuery('#postid').val()); if(l) l = '&l='+l; else l = '';
96
+ fb_url(galleries,skin,h,l);
97
+ });
98
+ jQuery('#postid').bind('keyup',function(){
99
+ var l = parseInt(jQuery(this).val());
100
+ if(l) {
101
+ l = '&l='+l;
102
+ } else {
103
+ l = '';
104
+ }
105
+ galleries = '?i='+jQuery('#items_array').val().split(',').join('_');
106
+ skin = jQuery('#skinname option:selected').val(); if(skin) skin = '&f='+skin; else skin = '';
107
+ h = parseInt(jQuery('#galleryheight').val()); if(h) h = '&h='+h; else h = '';
108
+ fb_url(galleries,skin,h,l);
109
+ });
110
+ jQuery('#m_playlist').change(function(){
111
+ var playlist = jQuery(this).val();
112
+ if(playlist) {
113
+ playlist = '?m='+playlist;
114
+ } else {
115
+ playlist = '?m=';
116
+ }
117
+ jQuery('#fb2_url0').val(url+playlist);
118
+ });
119
+ jQuery('#v_playlist').change(function(){
120
+ var playlist = jQuery(this).val();
121
+ if(playlist) {
122
+ playlist = '?v='+playlist;
123
+ } else {
124
+ playlist = '?v=';
125
+ }
126
+ jQuery('#fb3_url0').val(url+playlist);
127
+ });
128
+ jQuery('#b_playlist').change(function(){
129
+ var playlist = jQuery(this).val();
130
+ if(playlist) {
131
+ playlist = '?b='+playlist;
132
+ } else {
133
+ playlist = '?b=';
134
+ }
135
+ jQuery('#fb4_url0').val(url+playlist);
136
+ });
137
+ });
138
+ function fb_url(galleries,skin,h,l) {
139
+ jQuery('#fb1_url0').val(url+galleries+skin+h+l);
140
+ }
141
+ /*]]>*/</script>
142
+ <div class="wrap">
143
+ <h2><?php _e('Facebook Integration', 'flag'); ?></h2>
144
+ <p>1. Log in to your <a target="_blank" href="http://www.facebook.com">Facebook</a> account.</p>
145
+ <p>2. Search for the <a href="http://apps.facebook.com/117531781690494/?ref=ts">Page Tabs: Static HTML + iFrame</a> tabs application and select it.</p>
146
+ <p>3. Click on <strong>Add Static HTML to a page</strong> button and you'll be prompted for the page where you want the app to be added.</p>
147
+ <p>4. Once added you'll see on the left side menu of your page a new tab with a star icon called Welcome. Click on it to edit it.</p>
148
+ <p>5. Add the <strong>Facebook Page Url</strong> in the text field.</p>
149
+ <p>6. Click <strong>preview</strong> to see how it looks or <strong>save changes</strong>. The product is now added to the Welcome tab of your page.</p>
150
+ <p>7. <strong>Optional:</strong> To change the tab's name, called by default <strong>Welcome</strong>, edit your page, go to the <strong>Apps</strong> tab and click <strong>Edit Settings</strong> option next to the <strong>Page Tabs: Static HTML + iFrame</strong> application to enter the name you want.</p>
151
+ <p>8. <strong>Optional:</strong> To make the tab your default landing tab (first thing your visitors see on your page) edit your page and go to the <strong>Manage Permissions</strong> tab and change the <strong>Default Landing Tab</strong>.</p>
152
+ <br /><br />
153
+ <form id="facebook_copy" name="facebook_copy" method="POST" class="alignright">
154
+ <p>Optional: &nbsp; <input type="submit" name="copy_file" class="button-primary" value="<?php _e('Copy facebook.php file to root directory', 'flag'); ?>" /><br />
155
+ (makes Facebook page url shorter)</p>
156
+ </form>
157
+ <form id="generator1"><fieldset style="clear:both; margin:0 0 20px 0; padding: 20px; border: 1px solid #888888;"><legend style="font-size: 18px; padding: 0 5px;"><?php _e("Photo Gallery Facebook Page Generator", 'flag'); ?></legend>
158
+ <table border="0" cellpadding="4" cellspacing="0">
159
+ <tr>
160
+ <td nowrap="nowrap" valign="top"><div><?php _e("Select galleries", 'flag'); ?>:<span style="color:red;"> *</span><br /><small><?php _e("(album categories)", 'flag'); ?></small></div></td>
161
+ <td valign="top"><div id="galleries" style="width: 214px; height: 160px; overflow: auto;">
162
+ <div class="row"><input type="checkbox" value="all" checked="checked" /> <strong>* - <?php _e("all galleries", 'flag'); ?></strong></div>
163
+ <?php
164
+ $gallerylist = $flagdb->find_all_galleries('gid', 'ASC');
165
+ if(is_array($gallerylist)) {
166
+ foreach($gallerylist as $gallery) {
167
+ $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
168
+ echo '<div class="row"><input type="checkbox" value="' . $gallery->gid . '" /> <span>' . $gallery->gid . ' - ' . $name . '</span></div>' . "\n";
169
+ }
170
+ }
171
+ ?>
172
+ </div></td>
173
+ </tr>
174
+ <tr>
175
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><?php _e("Galleries order", 'flag'); ?>: &nbsp; </p></td>
176
+ <td valign="top"><p><input readonly="readonly" type="text" id="items_array" value="all" style="width: 214px;" /></p></td>
177
+ </tr>
178
+ <tr>
179
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label for="skinname"><?php _e("Choose skin", 'flag'); ?>:</label></p></td>
180
+ <td valign="top"><p><select id="skinname" name="skinname" style="width: 214px;">
181
+ <option value="" selected="selected"><?php _e("skin active by default", 'flag'); ?></option>
182
+ <?php
183
+ foreach ( (array)$i_skins as $skin_file => $skin_data) {
184
+ echo '<option value="'.dirname($skin_file).'">'.$skin_data['Name'].'</option>'."\n";
185
+ }
186
+ ?>
187
+ </select></p></td>
188
+ </tr>
189
+ <tr>
190
+ <td valign="top"><p style="padding-top:3px;"><?php _e("Skin size", 'flag'); ?>:<br /><span style="font-size:9px">(<?php _e("blank for default", 'flag'); ?>)</span></p></td>
191
+ <td valign="top"><p><?php _e("width", 'flag'); ?>: <input id="gallerywidth" type="text" disabled="disabled" style="width: 50px" value="100%" /> &nbsp; <?php _e("height", 'flag'); ?>: <input id="galleryheight" type="text" style="width: 50px" /></p></td>
192
+ </tr>
193
+ <tr>
194
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><?php _e("Post ID", 'flag'); ?>:<br /><span style="font-size:9px">(<?php _e("optional", 'flag'); ?>)</span></p></td>
195
+ <td valign="top"><p><input id="postid" type="text" /></p></td>
196
+ </tr>
197
+ <tr>
198
+ <td valign="top"><div style="padding-top:3px;"><strong><?php _e("Facebook Page Url", 'flag'); ?>: &nbsp; </strong></div></td>
199
+ <td valign="top"><input id="fb1_url0" type="text" style="width: 780px; font-size: 10px;" value="<?php echo $fb_url.'?i=all'; ?>" /></td>
200
+ </tr>
201
+ </table>
202
+ </fieldset></form>
203
+ <form id="generator2"><fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;"><legend style="font-size: 18px; padding: 0 5px;"><?php _e("mp3 Gallery Facebook Page Generator", 'flag'); ?></legend>
204
+ <table border="0" cellpadding="4" cellspacing="0">
205
+ <tr>
206
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e("Choose playlist", 'flag'); ?>:</label></p></td>
207
+ <td valign="top"><p><select id="m_playlist" style="width: 214px;">
208
+ <option value="" selected="selected"><?php _e('Choose playlist', 'flag'); ?></option>
209
+ <?php
210
+ foreach((array)$all_m_playlists as $playlist_file => $playlist_data) {
211
+ $playlist_name = basename($playlist_file, '.xml');
212
+ ?>
213
+ <option value="<?php echo $playlist_name; ?>"><?php echo $playlist_data['title']; ?></option>
214
+ <?php
215
+ }
216
+ ?>
217
+ </select></p></td>
218
+ </tr>
219
+ <tr>
220
+ <td valign="top"><div style="padding-top:3px;"><strong><?php _e("Facebook Page Url", 'flag'); ?>: &nbsp; </strong></div></td>
221
+ <td valign="top"><input id="fb2_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url.'?m='; ?>" /></td>
222
+ </tr>
223
+ </table>
224
+ </fieldset></form>
225
+ <form id="generator3"><fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;"><legend style="font-size: 18px; padding: 0 5px;"><?php _e("Video Blog Gallery Facebook Page Generator", 'flag'); ?></legend>
226
+ <table border="0" cellpadding="4" cellspacing="0">
227
+ <tr>
228
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e("Choose playlist", 'flag'); ?>:</label></p></td>
229
+ <td valign="top"><p><select id="v_playlist" style="width: 214px;">
230
+ <option value="" selected="selected"><?php _e('Choose playlist', 'flag'); ?></option>
231
+ <?php
232
+ foreach((array)$all_v_playlists as $playlist_file => $playlist_data) {
233
+ $playlist_name = basename($playlist_file, '.xml');
234
+ ?>
235
+ <option value="<?php echo $playlist_name; ?>"><?php echo $playlist_data['title']; ?></option>
236
+ <?php
237
+ }
238
+ ?>
239
+ </select></p></td>
240
+ </tr>
241
+ <tr>
242
+ <td valign="top"><div style="padding-top:3px;"><strong><?php _e("Facebook Page Url", 'flag'); ?>: &nbsp; </strong></div></td>
243
+ <td valign="top"><input id="fb3_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url.'?v='; ?>" /></td>
244
+ </tr>
245
+ </table>
246
+ </fieldset></form>
247
+ <form id="generator4"><fieldset style="padding: 20px; margin:0 0 20px 0; border: 1px solid #888888;"><legend style="font-size: 18px; padding: 0 5px;"><?php _e("Banner Box Facebook Page Generator", 'flag'); ?></legend>
248
+ <table border="0" cellpadding="4" cellspacing="0">
249
+ <tr>
250
+ <td nowrap="nowrap" valign="top"><p style="padding-top:3px;"><label><?php _e("Choose xml", 'flag'); ?>:</label></p></td>
251
+ <td valign="top"><p><select id="b_playlist" style="width: 214px;">
252
+ <option value="" selected="selected"><?php _e('Choose XML', 'flag'); ?></option>
253
+ <?php
254
+ foreach((array)$all_b_playlists as $playlist_file => $playlist_data) {
255
+ $playlist_name = basename($playlist_file, '.xml');
256
+ ?>
257
+ <option value="<?php echo $playlist_name; ?>"><?php echo $playlist_data['title']; ?></option>
258
+ <?php
259
+ }
260
+ ?>
261
+ </select></p></td>
262
+ </tr>
263
+ <tr>
264
+ <td valign="top"><div style="padding-top:3px;"><strong><?php _e("Facebook Page Url", 'flag'); ?>: &nbsp; </strong></div></td>
265
+ <td valign="top"><input id="fb4_url0" type="text" style="width: 600px; font-size: 10px;" value="<?php echo $fb_url.'?b='; ?>" /></td>
266
+ </tr>
267
+ </table>
268
+ </fieldset></form>
269
+ </div>
270
+ <?php
271
+
272
+ ?>
admin/flag_install.php ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Stop direct call
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ /**
6
+ * creates all tables for the gallery
7
+ * called during register_activation hook
8
+ *
9
+ * @access internal
10
+ * @return void
11
+ **/
12
+
13
+ function flag_install () {
14
+ global $wpdb, $wp_version;
15
+
16
+ // Check for capability
17
+ if ( !current_user_can('activate_plugins') )
18
+ return;
19
+
20
+ flag_capabilities();
21
+
22
+ // upgrade function changed in WordPress 2.3
23
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
24
+
25
+ // add charset & collate like wp core
26
+ $charset_collate = '';
27
+
28
+ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
29
+ if ( ! empty($wpdb->charset) )
30
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
31
+ if ( ! empty($wpdb->collate) )
32
+ $charset_collate .= " COLLATE $wpdb->collate";
33
+ }
34
+
35
+ $flagpictures = $wpdb->prefix . 'flag_pictures';
36
+ $flaggallery = $wpdb->prefix . 'flag_gallery';
37
+ $flagcomments = $wpdb->prefix . 'flag_comments';
38
+ $flagalbum = $wpdb->prefix . 'flag_album';
39
+
40
+ if($wpdb->get_var("show tables like '$flagpictures'") != $flagpictures) {
41
+
42
+ $sql = "CREATE TABLE " . $flagpictures . " (
43
+ pid BIGINT(20) NOT NULL AUTO_INCREMENT ,
44
+ galleryid BIGINT(20) DEFAULT '0' NOT NULL ,
45
+ filename VARCHAR(255) NOT NULL ,
46
+ description MEDIUMTEXT NULL ,
47
+ alttext MEDIUMTEXT NULL ,
48
+ imagedate DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
49
+ exclude TINYINT NULL DEFAULT '0',
50
+ sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
51
+ location TEXT,
52
+ city TINYTEXT,
53
+ state TINYTEXT,
54
+ country TINYTEXT,
55
+ credit TEXT,
56
+ copyright TEXT,
57
+ commentson INT(1) UNSIGNED NOT NULL DEFAULT '1',
58
+ hitcounter INT(11) UNSIGNED DEFAULT '0',
59
+ total_value INT(11) UNSIGNED DEFAULT '0',
60
+ total_votes INT(11) UNSIGNED DEFAULT '0',
61
+ used_ips LONGTEXT,
62
+ meta_data LONGTEXT,
63
+ PRIMARY KEY pid (pid)
64
+ ) $charset_collate;";
65
+
66
+ dbDelta($sql);
67
+ }
68
+
69
+
70
+ if($wpdb->get_var("show tables like '$flagallery'") != $flaggallery) {
71
+
72
+ $sql = "CREATE TABLE " . $flaggallery . " (
73
+ gid BIGINT(20) NOT NULL AUTO_INCREMENT ,
74
+ name VARCHAR(255) NOT NULL ,
75
+ path MEDIUMTEXT NULL ,
76
+ title MEDIUMTEXT NULL ,
77
+ galdesc MEDIUMTEXT NULL ,
78
+ previewpic BIGINT(20) NULL DEFAULT '0' ,
79
+ sortorder BIGINT(20) DEFAULT '0' NOT NULL ,
80
+ author BIGINT(20) NOT NULL DEFAULT '0' ,
81
+ PRIMARY KEY gid (gid)
82
+ ) $charset_collate;";
83
+
84
+ dbDelta($sql);
85
+ }
86
+
87
+ if($wpdb->get_var("show tables like '$flagcomments'") != $flagcomments) {
88
+ $sql = "CREATE TABLE " . $flagcomments . " (
89
+ cid int(11) unsigned NOT NULL auto_increment,
90
+ ownerid int(11) unsigned NOT NULL default '0',
91
+ name varchar(255) NOT NULL default '',
92
+ email varchar(255) NOT NULL default '',
93
+ website varchar(255) default NULL,
94
+ date datetime default NULL,
95
+ comment text,
96
+ inmoderation int(1) unsigned NOT NULL default '0',
97
+ PRIMARY KEY (cid),
98
+ KEY ownerid (ownerid)
99
+ ) $charset_collate;";
100
+
101
+ dbDelta($sql);
102
+ }
103
+
104
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$flagalbum'" )) {
105
+
106
+ $sql = "CREATE TABLE " . $flagalbum . " (
107
+ id BIGINT(20) NOT NULL AUTO_INCREMENT ,
108
+ name VARCHAR(255) NOT NULL ,
109
+ previewpic BIGINT(20) DEFAULT '0' NOT NULL ,
110
+ albumdesc MEDIUMTEXT NULL ,
111
+ categories LONGTEXT NOT NULL,
112
+ PRIMARY KEY id (id)
113
+ ) $charset_collate;";
114
+
115
+ dbDelta($sql);
116
+ }
117
+
118
+
119
+ // check one table again, to be sure
120
+ if( !$wpdb->get_var( "SHOW TABLES LIKE '$flagpictures'" ) ) {
121
+ update_option( "flag_init_check", __('Flash Album Gallery : Tables could not created, please check your database settings','flag') );
122
+ return;
123
+ }
124
+
125
+ $options = get_option('flag_options');
126
+ // set the default settings, if we didn't upgrade
127
+ if ( empty( $options ) )
128
+ flag_default_options();
129
+
130
+
131
+ // if all is passed , save the VERSIONs
132
+ add_option("flag_db_version", FLAG_DBVERSION);
133
+ add_option("flagVersion", FLAGVERSION);
134
+ }
135
+
136
+ function flag_capabilities() {
137
+ global $wp_roles;
138
+
139
+ // Set the capabilities for the administrator
140
+ $role = get_role('administrator');
141
+ // We need this role, no other chance
142
+ if ( empty($role) ) {
143
+ update_option( "flag_init_check", __('Sorry, Flash Album Gallery works only with a role called administrator','flag') );
144
+ return;
145
+ }
146
+
147
+ $role->add_cap('FlAG overview');
148
+ $role->add_cap('FlAG Use TinyMCE');
149
+ $role->add_cap('FlAG Upload images');
150
+ $role->add_cap('FlAG Import folder');
151
+ $role->add_cap('FlAG Manage gallery');
152
+ $role->add_cap('FlAG Manage others gallery');
153
+ $role->add_cap('FlAG Change skin');
154
+ $role->add_cap('FlAG Add skins');
155
+ $role->add_cap('FlAG Delete skins');
156
+ $role->add_cap('FlAG Change options');
157
+ $role->add_cap('FlAG Manage music');
158
+ $role->add_cap('FlAG Manage video');
159
+ $role->add_cap('FlAG Manage banners');
160
+ $role->add_cap('FlAG Facebook page');
161
+
162
+ }
163
+
164
+ /**
165
+ * Setup the default option array for the gallery
166
+ *
167
+ * @access internal
168
+ * @return void
169
+ */
170
+ function flag_default_options() {
171
+
172
+ global $blog_id, $flag;
173
+
174
+ $flag_options = flag_list_options();
175
+ // special overrides for WPMU
176
+ if (IS_WPMU) {
177
+ // get the site options
178
+ $flag_wpmu_options = get_site_option('flag_options');
179
+ // get the default value during installation
180
+ //if (!is_array($flag_wpmu_options)) {
181
+ //$flag_wpmu_options['galleryPath'] = 'wp-content/blogs.dir/%BLOG_ID%/files/';
182
+ update_site_option('flag_options', $flag_wpmu_options);
183
+ //}
184
+ //$flag_options['galleryPath'] = str_replace("%BLOG_ID%", $blog_id , $flag_wpmu_options['galleryPath']);
185
+ }
186
+
187
+ update_option('flag_options', $flag_options);
188
+
189
+ }
190
+
191
+ function flag_list_options() {
192
+ $flag_options['galleryPath'] = 'wp-content/flagallery/'; // set default path to the gallery
193
+ $flag_options['swfUpload'] = true; // activate the batch upload
194
+ $flag_options['deleteImg'] = true; // delete Images
195
+ $flag_options['deepLinks'] = true;
196
+ $flag_options['access_key'] = '';
197
+ $flag_options['license_key'] = '';
198
+ $flag_options['useMediaRSS'] = false; // activate the global Media RSS file
199
+
200
+ // Sort Settings
201
+ $flag_options['galSort'] = 'sortorder'; // Sort order
202
+ $flag_options['galSortDir'] = 'ASC'; // Sort direction
203
+
204
+ // Flash settings
205
+ $flag_options['skinsDirABS'] = str_replace("\\","/", WP_PLUGIN_DIR . '/flagallery-skins/' );
206
+ $flag_options['skinsDirURL'] = WP_PLUGIN_URL . '/flagallery-skins/';
207
+ $flag_options['flashSkin'] = 'default';
208
+ $flag_options['flashWidth'] = '100%';
209
+ $flag_options['flashHeight'] = '500';
210
+
211
+ // Image Settings
212
+ $flag_options['imgWidth'] = 800; // Image Width
213
+ $flag_options['imgHeight'] = 600; // Image height
214
+ $flag_options['imgQuality'] = 85; // Image Quality
215
+
216
+ // Thumbnail Settings
217
+ $flag_options['thumbWidth'] = 220; // Thumb Width
218
+ $flag_options['thumbHeight'] = 220; // Thumb height
219
+ $flag_options['thumbFix'] = true; // Fix the dimension
220
+ $flag_options['thumbQuality'] = 100; // Thumb Quality
221
+
222
+ // Flash default skin colors settings
223
+ $flag_options['flashBacktransparent'] = false;
224
+ $flag_options['flashBackcolor'] = '262626';
225
+ $flag_options['buttonsBG'] = '000000';
226
+ $flag_options['buttonsMouseOver'] = '7485c2';
227
+ $flag_options['buttonsMouseOut'] = '717171';
228
+ $flag_options['catButtonsMouseOver'] = '000000';
229
+ $flag_options['catButtonsMouseOut'] = '000000';
230
+ $flag_options['catButtonsTextMouseOver']= '7485c2';
231
+ $flag_options['catButtonsTextMouseOut'] = 'bcbcbc';
232
+ $flag_options['thumbMouseOver'] = '7485c2';
233
+ $flag_options['thumbMouseOut'] = '000000';
234
+ $flag_options['mainTitle'] = 'ffffff';
235
+ $flag_options['categoryTitle'] = '7485c2';
236
+ $flag_options['itemBG'] = 'eae6ef';
237
+ $flag_options['itemTitle'] = '7485c2';
238
+ $flag_options['itemDescription'] = 'e0e0e0';
239
+
240
+ // Alternative gallery colors
241
+ $flag_options['jAlterGal'] = true;
242
+ $flag_options['jAlterGalScript'] = 1; // If '0' - use FancyBox script
243
+ $flag_options['BarsBG'] = '292929';
244
+ $flag_options['CatBGColor'] = '292929';
245
+ $flag_options['CatBGColorOver'] = '737373';
246
+ $flag_options['CatColor'] = 'ffffff';
247
+ $flag_options['CatColorOver'] = 'ffffff';
248
+ $flag_options['ThumbBG'] = 'ffffff';
249
+ $flag_options['ThumbLoaderColor'] = '4a4a4a';
250
+ $flag_options['TitleColor'] = 'ff9900';
251
+ $flag_options['DescrColor'] = 'cfcfcf';
252
+
253
+ // Single player colors
254
+ $flag_options['videoBG'] = '000000';
255
+ $flag_options['vmColor1'] = 'ffffff';
256
+ $flag_options['vmColor2'] = '3283A7';
257
+ $flag_options['vmAutoplay'] = 'true';
258
+ $flag_options['vmWidth'] = '520';
259
+ $flag_options['vmHeight'] = '304';
260
+
261
+ $flag_options['mpBG'] = '4f4f4f';
262
+ $flag_options['mpColor1'] = 'ffffff';
263
+ $flag_options['mpColor2'] = '3283A7';
264
+ $flag_options['mpAutoplay'] = 'false';
265
+
266
+ $flag_options['advanced'] = false; // Advanced options
267
+
268
+ return $flag_options;
269
+ }
270
+
271
+ /**
272
+ * Deregister a capability from all classic roles
273
+ *
274
+ * @access internal
275
+ * @param string $capability name of the capability which should be deregister
276
+ * @return void
277
+ */
278
+ function flag_remove_capability($capability){
279
+ // this function remove the $capability only from the classic roles
280
+ $check_order = array("subscriber", "contributor", "author", "editor", "administrator");
281
+
282
+ foreach ($check_order as $role) {
283
+
284
+ $role = get_role($role);
285
+ $role->remove_cap($capability) ;
286
+ }
287
+
288
+ }
289
+
290
+ /**
291
+ * Uninstall all settings and tables
292
+ * Called via Setup and register_unstall hook
293
+ *
294
+ * @access internal
295
+ * @return void
296
+ */
297
+ function flag_uninstall() {
298
+ global $wpdb;
299
+
300
+ // first remove all tables
301
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}flag_pictures");
302
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}flag_gallery");
303
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}flag_comments");
304
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}flag_album");
305
+
306
+ // then remove all options
307
+ delete_option( 'flag_options' );
308
+ delete_option( 'flag_db_version' );
309
+ delete_option( 'flagVersion' );
310
+
311
+ // now remove the capability
312
+ flag_remove_capability("FlAG overview");
313
+ flag_remove_capability("FlAG Use TinyMCE");
314
+ flag_remove_capability("FlAG Upload images");
315
+ flag_remove_capability("FlAG Import folder");
316
+ flag_remove_capability("FlAG Manage gallery");
317
+ flag_remove_capability('FlAG Manage others gallery');
318
+ flag_remove_capability("FlAG Change skin");
319
+ flag_remove_capability('FlAG Add skins');
320
+ flag_remove_capability('FlAG Delete skins');
321
+ flag_remove_capability("FlAG Change options");
322
+ flag_remove_capability("FlAG Manage music");
323
+ flag_remove_capability("FlAG Manage video");
324
+ flag_remove_capability("FlAG Manage banners");
325
+ flag_remove_capability("FlAG Facebook page");
326
+ }
327
+
328
+
329
+
330
+ ?>
admin/flv_preview.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ preg_match('|^(.*?/)(wp-content)/|i', str_replace('\\', '/', __FILE__), $_m);
3
+ require_once( $_m[1] . 'wp-load.php');
4
+ // check for correct capability
5
+ if ( !is_user_logged_in() )
6
+ die('-1');
7
+
8
+ // check for correct FlAG capability
9
+ if ( !current_user_can('FlAG Manage video') )
10
+ die('-1'); ?>
11
+ <html>
12
+ <head>
13
+ <title>Preview Video</title>
14
+ <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?>admin/js/swfobject.js"></script>
15
+ </head>
16
+ <body style="margin: 0; padding: 0; background: #555555; overflow: hidden;">
17
+ <?php echo flagShowVmPlayer($_GET['vid'], $w='520', $h='304', $autoplay=true); ?>
18
+ </body>
19
+ </html>
admin/functions.php ADDED
@@ -0,0 +1,1316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
4
+
5
+ /**
6
+ * flagAdmin - Class for admin operation
7
+ */
8
+ class flagAdmin{
9
+
10
+ /**
11
+ * create a new gallery & folder
12
+ *
13
+ * @class flagAdmin
14
+ * @param string $gallerytitle
15
+ * @param string $defaultpath
16
+ * @param bool $output if the function should show an error messsage or not
17
+ * @return
18
+ */
19
+ function create_gallery($gallerytitle, $defaultpath, $output = true) {
20
+ global $wpdb, $user_ID;
21
+
22
+ // get the current user ID
23
+ get_currentuserinfo();
24
+
25
+ //cleanup pathname
26
+ $galleryname = sanitize_file_name( $gallerytitle );
27
+ $galleryname = apply_filters('flag_gallery_name', $galleryname);
28
+ $galleryname = preg_replace('/[^\w\._-]+/', '', $galleryname);
29
+ if(!$galleryname) $galleryname = date('y-m-j_h-i-s');
30
+
31
+ $flagpath = $defaultpath . $galleryname;
32
+ $flagRoot = WINABSPATH . $defaultpath;
33
+ $txt = '';
34
+
35
+ // No gallery name ?
36
+ if (empty($galleryname)) {
37
+ if ($output) flagGallery::show_error( __('No valid gallery name!', 'flag') );
38
+ return false;
39
+ }
40
+
41
+ // check for main folder
42
+ if ( !is_dir($flagRoot) ) {
43
+ if ( !wp_mkdir_p( $flagRoot ) ) {
44
+ $txt = __('Directory', 'flag').' <strong>' . $defaultpath . '</strong> '.__('didn\'t exist. Please create first the main gallery folder ', 'flag').'!<br />';
45
+ $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flag').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
46
+ if ($output) flagGallery::show_error($txt);
47
+ return false;
48
+ }
49
+ }
50
+
51
+ // check for permission settings, Safe mode limitations are not taken into account.
52
+ if ( !is_writeable( $flagRoot ) ) {
53
+ $txt = __('Directory', 'flag').' <strong>' . $defaultpath . '</strong> '.__('is not writeable !', 'flag').'<br />';
54
+ $txt .= __('Check this link, if you didn\'t know how to set the permission :', 'flag').' <a href="http://codex.wordpress.org/Changing_File_Permissions">http://codex.wordpress.org/Changing_File_Permissions</a> ';
55
+ if ($output) flagGallery::show_error($txt);
56
+ return false;
57
+ }
58
+
59
+ // 1. Create new gallery folder
60
+ if ( !is_dir(WINABSPATH . $flagpath) ) {
61
+ if ( !wp_mkdir_p (WINABSPATH . $flagpath) )
62
+ $txt = __('Unable to create directory ', 'flag').$flagpath.'!<br />';
63
+ }
64
+
65
+ // 2. Check folder permission
66
+ if ( !is_writeable(WINABSPATH . $flagpath ) )
67
+ $txt .= __('Directory', 'flag').' <strong>'.$flagpath.'</strong> '.__('is not writeable !', 'flag').'<br />';
68
+
69
+ // 3. Now create "thumbs" folder inside
70
+ if ( !is_dir(WINABSPATH . $flagpath . '/thumbs') ) {
71
+ if ( !wp_mkdir_p ( WINABSPATH . $flagpath . '/thumbs') )
72
+ $txt .= __('Unable to create directory ', 'flag').' <strong>' . $flagpath . '/thumbs !</strong>';
73
+ }
74
+
75
+ if (SAFE_MODE) {
76
+ $help = __('The server setting Safe-Mode is on !', 'flag');
77
+ $help .= '<br />'.__('If you have problems, please create directory', 'flag').' <strong>' . $flagpath . '</strong> ';
78
+ $help .= __('and the thumbnails directory', 'flag').' <strong>' . $flagpath . '/thumbs</strong> '.__('with permission 777 manually !', 'flag');
79
+ if ($output) flagGallery::show_message($help);
80
+ }
81
+
82
+ // show an error message
83
+ if ( !empty($txt) ) {
84
+ if (SAFE_MODE) {
85
+ // for safe_mode , better delete folder, both folder must be created manually
86
+ @rmdir(WINABSPATH . $flagpath . '/thumbs');
87
+ @rmdir(WINABSPATH . $flagpath);
88
+ }
89
+ if ($output) flagGallery::show_error($txt);
90
+ return false;
91
+ }
92
+
93
+ $result = $wpdb->get_var("SELECT name FROM $wpdb->flaggallery WHERE name = '$galleryname' ");
94
+
95
+ if ($result) {
96
+ if ($output) flagGallery::show_error( __ngettext( 'Gallery', 'Galleries', 1, 'flag' ) .' <strong>' . $galleryname . '</strong> '.__('already exists', 'flag'));
97
+ return false;
98
+ } else {
99
+ $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $flagpath, $gallerytitle , $user_ID) );
100
+ // and give me the new id
101
+ $gallery_id = (int) $wpdb->insert_id;
102
+ // here you can inject a custom function
103
+ do_action('flag_created_new_gallery', $gallery_id);
104
+
105
+ // return only the id if defined
106
+ if ($return_id)
107
+ return $gallery_id;
108
+
109
+ if ($result) {
110
+ $message = __('Gallery \'%1$s\' successfully created.<br/>You can show this gallery with the tag %2$s.<br/>','flag');
111
+ $message = sprintf($message, stripcslashes($gallerytitle), '[flagallery gid=' . $gallery_id . ' name="' . stripcslashes($gallerytitle) . '"]');
112
+ $message .= '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $gallery_id . '" >';
113
+ $message .= __('Edit gallery','flag');
114
+ $message .= '</a>';
115
+
116
+ if ($output) flagGallery::show_message($message);
117
+ }
118
+ return true;
119
+ }
120
+ }
121
+
122
+ /**
123
+ * flagAdmin::import_gallery()
124
+ * TODO: Check permission of existing thumb folder & images
125
+ *
126
+ * @class flagAdmin
127
+ * @param string $galleryfolder contains relative path
128
+ * @return
129
+ */
130
+ function import_gallery($galleryfolder) {
131
+
132
+ global $wpdb, $user_ID;
133
+
134
+ // get the current user ID
135
+ get_currentuserinfo();
136
+
137
+ $created_msg = '';
138
+
139
+ // remove trailing slash at the end, if somebody use it
140
+ $galleryfolder = rtrim($galleryfolder, '/');
141
+ $gallerypath = WINABSPATH . $galleryfolder;
142
+
143
+ if (!is_dir($gallerypath)) {
144
+ flagGallery::show_error(__('Directory', 'flag').' <strong>'.$gallerypath.'</strong> '.__('doesn&#96;t exist!', 'flag'));
145
+ return ;
146
+ }
147
+
148
+ // read list of images
149
+ $new_imageslist = flagAdmin::scandir($gallerypath);
150
+ if (empty($new_imageslist)) {
151
+ flagGallery::show_message(__('Directory', 'flag').' <strong>'.$gallerypath.'</strong> '.__('contains no pictures', 'flag'));
152
+ return;
153
+ }
154
+
155
+ // check & create thumbnail folder
156
+ if ( !flagGallery::get_thumbnail_folder($gallerypath) )
157
+ return;
158
+
159
+ // take folder name as gallery name
160
+ $galleryname = basename($galleryfolder);
161
+ $galleryname = apply_filters('flag_gallery_name', $galleryname);
162
+
163
+ // check for existing gallery folder
164
+ $gallery_id = $wpdb->get_var("SELECT gid FROM $wpdb->flaggallery WHERE path = '$galleryfolder' ");
165
+
166
+ if (!$gallery_id) {
167
+ $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flaggallery (name, path, title, author) VALUES (%s, %s, %s, %s)", $galleryname, $galleryfolder, $galleryname , $user_ID) );
168
+ if (!$result) {
169
+ flagGallery::show_error(__('Database error. Could not add gallery!','flag'));
170
+ return;
171
+ }
172
+ $created_msg = __ngettext( 'Gallery', 'Galleries', 1, 'flag' ) . ' <strong>' . $galleryname . '</strong> ' . __('successfully created!','flag') . '<br />';
173
+ $gallery_id = $wpdb->insert_id; // get index_id
174
+ }
175
+
176
+ // Look for existing image list
177
+ $old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->flagpictures WHERE galleryid = '$gallery_id' ");
178
+
179
+ // if no images are there, create empty array
180
+ if ($old_imageslist == NULL)
181
+ $old_imageslist = array();
182
+
183
+ // check difference
184
+ $new_images = array_diff($new_imageslist, $old_imageslist);
185
+
186
+ // all images must be valid files
187
+ foreach($new_images as $key => $picture) {
188
+ if (!@getimagesize($gallerypath . '/' . $picture) ) {
189
+ unset($new_images[$key]);
190
+ @unlink($gallerypath . '/' . $picture);
191
+ }
192
+ }
193
+
194
+ // add images to database
195
+ $image_ids = flagAdmin::add_Images($gallery_id, $new_images);
196
+
197
+ //add the preview image if needed
198
+ flagAdmin::set_gallery_preview ( $gallery_id );
199
+
200
+ // now create thumbnails
201
+ flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flag') );
202
+
203
+ //TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
204
+ flagGallery::show_message( $created_msg . count($image_ids) .__(' picture(s) successfully added','flag') );
205
+
206
+ return;
207
+
208
+ }
209
+
210
+ /**
211
+ * flagAdmin::import_video()
212
+ *
213
+ * @class flagAdmin
214
+ * @param string $folder contains relative path
215
+ * @return
216
+ */
217
+ function import_video($folder) {
218
+ global $wpdb, $user_ID;
219
+
220
+ $created_msg = '';
221
+ // remove trailing slash at the end, if somebody use it
222
+ $folder = rtrim($folder, '/');
223
+ $path = WINABSPATH . $folder;
224
+ if (!is_dir($path)) {
225
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('doesn&#96;t exist!', 'flag').'</p>';
226
+ return ;
227
+ }
228
+ // read list of files
229
+ $ext = array('flv');
230
+ $new_filelist = flagAdmin::scandir($path, $ext);
231
+ if (empty($new_filelist)) {
232
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('does not contain flv files', 'flag').'</p>';
233
+ return;
234
+ }
235
+ $i=0;
236
+ foreach($new_filelist as $key => $file) {
237
+ //$new_filelist[$key] = $path . '/' . $file;
238
+ $filename = $path . '/' . $file;
239
+ $id = flagAdmin::handle_import_file($filename);
240
+ if ( is_wp_error($id) ) {
241
+ $created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flag'), $file, $id->get_error_message() ) . '</p>';
242
+ } else {
243
+ $i++;
244
+ $created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flag'), $file) . '</p>';
245
+ }
246
+ }
247
+ $created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flag').'</p><div class="hidden">'.$created_msg.'</div>';
248
+ echo $created_msg;
249
+ }
250
+
251
+ /**
252
+ * flagAdmin::import_mp3()
253
+ *
254
+ * @class flagAdmin
255
+ * @param string $folder contains relative path
256
+ * @return
257
+ */
258
+ function import_mp3($folder) {
259
+ global $wpdb, $user_ID;
260
+
261
+ $created_msg = '';
262
+ // remove trailing slash at the end, if somebody use it
263
+ $folder = rtrim($folder, '/');
264
+ $path = WINABSPATH . $folder;
265
+ if (!is_dir($path)) {
266
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('doesn&#96;t exist!', 'flag').'</p>';
267
+ return ;
268
+ }
269
+ // read list of files
270
+ $ext = array('mp3');
271
+ $new_filelist = flagAdmin::scandir($path, $ext);
272
+ if (empty($new_filelist)) {
273
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('does not contain mp3 files', 'flag').'</p>';
274
+ return;
275
+ }
276
+ $i=0;
277
+ foreach($new_filelist as $key => $file) {
278
+ //$new_filelist[$key] = $path . '/' . $file;
279
+ $filename = $path . '/' . $file;
280
+ $id = flagAdmin::handle_import_file($filename);
281
+ if ( is_wp_error($id) ) {
282
+ $created_msg .= '<p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'flag'), $file, $id->get_error_message() ) . '</p>';
283
+ } else {
284
+ $i++;
285
+ $created_msg .= '<p>' . sprintf(__('<em>%s</em> has been added to Media library', 'flag'), $file) . '</p>';
286
+ }
287
+ }
288
+ $created_msg .= '<p class="message">'.$i.__(' file(s) successfully added','flag').'</p><div class="hidden">'.$created_msg.'</div>';
289
+ echo $created_msg;
290
+ }
291
+
292
+ /**
293
+ * flagAdmin::import_banner()
294
+ *
295
+ * @class flagAdmin
296
+ * @param string $folder contains relative path
297
+ * @return
298
+ */
299
+ function import_banner($folder) {
300
+ global $wpdb, $user_ID;
301
+
302
+ $created_msg = '';
303
+ // remove trailing slash at the end, if somebody use it
304
+ $folder = rtrim($folder, '/');
305
+ $path = WINABSPATH . $folder;
306
+ if (!is_dir($path)) {
307
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('doesn&#96;t exist!', 'flag').'</p>';
308
+ return ;
309
+ }
310
+ // read list of files
311
+ $new_filelist = flagAdmin::scandir($path);
312
+ if (empty($new_filelist)) {
313
+ echo '<p class="message">'.__('Directory', 'flag').' <strong>'.$path.'</strong> '.__('does not contain image files', 'flag').'</p>';
314
+ return;
315
+ }
316
+ $created_msg .= '<div class="message"><p>'.count($new_filelist).' '.__('image(s) in the folder','flag').':</p><div class="flag_crunching"><div class="flag_progress"><span class="flag_complete"></span><span class="txt">'.__('Crunching...','flag').'</span></div></div></div>';
317
+ echo $created_msg;
318
+ return $new_filelist;
319
+ }
320
+
321
+ //Handle an individual file import.
322
+ function handle_import_file($file, $post_id = 0) {
323
+ set_time_limit(120);
324
+ $time = current_time('mysql');
325
+ if ( $post = get_post($post_id) ) {
326
+ if ( substr( $post->post_date, 0, 4 ) > 0 )
327
+ $time = $post->post_date;
328
+ }
329
+
330
+ // A writable uploads dir will pass this test. Again, there's no point overriding this one.
331
+ if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
332
+ return new WP_Error($uploads['error']);
333
+
334
+ $wp_filetype = wp_check_filetype( $file, null );
335
+
336
+ extract( $wp_filetype );
337
+
338
+ if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
339
+ return new WP_Error('wrong_file_type', __( 'File type does not meet security guidelines. Try another.' ) ); //A WP-core string..
340
+
341
+ $match = preg_match('|^' . preg_quote(str_replace('\\', '/', $uploads['basedir'])) . '(.*)$|i', $file, $mat);
342
+ //Is the file allready in the uploads folder?
343
+ if( $match ) {
344
+
345
+ $filename = basename($file);
346
+ $new_file = $file;
347
+
348
+ $url = $uploads['baseurl'] . $mat[1];
349
+
350
+ $attachment = get_posts(array( 'post_type' => 'attachment', 'meta_key' => '_wp_attached_file', 'meta_value' => $uploads['subdir'] . '/' . $filename ));
351
+ if ( !empty($attachment) )
352
+ return $attachments[0]->ID;
353
+
354
+ //Ok, Its in the uploads folder, But NOT in WordPress's media library.
355
+ if ( preg_match("|(\d+)/(\d+)|", $mat[1], $datemat) ) //So lets set the date of the import to the date folder its in, IF its in a date folder.
356
+ $time = mktime(0, 0, 0, $datemat[2], 1, $datemat[1]);
357
+ else //Else, set the date based on the date of the files time.
358
+ $time = @filemtime($file);
359
+
360
+ if ( $time ) {
361
+ $post_date = date( 'Y-m-d H:i:s', $time);
362
+ $post_date_gmt = gmdate( 'Y-m-d H:i:s', $time);
363
+ }
364
+ } else {
365
+ $filename = wp_unique_filename( $uploads['path'], basename($file));
366
+
367
+ // copy the file to the uploads dir
368
+ $new_file = $uploads['path'] . '/' . $filename;
369
+ if ( false === @copy( $file, $new_file ) )
370
+ wp_die(sprintf( __('The selected file could not be copied to %s.', 'flag'), $uploads['path']));
371
+
372
+ // Set correct file permissions
373
+ $stat = stat( dirname( $new_file ));
374
+ $perms = $stat['mode'] & 0000666;
375
+ @ chmod( $new_file, $perms );
376
+ // Compute the URL
377
+ $url = $uploads['url'] . '/' . rawurlencode($filename);
378
+ }
379
+
380
+ // Compute the URL
381
+ //Apply upload filters
382
+ $return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
383
+ $new_file = $return['file'];
384
+ $url = $return['url'];
385
+ $type = $return['type'];
386
+
387
+ $title = preg_replace('!\.[^.]+$!', '', basename($file));
388
+ $content = '';
389
+
390
+ // use image exif/iptc data for title and caption defaults if possible
391
+ if ( $image_meta = @wp_read_image_metadata($new_file) ) {
392
+ if ( '' != trim($image_meta['title']) )
393
+ $title = trim($image_meta['title']);
394
+ if ( '' != trim($image_meta['caption']) )
395
+ $content = trim($image_meta['caption']);
396
+ }
397
+
398
+ if ( empty($post_date) )
399
+ $post_date = current_time('mysql');
400
+ if ( empty($post_date_gmt) )
401
+ $post_date_gmt = current_time('mysql', 1);
402
+
403
+ // Construct the attachment array
404
+ $attachment = array(
405
+ 'post_mime_type' => $type,
406
+ 'guid' => $url,
407
+ 'post_parent' => $post_id,
408
+ 'post_title' => $title,
409
+ 'post_name' => $title,
410
+ 'post_content' => $content,
411
+ 'post_date' => $post_date,
412
+ 'post_date_gmt' => $post_date_gmt
413
+ );
414
+
415
+ // Save the data
416
+ $id = wp_insert_attachment($attachment, $new_file, $post_id);
417
+ if ( !is_wp_error($id) ) {
418
+ $data = wp_generate_attachment_metadata( $id, $new_file );
419
+ wp_update_attachment_metadata( $id, $data );
420
+ if( !$match && isset($_POST['delete_files']) ) {
421
+ @unlink($file);
422
+ }
423
+ }
424
+
425
+ return $id;
426
+ }
427
+
428
+ /**
429
+ * flagAdmin::scandir()
430
+ *
431
+ * @class flagAdmin
432
+ * @param string $dirname
433
+ * @return array
434
+ */
435
+ function scandir($dirname = '.', $ext = array()) {
436
+ // thx to php.net :-)
437
+ if(empty($ext))
438
+ $ext = array('jpeg', 'jpg', 'png', 'gif');
439
+ $files = array();
440
+ if($handle = opendir($dirname)) {
441
+ while(false !== ($file = readdir($handle)))
442
+ for($i=0;$i<sizeof($ext);$i++)
443
+ if(stristr($file, '.' . $ext[$i]))
444
+ $files[] = utf8_encode($file);
445
+ closedir($handle);
446
+ }
447
+ sort($files);
448
+ return ($files);
449
+ }
450
+
451
+ /**
452
+ * flagAdmin::createThumbnail() - function to create or recreate a thumbnail
453
+ *
454
+ * @param object | int $image contain all information about the image or the id
455
+ * @return string result code
456
+ */
457
+ function create_thumbnail($image) {
458
+
459
+ global $flag;
460
+
461
+ if(! class_exists('flag_Thumbnail'))
462
+ require_once( flagGallery::graphic_library() );
463
+
464
+ if ( is_numeric($image) )
465
+ $image = flagdb::find_image( $image );
466
+
467
+ if ( !is_object($image) )
468
+ return __('Object didn\'t contain correct data','flag');
469
+
470
+ // check for existing thumbnail
471
+ if (file_exists($image->thumbPath))
472
+ if (!is_writable($image->thumbPath))
473
+ return $image->filename . __(' is not writeable ','flag');
474
+
475
+ $thumb = new flag_Thumbnail($image->imagePath, TRUE);
476
+
477
+ // skip if file is not there
478
+ if (!$thumb->error) {
479
+ if ($flag->options['thumbFix']) {
480
+ // check for portrait format
481
+ if ($thumb->currentDimensions['height'] > $thumb->currentDimensions['width']) {
482
+ // first resize to the wanted width
483
+ $thumb->resize($flag->options['thumbWidth'], 0);
484
+ // get optimal y startpos
485
+ $ypos = ($thumb->currentDimensions['height'] - $flag->options['thumbHeight']) / 2;
486
+ $thumb->crop(0, $ypos, $flag->options['thumbWidth'],$flag->options['thumbHeight']);
487
+ } else {
488
+ // first resize to the wanted height
489
+ $thumb->resize(0, $flag->options['thumbHeight']);
490
+ // get optimal x startpos
491
+ $xpos = ($thumb->currentDimensions['width'] - $flag->options['thumbWidth']) / 2;
492
+ $thumb->crop($xpos, 0, $flag->options['thumbWidth'],$flag->options['thumbHeight']);
493
+ }
494
+ //this create a thumbnail but keep ratio settings
495
+ } else {
496
+ $thumb->resize($flag->options['thumbWidth'],$flag->options['thumbHeight']);
497
+ }
498
+
499
+ // save the new thumbnail
500
+ $thumb->save($image->thumbPath, $flag->options['thumbQuality']);
501
+ flagAdmin::chmod ($image->thumbPath);
502
+
503
+ //read the new sizes
504
+ $new_size = @getimagesize ( $image->thumbPath );
505
+ $size['width'] = $new_size[0];
506
+ $size['height'] = $new_size[1];
507
+
508
+ // add them to the database
509
+ flagdb::update_image_meta($image->pid, array( 'thumbnail' => $size) );
510
+ }
511
+
512
+ $thumb->destruct();
513
+
514
+ if ( !empty($thumb->errmsg) )
515
+ return ' <strong>' . $image->filename . ' (Error : '.$thumb->errmsg .')</strong>';
516
+
517
+ // success
518
+ return '1';
519
+ }
520
+
521
+ /**
522
+ * flagAdmin::resize_image() - create a new image, based on the height /width
523
+ *
524
+ * @class flagAdmin
525
+ * @param object | int $image contain all information about the image or the id
526
+ * @param integer $width optional
527
+ * @param integer $height optional
528
+ * @return string result code
529
+ */
530
+ function resize_image($image, $width = 0, $height = 0) {
531
+
532
+ global $flag;
533
+
534
+ if(! class_exists('flag_Thumbnail'))
535
+ require_once( flagGallery::graphic_library() );
536
+
537
+ if ( is_numeric($image) )
538
+ $image = flagdb::find_image( $image );
539
+
540
+ if ( !is_object($image) )
541
+ return __('Object didn\'t contain correct data','flag');
542
+
543
+ // before we start we import the meta data to database (required for uploads before V0.40)
544
+ flagAdmin::maybe_import_meta( $image->pid );
545
+
546
+ // if no parameter is set, take global settings
547
+ $width = ($width == 0) ? $flag->options['imgWidth'] : $width;
548
+ $height = ($height == 0) ? $flag->options['imgHeight'] : $height;
549
+
550
+ if (!is_writable($image->imagePath))
551
+ return ' <strong>' . $image->filename . __(' is not writeable','flag') . '</strong>';
552
+
553
+ $file = new flag_Thumbnail($image->imagePath, TRUE);
554
+
555
+ // skip if file is not there
556
+ if (!$file->error) {
557
+ $file->resize($width, $height, 4);
558
+ $file->save($image->imagePath, $flag->options['imgQuality']);
559
+ // read the new sizes
560
+ $size = @getimagesize ( $image->imagePath );
561
+ // add them to the database
562
+ flagdb::update_image_meta($image->pid, array( 'width' => $size[0], 'height' => $size[1] ) );
563
+ $file->destruct();
564
+ } else {
565
+ $file->destruct();
566
+ return ' <strong>' . $image->filename . ' (Error : ' . $file->errmsg . ')</strong>';
567
+ }
568
+
569
+ return '1';
570
+ }
571
+
572
+ /**
573
+ * Add images to database
574
+ *
575
+ * @class flagAdmin
576
+ * @param int $galleryID
577
+ * @param array $imageslist
578
+ * @return array $image_ids Id's which are sucessful added
579
+ */
580
+ function add_Images($galleryID, $imageslist, $name2alt = false) {
581
+ global $wpdb;
582
+
583
+ $alttext = '';
584
+ $image_ids = array();
585
+
586
+ if ( is_array($imageslist) ) {
587
+ foreach($imageslist as $picture) {
588
+ if($name2alt) {
589
+ // strip off the extension of the filename
590
+ $path_parts = pathinfo( $picture );
591
+ $alttext = ( !isset($path_parts['filename']) ) ? substr($path_parts['basename'], 0,strpos($path_parts['basename'], '.')) : $path_parts['filename'];
592
+ }
593
+ // save it to the database
594
+ $result = $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->flagpictures (galleryid, filename, alttext, exclude) VALUES (%s, %s, %s, 0)", $galleryID, $picture, $alttext) );
595
+ // and give me the new id
596
+ $pic_id = (int) $wpdb->insert_id;
597
+ if ($result)
598
+ $image_ids[] = $pic_id;
599
+
600
+ // add the metadata
601
+ flagAdmin::import_MetaData($pic_id);
602
+
603
+ // action hook for post process after the image is added to the database
604
+ $image = array( 'id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
605
+ do_action('flag_added_new_image', $image);
606
+
607
+ }
608
+ } // is_array
609
+
610
+ return $image_ids;
611
+
612
+ }
613
+
614
+ /**
615
+ * Import some metadata into the database (if avialable)
616
+ *
617
+ * @class flagAdmin
618
+ * @param array|int $imagesIds
619
+ * @return bool
620
+ */
621
+ function import_MetaData($imagesIds) {
622
+
623
+ global $wpdb;
624
+
625
+ require_once(FLAG_ABSPATH . 'lib/image.php');
626
+
627
+ if (!is_array($imagesIds))
628
+ $imagesIds = array($imagesIds);
629
+
630
+ foreach($imagesIds as $imageID) {
631
+ $image = flagdb::find_image($imageID);
632
+ if (!$image->error) {
633
+
634
+ $meta = flagAdmin::get_MetaData($image->pid);
635
+
636
+ // get the title
637
+ $alttext = empty( $meta['title'] ) ? $image->alttext : $meta['title'];
638
+ // get the caption / description field
639
+ $description = empty( $meta['caption'] ) ? $image->description : $meta['caption'];
640
+ // get the file date/time from exif
641
+ $timestamp = $meta['timestamp'];
642
+ // update database
643
+ $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", attribute_escape($alttext), attribute_escape($description), $timestamp, $image->pid) );
644
+ if ($result === false)
645
+ return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
646
+
647
+ //this flag will inform us the import is already one time performed
648
+ $meta['common']['saved'] = true;
649
+ $result = flagdb::update_image_meta($image->pid, $meta['common']);
650
+
651
+ if ($result === false)
652
+ return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update meta data)', 'flag') . '</strong>';
653
+ } else
654
+ return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flag') . '</strong>';// error check
655
+ }
656
+
657
+ return '1';
658
+
659
+ }
660
+
661
+ /**
662
+ * Copy some metadata into the image description (if avialable)
663
+ *
664
+ * @class flagAdmin
665
+ * @param array|int $imagesIds
666
+ * @return bool
667
+ */
668
+ function copy_MetaData($imagesIds) {
669
+
670
+ global $wpdb;
671
+
672
+ require_once(FLAG_ABSPATH . 'lib/meta.php');
673
+ require_once(FLAG_ABSPATH . 'lib/image.php');
674
+
675
+ if (!is_array($imagesIds))
676
+ $imagesIds = array($imagesIds);
677
+
678
+ foreach($imagesIds as $imageID) {
679
+
680
+ $image = flagdb::find_image($imageID);
681
+ if (!$image->error) {
682
+
683
+ require_once(FLAG_ABSPATH . 'admin/grab_meta.php');
684
+
685
+ // get the title
686
+ $alttext = empty( $alttext ) ? $image->alttext : $meta['title'];
687
+ if($alttext) $alttext = '<font size="16"><b>'.$alttext."</b></font>\n";
688
+ // get the caption / description field
689
+ $description = empty($description ) ? $image->description : $meta['caption'];
690
+ if($description) $description = $description."<br>\n";
691
+ // get the file date/time from exif
692
+ $makedescription = $alttext.$description.$makedescription;
693
+ // update database
694
+ $result = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->flagpictures SET alttext = %s, description = %s, imagedate = %s WHERE pid = %d", '', attribute_escape($makedescription), $timestamp, $image->pid) );
695
+ if ($result === false)
696
+ return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not update data base)', 'flag') . '</strong>';
697
+
698
+ } else
699
+ return ' <strong>' . $image->filename . ' ' . __('(Error : Couldn\'t not find image)', 'flag') . '</strong>';// error check
700
+ }
701
+
702
+ return '1';
703
+
704
+ }
705
+
706
+ /**
707
+ * flagAdmin::get_MetaData()
708
+ *
709
+ * @class flagAdmin
710
+ * @require Meta class
711
+ * @param string $picPath must be Gallery absPath + filename
712
+ * @return array metadata
713
+ */
714
+ function get_MetaData($id) {
715
+
716
+ require_once(FLAG_ABSPATH . 'lib/meta.php');
717
+
718
+ $meta = array();
719
+
720
+ $pdata = new flagMeta( $id );
721
+
722
+ $meta['title'] = trim ( $pdata->get_META('title') );
723
+ $meta['caption'] = trim ( $pdata->get_META('caption') );
724
+ $meta['keywords'] = trim ( $pdata->get_META('keywords') );
725
+ $meta['timestamp'] = $pdata->get_date_time();
726
+ // this contain other useful meta information
727
+ $meta['common'] = $pdata->get_common_meta();
728
+
729
+ return $meta;
730
+
731
+ }
732
+
733
+ /**
734
+ * Maybe import some meta data to the database. The functions checks the flag 'saved'
735
+ * and if based on compat reason (pre V0.40) we save then some meta datas to the database
736
+ *
737
+ * @param int $id
738
+ * @return result
739
+ */
740
+ function maybe_import_meta( $id ) {
741
+
742
+ require_once(FLAG_ABSPATH . 'lib/meta.php');
743
+
744
+ $image = new flagMeta( $id );
745
+
746
+ if ( $image->meta_data['saved'] != true ) {
747
+ //this flag will inform us the import is already one time performed
748
+ $meta['saved'] = true;
749
+ $result = flagdb::update_image_meta($image->pid, $meta['common']);
750
+ } else
751
+ return false;
752
+
753
+ return $result;
754
+
755
+ }
756
+
757
+ /**
758
+ * flagAdmin::getOnlyImages()
759
+ *
760
+ * @class flagAdmin
761
+ * @param mixed $p_event
762
+ * @param mixed $p_header
763
+ * @return bool
764
+ */
765
+ function getOnlyImages($p_event, $p_header) {
766
+
767
+ $info = pathinfo($p_header['filename']);
768
+ // check for extension
769
+ $ext = array('jpeg', 'jpg', 'png', 'gif');
770
+ if ( in_array( strtolower($info['extension']), $ext) ) {
771
+ // For MAC skip the ".image" files
772
+ if ($info['basename']{0} == '.' )
773
+ return 0;
774
+ else
775
+ return 1;
776
+ }
777
+ // ----- all other files are skipped
778
+ else {
779
+ return 0;
780
+ }
781
+ }
782
+
783
+ /**
784
+ * Function for uploading of images via the upload form
785
+ *
786
+ * @class flagAdmin
787
+ * @return void
788
+ */
789
+ function upload_images() {
790
+
791
+ global $wpdb;
792
+
793
+ // WPMU action
794
+ if (flagAdmin::check_quota())
795
+ return;
796
+
797
+ // Images must be an array
798
+ $imageslist = array();
799
+
800
+ // get selected gallery
801
+ $galleryID = (int) $_POST['galleryselect'];
802
+
803
+ if ($galleryID == 0) {
804
+ flagGallery::show_error(__('No gallery selected !','flag'));
805
+ return;
806
+ }
807
+
808
+ // get the path to the gallery
809
+ $gallery = flagdb::find_gallery($galleryID);
810
+
811
+ if ( empty($gallery->path) ){
812
+ flagGallery::show_error(__('Failure in database, no gallery path set !','flag'));
813
+ return;
814
+ }
815
+
816
+ // read list of images
817
+ $dirlist = flagAdmin::scandir(WINABSPATH.$gallerypath);
818
+
819
+ $imagefiles = $_FILES['imagefiles'];
820
+
821
+ if (is_array($imagefiles)) {
822
+ foreach ($imagefiles['name'] as $key => $value) {
823
+
824
+ // look only for uploded files
825
+ if ($imagefiles['error'][$key] == 0) {
826
+
827
+ $temp_file = $imagefiles['tmp_name'][$key];
828
+
829
+ //clean filename and extract extension
830
+ $filepart = flagGallery::fileinfo( $imagefiles['name'][$key] );
831
+ $filename = $filepart['basename'];
832
+
833
+ // check for allowed extension and if it's an image file
834
+ $ext = array('jpg', 'png', 'gif');
835
+ if ( !in_array($filepart['extension'], $ext) || !@getimagesize($temp_file) ){
836
+ flagGallery::show_error('<strong>' . $imagefiles['name'][$key] . ' </strong>' . __('is no valid image file!','flag'));
837
+ continue;
838
+ }
839
+
840
+ // check if this filename already exist in the folder
841
+ $i = 0;
842
+ while ( in_array( $filename, $dirlist ) ) {
843
+ $filename = $filepart['filename'] . '_' . $i++ . '.' .$filepart['extension'];
844
+ }
845
+
846
+ $dest_file = $gallery->abspath . '/' . $filename;
847
+
848
+ //check for folder permission
849
+ if ( !is_writeable($gallery->abspath) ) {
850
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flag'), $gallery->abspath);
851
+ flagGallery::show_error($message);
852
+ return;
853
+ }
854
+
855
+ // save temp file to gallery
856
+ if ( !@move_uploaded_file($temp_file, $dest_file) ){
857
+ flagGallery::show_error(__('Error, the file could not moved to : ','flag') . $dest_file);
858
+ flagAdmin::check_safemode( $gallery->abspath );
859
+ continue;
860
+ }
861
+ if ( !flagAdmin::chmod($dest_file) ) {
862
+ flagGallery::show_error(__('Error, the file permissions could not set','flag'));
863
+ continue;
864
+ }
865
+
866
+ // add to imagelist & dirlist
867
+ $imageslist[] = $filename;
868
+ $dirlist[] = $filename;
869
+ }
870
+ }
871
+ }
872
+
873
+ if (count($imageslist) > 0) {
874
+
875
+ // add images to database
876
+ $image_ids = flagAdmin::add_Images($galleryID, $imageslist);
877
+
878
+ //create thumbnails
879
+ flagAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','flag') );
880
+ //add the preview image if needed
881
+ flagAdmin::set_gallery_preview ( $galleryID );
882
+
883
+ flagGallery::show_message( count($image_ids) . __(' Image(s) successfully added','flag'));
884
+ }
885
+
886
+ return;
887
+
888
+ } // end function
889
+
890
+ /**
891
+ * Upload function will be called via the Flash uploader
892
+ *
893
+ * @class flagAdmin
894
+ * @param integer $galleryID
895
+ * @return string $result
896
+ */
897
+ function swfupload_image($galleryID = 0) {
898
+
899
+ global $wpdb;
900
+
901
+ if ($galleryID == 0) {
902
+ @unlink($temp_file);
903
+ return __('No gallery selected!','flag');;
904
+ }
905
+
906
+ // WPMU action
907
+ if (flagAdmin::check_quota())
908
+ return '0';
909
+
910
+ // Check the upload
911
+ if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] === UPLOAD_ERR_OK)
912
+ flagAdmin::file_upload_error_message($_FILES['Filedata']['error']);
913
+
914
+ // get the filename and extension
915
+ $temp_file = $_FILES["Filedata"]['tmp_name'];
916
+
917
+ $filepart = flagGallery::fileinfo( $_FILES['Filedata']['name'] );
918
+ $filename = $filepart['basename'];
919
+
920
+ // check for allowed extension
921
+ $ext = array('jpeg', 'jpg', 'png', 'gif');
922
+ if (!in_array($filepart['extension'], $ext))
923
+ return $_FILES[$key]['name'] . __('is no valid image file!','flag');
924
+
925
+ // get the path to the gallery
926
+ $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->flaggallery WHERE gid = '$galleryID' ");
927
+ if (!$gallerypath){
928
+ @unlink($temp_file);
929
+ return __('Failure in database, no gallery path set !','flag');
930
+ }
931
+
932
+ // read list of images
933
+ $imageslist = flagAdmin::scandir( WINABSPATH.$gallerypath );
934
+
935
+ // check if this filename already exist
936
+ $i = 0;
937
+ while (in_array($filename,$imageslist)) {
938
+ $filename = sanitize_title($filepart['filename']) . '_' . $i++ . '.' . $filepart['extension'];
939
+ }
940
+
941
+ $dest_file = WINABSPATH . $gallerypath . '/' . $filename;
942
+
943
+ // save temp file to gallery
944
+ if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
945
+ flagAdmin::check_safemode(WINABSPATH.$gallerypath);
946
+ return __('Error, the file could not moved to : ','flag').$dest_file;
947
+ }
948
+
949
+ if ( !flagAdmin::chmod($dest_file) )
950
+ return __('Error, the file permissions could not set','flag');
951
+
952
+ return '0';
953
+ }
954
+
955
+ /**
956
+ * File upload error message
957
+ *
958
+ * @class flagAdmin
959
+ * @return string $result
960
+ */
961
+ function file_upload_error_message($error_code) {
962
+ switch ($error_code) {
963
+ case UPLOAD_ERR_INI_SIZE:
964
+ return __('The uploaded file exceeds the upload_max_filesize directive in php.ini','flag');
965
+ case UPLOAD_ERR_FORM_SIZE:
966
+ return __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form','flag');
967
+ case UPLOAD_ERR_PARTIAL:
968
+ return __('The uploaded file was only partially uploaded','flag');
969
+ case UPLOAD_ERR_NO_FILE:
970
+ return __('No file was uploaded','flag');
971
+ case UPLOAD_ERR_NO_TMP_DIR:
972
+ return __('Missing a temporary folder','flag');
973
+ case UPLOAD_ERR_CANT_WRITE:
974
+ return __('Failed to write file to disk','flag');
975
+ case UPLOAD_ERR_EXTENSION:
976
+ return __('File upload stopped by extension','flag');
977
+ default:
978
+ return __('Unknown upload error','flag');
979
+ }
980
+ }
981
+
982
+ /**
983
+ * Check the Quota under WPMU. Only needed for this case
984
+ *
985
+ * @class flagAdmin
986
+ * @return bool $result
987
+ */
988
+ function check_quota() {
989
+
990
+ if ( (IS_WPMU) && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck'))
991
+ if( $error = upload_is_user_over_quota( false ) ) {
992
+ flagGallery::show_error( __( 'Sorry, you have used your space allocation. Please delete some files to upload more files.','flag' ) );
993
+ return true;
994
+ }
995
+ return false;
996
+ }
997
+
998
+ /**
999
+ * Set correct file permissions (taken from wp core)
1000
+ *
1001
+ * @class flagAdmin
1002
+ * @param string $filename
1003
+ * @return bool $result
1004
+ */
1005
+ function chmod($filename = '') {
1006
+
1007
+ $stat = @ stat(dirname($filename));
1008
+ $perms = $stat['mode'] & 0007777;
1009
+ $perms = $perms & 0000666;
1010
+ if ( @chmod($filename, $perms) )
1011
+ return true;
1012
+
1013
+ return false;
1014
+ }
1015
+
1016
+ /**
1017
+ * Check UID in folder and Script
1018
+ * Read http://www.php.net/manual/en/features.safe-mode.php to understand safe_mode
1019
+ *
1020
+ * @class flagAdmin
1021
+ * @param string $foldername
1022
+ * @return bool $result
1023
+ */
1024
+ function check_safemode($foldername) {
1025
+
1026
+ if ( SAFE_MODE ) {
1027
+
1028
+ $script_uid = ( ini_get('safe_mode_gid') ) ? getmygid() : getmyuid();
1029
+ $folder_uid = fileowner($foldername);
1030
+
1031
+ if ($script_uid != $folder_uid) {
1032
+ $message = sprintf(__('SAFE MODE Restriction in effect! You need to create the folder <strong>%s</strong> manually','flag'), $foldername);
1033
+ $message .= '<br />' . sprintf(__('When safe_mode is on, PHP checks to see if the owner (%s) of the current script matches the owner (%s) of the file to be operated on by a file function or its directory','flag'), $script_uid, $folder_uid );
1034
+ flagGallery::show_error($message);
1035
+ return false;
1036
+ }
1037
+ }
1038
+
1039
+ return true;
1040
+ }
1041
+
1042
+ /**
1043
+ * Capability check. Check is the ID fit's to the user_ID
1044
+ *
1045
+ * @class flagAdmin
1046
+ * @param int $check_ID is the user_id
1047
+ * @return bool $result
1048
+ */
1049
+ function can_manage_this_gallery($check_ID) {
1050
+
1051
+ global $user_ID, $wp_roles;
1052
+
1053
+ if ( !current_user_can('FlAG Manage others gallery') ) {
1054
+ // get the current user ID
1055
+ get_currentuserinfo();
1056
+
1057
+ if ( $user_ID != $check_ID)
1058
+ return false;
1059
+ }
1060
+ return true;
1061
+ }
1062
+
1063
+ /**
1064
+ * Move images from one folder to another
1065
+ *
1066
+ * @param array|int $pic_ids ID's of the images
1067
+ * @param int $dest_gid destination gallery
1068
+ * @return void
1069
+ */
1070
+ function move_images($pic_ids, $dest_gid) {
1071
+
1072
+ $errors = '';
1073
+ $count = 0;
1074
+
1075
+ if (!is_array($pic_ids))
1076
+ $pic_ids = array($pic_ids);
1077
+
1078
+ // Get destination gallery
1079
+ $destination = flagdb::find_gallery( $dest_gid );
1080
+ $dest_abspath = WINABSPATH . $destination->path;
1081
+
1082
+ if ( $destination == null ) {
1083
+ flagGallery::show_error(__('The destination gallery does not exist','flag'));
1084
+ return;
1085
+ }
1086
+
1087
+ // Check for folder permission
1088
+ if ( !is_writeable( $dest_abspath ) ) {
1089
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flag'), $dest_abspath );
1090
+ flagGallery::show_error($message);
1091
+ return;
1092
+ }
1093
+
1094
+ // Get pictures
1095
+ $images = flagdb::find_images_in_list($pic_ids);
1096
+
1097
+ foreach ($images as $image) {
1098
+
1099
+ $i = 0;
1100
+ $tmp_prefix = '';
1101
+
1102
+ $destination_file_name = $image->filename;
1103
+ // check if the filename already exist, then we add a copy_ prefix
1104
+ while (file_exists( $dest_abspath . '/' . $destination_file_name)) {
1105
+ $tmp_prefix = 'copy_' . ($i++) . '_';
1106
+ $destination_file_name = $tmp_prefix . $image->filename;
1107
+ }
1108
+
1109
+ $destination_path = $dest_abspath . '/' . $destination_file_name;
1110
+ $destination_thumbnail = $dest_abspath . '/thumbs/thumbs_' . $destination_file_name;
1111
+
1112
+ // Move files
1113
+ if ( !@rename($image->imagePath, $destination_path) ) {
1114
+ $errors .= sprintf(__('Failed to move image %1$s to %2$s','flag'),
1115
+ '<strong>' . $image->filename . '</strong>', $destination_path) . '<br />';
1116
+ continue;
1117
+ }
1118
+
1119
+ // Move the thumbnail, if possible
1120
+ !@rename($image->thumbPath, $destination_thumbnail);
1121
+
1122
+ // Change the gallery id in the database , maybe the filename
1123
+ if ( flagdb::update_image($image->pid, $dest_gid, $destination_file_name) )
1124
+ $count++;
1125
+
1126
+ }
1127
+
1128
+ if ( $errors != '' )
1129
+ flagGallery::show_error($errors);
1130
+
1131
+ $link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>';
1132
+ $messages = sprintf(__('Moved %1$s picture(s) to gallery : %2$s .','flag'), $count, $link);
1133
+ flagGallery::show_message($messages);
1134
+
1135
+ return;
1136
+ }
1137
+
1138
+ /**
1139
+ * Copy images to another gallery
1140
+ *
1141
+ * @class flagAdmin
1142
+ * @param array|int $pic_ids ID's of the images
1143
+ * @param int $dest_gid destination gallery
1144
+ * @return void
1145
+ */
1146
+ function copy_images($pic_ids, $dest_gid) {
1147
+
1148
+ $errors = $messages = '';
1149
+
1150
+ if (!is_array($pic_ids))
1151
+ $pic_ids = array($pic_ids);
1152
+
1153
+ // Get destination gallery
1154
+ $destination = flagdb::find_gallery( $dest_gid );
1155
+ if ( $destination == null ) {
1156
+ flagGallery::show_error(__('The destination gallery does not exist','flag'));
1157
+ return;
1158
+ }
1159
+
1160
+ // Check for folder permission
1161
+ if (!is_writeable(WINABSPATH.$destination->path)) {
1162
+ $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flag'), WINABSPATH.$destination->path);
1163
+ flagGallery::show_error($message);
1164
+ return;
1165
+ }
1166
+
1167
+ // Get pictures
1168
+ $images = flagdb::find_images_in_list($pic_ids);
1169
+ $destination_path = WINABSPATH . $destination->path;
1170
+
1171
+ foreach ($images as $image) {
1172
+ // WPMU action
1173
+ if ( flagAdmin::check_quota() )
1174
+ return;
1175
+
1176
+ $i = 0;
1177
+ $tmp_prefix = '';
1178
+ $destination_file_name = $image->filename;
1179
+ while (file_exists($destination_path . '/' . $destination_file_name)) {
1180
+ $tmp_prefix = 'copy_' . ($i++) . '_';
1181
+ $destination_file_name = $tmp_prefix . $image->filename;
1182
+ }
1183
+
1184
+ $destination_file_path = $destination_path . '/' . $destination_file_name;
1185
+ $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name;
1186
+
1187
+ // Copy files
1188
+ if ( !@copy($image->imagePath, $destination_file_path) ) {
1189
+ $errors .= sprintf(__('Failed to copy image %1$s to %2$s','flag'),
1190
+ $image->filename, $destination_file_path) . '<br />';
1191
+ continue;
1192
+ }
1193
+
1194
+ // Copy the thumbnail if possible
1195
+ !@copy($image->thumbPath, $destination_thumb_file_path);
1196
+
1197
+ // Create new database entry for the image
1198
+ $new_pid = flagdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude);
1199
+
1200
+ if (!isset($new_pid)) {
1201
+ $errors .= sprintf(__('Failed to copy database row for picture %s','flag'), $image->pid) . '<br />';
1202
+ continue;
1203
+ }
1204
+
1205
+ if ( $tmp_prefix != '' ) {
1206
+ $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) &raquo; The file already existed in the destination gallery.','flag'),
1207
+ $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
1208
+ } else {
1209
+ $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)','flag'),
1210
+ $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />';
1211
+ }
1212
+
1213
+ }
1214
+
1215
+ // Finish by showing errors or success
1216
+ if ( $errors == '' ) {
1217
+ $link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>';
1218
+ $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .','flag'), count($images), $link);
1219
+ }
1220
+
1221
+ if ( $messages != '' )
1222
+ flagGallery::show_message($messages);
1223
+
1224
+ if ( $errors != '' )
1225
+ flagGallery::show_error($errors);
1226
+
1227
+ return;
1228
+ }
1229
+
1230
+ /**
1231
+ * Initate the Ajax operation
1232
+ *
1233
+ * @class flagAdmin
1234
+ * @param string $operation name of the function which should be executed
1235
+ * @param array $image_array
1236
+ * @param string $title name of the operation
1237
+ * @return string the javascript output
1238
+ */
1239
+ function do_ajax_operation( $operation, $image_array, $title = '' ) {
1240
+
1241
+ if ( !is_array($image_array) || empty($image_array) )
1242
+ return;
1243
+
1244
+ $js_array = implode('","', $image_array);
1245
+
1246
+ // send out some JavaScript, which initate the ajax operation
1247
+ ?>
1248
+ <script type="text/javascript">
1249
+
1250
+ Images = new Array("<?php echo $js_array; ?>");
1251
+
1252
+ flagAjaxOptions = {
1253
+ operation: "<?php echo $operation; ?>",
1254
+ ids: Images,
1255
+ header: "<?php echo $title; ?>",
1256
+ maxStep: Images.length
1257
+ };
1258
+
1259
+ jQuery(document).ready( function(){
1260
+ flagProgressBar.init( flagAjaxOptions );
1261
+ flagAjax.init( flagAjaxOptions );
1262
+ } );
1263
+ </script>
1264
+
1265
+ <div id="progressbar_container" class="wrap"></div>
1266
+
1267
+ <?php
1268
+ }
1269
+
1270
+ /**
1271
+ * flagAdmin::set_gallery_preview() - define a preview pic after the first upload, can be changed in the gallery settings
1272
+ *
1273
+ * @class flagAdmin
1274
+ * @param int $galleryID
1275
+ * @return void
1276
+ */
1277
+ function set_gallery_preview( $galleryID ) {
1278
+
1279
+ global $wpdb;
1280
+
1281
+ $gallery = flagdb::find_gallery( $galleryID );
1282
+
1283
+ // in the case no preview image is setup, we do this now
1284
+ if ($gallery->previewpic == 0) {
1285
+ $firstImage = $wpdb->get_var("SELECT pid FROM $wpdb->flagpictures WHERE exclude != 1 AND galleryid = '$galleryID' ORDER by pid DESC limit 0,1");
1286
+ if ($firstImage) {
1287
+ $wpdb->query("UPDATE $wpdb->flaggallery SET previewpic = '$firstImage' WHERE gid = '$galleryID'");
1288
+ wp_cache_delete($galleryID, 'flag_gallery');
1289
+ }
1290
+ }
1291
+
1292
+ return;
1293
+ }
1294
+
1295
+ /**
1296
+ * Return a JSON coded array of Image ids for a requested gallery
1297
+ *
1298
+ * @param int $galleryID
1299
+ * @return arry (JSON)
1300
+ */
1301
+ function get_image_ids( $galleryID ) {
1302
+
1303
+ if ( !function_exists('json_encode') )
1304
+ return(-2);
1305
+
1306
+ $gallery = flagdb::get_ids_from_gallery($galleryID, 'pid', 'ASC', false);
1307
+
1308
+ header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true);
1309
+ $output = json_encode($gallery);
1310
+
1311
+ return $output;
1312
+ }
1313
+
1314
+ } // END class flagAdmin
1315
+
1316
+ ?>
admin/get_skin.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Parse the skin contents to retrieve skin's metadata.
5
+ *
6
+ * <code>
7
+ * /*
8
+ * Skin Name: Name of Skin
9
+ * Skin URI: Link to skin information
10
+ * Description: Skin Description
11
+ * Author: Skin author's name
12
+ * Author URI: Link to the author's web site
13
+ * Version: Version of Skin
14
+ * * / # Remove the space to close comment
15
+ * </code>
16
+ *
17
+ * Skin data returned array contains the following:
18
+ * 'Name' - Name of the skin, must be unique.
19
+ * 'Title' - Title of the skin and the link to the skin's web site.
20
+ * 'Description' - Description of what the skin does and/or notes
21
+ * from the author.
22
+ * 'Author' - The author's name
23
+ * 'AuthorURI' - The authors web site address.
24
+ * 'Version' - The skin version number.
25
+ * 'SkinURI' - Skin web site address.
26
+ *
27
+ */
28
+
29
+ function get_skin_data( $skin_file, $type='' ) {
30
+ // We don't need to write to the file, so just open for reading.
31
+ $fp = fopen($skin_file, 'r');
32
+
33
+ // Pull only the first 8kiB of the file in.
34
+ $skin_data = fread( $fp, 8192 );
35
+
36
+ // PHP will close file handle, but we are good citizens.
37
+ fclose($fp);
38
+
39
+ preg_match( '|^'.$type.'Skin Name:(.*)$|mi', $skin_data, $name );
40
+ if($name[1]) {
41
+ preg_match( '|Skin URI:(.*)$|mi', $skin_data, $uri );
42
+ preg_match( '|uid:(.*)|i', $skin_data, $uid );
43
+ preg_match( '|Version:(.*)|i', $skin_data, $version );
44
+ preg_match( '|Description:(.*)$|mi', $skin_data, $description );
45
+ preg_match( '|Author:(.*)$|mi', $skin_data, $author_name );
46
+ preg_match( '|Author URI:(.*)$|mi', $skin_data, $author_uri );
47
+
48
+ foreach ( array( 'name', 'uri', 'version', 'uid', 'description', 'author_name', 'author_uri' ) as $field ) {
49
+ if ( !empty( ${$field} ) )
50
+ ${$field} = trim(${$field}[1]);
51
+ else
52
+ ${$field} = '';
53
+ }
54
+
55
+ $skin_data = array(
56
+ 'Name' => $name, 'Title' => $name, 'SkinURI' => $uri, 'Description' => $description,
57
+ 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 'uid' => $uid
58
+ );
59
+ return $skin_data;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Gets the basename of a skin.
65
+ *
66
+ * This method extracts the name of a skin from its filename.
67
+ *
68
+ */
69
+ function skin_basename($file) {
70
+ $flag_options = get_option('flag_options');
71
+ $file = str_replace('\\','/',$file); // sanitize for Win32 installs
72
+ $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
73
+ $skin_dir = str_replace('\\','/',$flag_options['skinsDirABS']); // sanitize for Win32 installs
74
+ $skin_dir = preg_replace('|/+|','/', $skin_dir); // remove any duplicate slash
75
+ $mu_skin_dir = str_replace('\\','/',$flag_options['skinsDirABS']); // sanitize for Win32 installs
76
+ $mu_skin_dir = preg_replace('|/+|','/', $mu_skin_dir); // remove any duplicate slash
77
+ $file = preg_replace('#^' . preg_quote($skin_dir, '#') . '/|^' . preg_quote($mu_skin_dir, '#') . '/#','',$file); // get relative path from skins dir
78
+ $file = trim($file, '/');
79
+ return $file;
80
+ }
81
+
82
+ /**
83
+ * Check the skins directory and retrieve all skin files with skin data.
84
+ *
85
+ */
86
+ function get_skins($skin_folder='', $type='') {
87
+
88
+ $flag_options = get_option('flag_options');
89
+ $flag_skins = array ();
90
+ $skin_root = $flag_options['skinsDirABS'];
91
+ if( !empty($skin_folder) )
92
+ $skin_root = $skin_folder;
93
+
94
+ // Files in flash-album-gallery/skins directory
95
+ $skins_dir = @ opendir( $skin_root);
96
+ $skin_files = array();
97
+ if ( $skins_dir ) {
98
+ while (($file = readdir( $skins_dir ) ) !== false ) {
99
+ if ( substr($file, 0, 1) == '.' )
100
+ continue;
101
+ if ( is_dir( $skin_root.'/'.$file ) ) {
102
+ $skins_subdir = @ opendir( $skin_root.'/'.$file );
103
+ if ( $skins_subdir ) {
104
+ while (($subfile = readdir( $skins_subdir ) ) !== false ) {
105
+ if ( substr($subfile, 0, 1) == '.' )
106
+ continue;
107
+ if ( substr($subfile, -4) == '.php' )
108
+ $skin_files[] = "$file/$subfile";
109
+ }
110
+ }
111
+ } else {
112
+ if ( substr($file, -4) == '.php' )
113
+ $skin_files[] = $file;
114
+ }
115
+ }
116
+ }
117
+ @closedir( $skins_dir );
118
+ @closedir( $skins_subdir );
119
+
120
+ if ( !$skins_dir || empty($skin_files) )
121
+ return $flag_skins;
122
+
123
+ foreach ( $skin_files as $skin_file ) {
124
+ if ( !is_readable( "$skin_root/$skin_file" ) )
125
+ continue;
126
+
127
+ $skin_data = get_skin_data( "$skin_root/$skin_file", $type );
128
+
129
+ if ( empty ( $skin_data['Name'] ) )
130
+ continue;
131
+
132
+ $flag_skins[skin_basename( $skin_file )] = $skin_data;
133
+ }
134
+
135
+ uasort( $flag_skins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
136
+
137
+ return $flag_skins;
138
+ }
139
+
140
+ ?>
admin/grab_meta.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $meta = new flagMeta($image->pid);
3
+ $dbdata = $meta->get_saved_meta();
4
+ $exifdata = $meta->get_EXIF();
5
+ $iptcdata = $meta->get_IPTC();
6
+ $xmpdata = $meta->get_XMP();
7
+ $alttext = trim ( $meta->get_META('title') );
8
+ $description = trim ( $meta->get_META('caption') );
9
+ $timestamp = $meta->get_date_time();
10
+
11
+ $makedescription = '<b>'.__('Meta Data','flag')."</b><br>";
12
+ if ($dbdata) {
13
+ foreach ($dbdata as $key => $value){
14
+ if ( is_array($value) ) continue;
15
+ $makedescription .= '<b>'.$meta->i8n_name($key)."</b> ".$value."<br>";
16
+ }
17
+ } else {
18
+ $makedescription .= __('No meta data saved','flag')."<br>";
19
+ }
20
+ if ($exifdata) {
21
+ $makedescription .= "\n<b>".__('EXIF Data','flag')."</b><br>";
22
+ foreach ($exifdata as $key => $value){
23
+ $makedescription .= '<b>'.$meta->i8n_name($key)."</b> ".$value."<br>";
24
+ }
25
+ }
26
+ if ($iptcdata) {
27
+ $makedescription .= "\n<b>".__('IPTC Data','flag')."</b><br>";
28
+ foreach ($iptcdata as $key => $value){
29
+ $makedescription .= '<b>'.$meta->i8n_name($key)."</b> ".$value."<br>";
30
+ }
31
+ }
32
+ if ($xmpdata) {
33
+ $makedescription .= "\n<b>".__('XMP Data','flag')."</b><br>";
34
+ foreach ($xmpdata as $key => $value){
35
+ $makedescription .= '<b>'.$meta->i8n_name($key)."</b> ".$value."<br>";
36
+ }
37
+ }
38
+ ?>
admin/images/asc.gif ADDED
Binary file
admin/images/browser.png ADDED
Binary file
admin/images/desc.gif ADDED
Binary file
admin/images/fail.png ADDED
Binary file
admin/images/flag.png ADDED
Binary file
admin/images/hits.png ADDED
Binary file
admin/images/loadingAnimation.gif ADDED
Binary file
admin/images/lock.png ADDED
Binary file
admin/images/mail.png ADDED
Binary file
admin/images/map.png ADDED
Binary file
admin/images/menu-bits.gif ADDED
Binary file
admin/images/notes.png ADDED
Binary file
admin/images/reset.png ADDED
Binary file
admin/images/sortbg.gif ADDED
Binary file
admin/images/wallpaper.png ADDED
Binary file
admin/jgallery.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php global $wpdb, $post;
2
+ $flag_options = get_option ('flag_options');
3
+ $siteurl = site_url();
4
+ $c = array();
5
+ $isCrawler = flagGetUserNow($_SERVER['HTTP_USER_AGENT']); // check if is a crowler
6
+ extract($altColors);
7
+ $bg = ($wmode == 'window')? '#'.$Background : 'transparent';
8
+ $xml['alt'] .= '<style type="text/css">'.PHP_EOL;
9
+ if(!$isCrawler) {
10
+ $xml['alt'] .= '@import url("'.FLAG_URLPATH.'admin/css/flagallery_nocrawler.css");'.PHP_EOL;
11
+ }
12
+ $xml['alt'] .= '@import url("'.FLAG_URLPATH.'admin/css/flagallery_noflash.css");'.PHP_EOL;
13
+ if($isCrawler) {
14
+ $xml['alt'] .= '.flag_alternate .flagCatMeta h4 { padding: 4px 10px; margin: 7px 0; border: none; font: 14px Tahoma; text-decoration: none; background:#292929 none; color: #ffffff; }
15
+ .flag_alternate .flagCatMeta p { font-size: 12px; }'.PHP_EOL;
16
+ }
17
+ if($BarsBG) {
18
+ $bgBar = ($wmode == 'window')? '#'.$BarsBG : 'transparent';
19
+ if(!$isCrawler){
20
+ $xml['alt'] .= "#fancybox-title-over .title { color: #{$TitleColor}; }
21
+ #fancybox-title-over .descr { color: #{$DescrColor}; }
22
+ .flag_alternate .flagcatlinks { background-color: #{$BarsBG}; }
23
+ .flag_alternate .flagcatlinks a.flagcat { color: #{$CatColor}; background-color: #{$CatBGColor}; }
24
+ .flag_alternate .flagcatlinks a.active, .flag_alternate .flagcatlinks a.flagcat:hover { color: #{$CatColorOver}; background-color: #{$CatBGColorOver}; }".PHP_EOL;
25
+ }
26
+ $xml['alt'] .= ".flag_alternate .flagcategory a.flag_pic_alt { background-color: #{$ThumbBG}; border: 2px solid #{$ThumbBG}; color: #{$ThumbBG}; }
27
+ .flag_alternate .flagcategory a.flag_pic_alt:hover { background-color: #{$ThumbBG}; border: 2px solid #{$ThumbLoaderColor}; color: #{$ThumbLoaderColor}; }
28
+ .flag_alternate .flagcategory a.flag_pic_alt.current, .flag_alternate .flagcategory a.flag_pic_alt.last { border-color: #{$ThumbLoaderColor}; }".PHP_EOL;
29
+ }
30
+ if($altColors['FullWindow'] && !$isCrawler){
31
+ $xml['alt'] .= ".flagcatlinks a.backlink { color: #{$CatColor}; background-color: #{$CatBGColor}; }".PHP_EOL;
32
+ }
33
+ $xml['alt'] .= '</style>'.PHP_EOL;
34
+ if(!$isCrawler){
35
+ if(!$flag_options['jAlterGalScript']) {
36
+ $xml['alt'] .= '<link href="'.plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.css').'" rel="stylesheet" type="text/css" />'.PHP_EOL;
37
+ $xml['alt'] .= "<script type='text/javascript' src='".plugins_url('/flash-album-gallery/admin/js/jquery.fancybox-1.3.4.pack.js')."'></script>".PHP_EOL;
38
+ $xml['alt'] .= "<script type='text/javascript'>var ExtendVar='fancybox', hitajax = '".plugins_url('/lib/hitcounter.php', dirname(__FILE__))."';</script>".PHP_EOL;
39
+ } else if($flag_options['jAlterGalScript'] == 1) {
40
+ $xml['alt'] .= "<style type='text/css'>@import url('".plugins_url('/admin/js/photoswipe/photoswipe.css', dirname(__FILE__))."');</style>
41
+ <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/klass.min.js', dirname(__FILE__))."'></script>
42
+ <script type='text/javascript' src='".plugins_url('/admin/js/photoswipe/code.photoswipe.jquery-3.0.5.min.js', dirname(__FILE__))."'></script>
43
+ <script type='text/javascript'>var ExtendVar='photoswipe', hitajax = '".plugins_url('/lib/hitcounter.php', dirname(__FILE__))."';</script>".PHP_EOL;
44
+ }
45
+ }
46
+
47
+ $xml['alt'] .= '<div id="'.$skinID.'_jq" class="flag_alternate">
48
+ <div class="flagcatlinks">';
49
+ if($altColors['FullWindow'] && !$isCrawler){
50
+ $flag_custom = get_post_custom($post->ID);
51
+ $backlink = $flag_custom["mb_button_link"][0];
52
+ if(!$backlink || $backlink == 'http://'){ $backlink = $_SERVER["HTTP_REFERER"]; }
53
+ if($backlink){
54
+ $xml['alt'] .= '<a id="backlink" class="backlink" href="'.$backlink.'">'.$flag_custom["mb_button"][0].'</a>';
55
+ }
56
+ }
57
+ $xml['alt'] .= '</div>'.PHP_EOL;
58
+
59
+ $gID = explode( '_', $galleryID ); // get the gallery id
60
+ if ( is_user_logged_in() ) $exclude_clause = '';
61
+ else $exclude_clause = ' AND exclude<>1 ';
62
+ $i = 0;
63
+ foreach ( $gID as $galID ) {
64
+ $galID = (int) $galID;
65
+ if ( $galID == 0) {
66
+ $thegalleries = array();
67
+ $thepictures = $wpdb->get_results("SELECT pid, galleryid, filename, description, alttext, imagedate, sortorder, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE 1=1 {$exclude_clause} ORDER BY {$flag_options['galSort']} {$flag_options['galSortDir']} ", ARRAY_A);
68
+ } else {
69
+ $thegalleries = $wpdb->get_row("SELECT gid, name, path, title, galdesc FROM $wpdb->flaggallery WHERE gid={$galID}", ARRAY_A);
70
+ $thepictures = $wpdb->get_results("SELECT pid, filename, description, alttext, imagedate, hitcounter, total_value, total_votes FROM $wpdb->flagpictures WHERE galleryid = '{$galID}' {$exclude_clause} ORDER BY {$flag_options['galSort']} {$flag_options['galSortDir']} ", ARRAY_A);
71
+ }
72
+ $captions = '';
73
+
74
+
75
+ if (is_array ($thepictures) && count($thegalleries) && count($thepictures)){
76
+ $thegalleries = array_map('stripslashes', $thegalleries);
77
+ $thegalleries['galdesc'] = htmlspecialchars_decode($thegalleries['galdesc']);
78
+ $a = $thegalleries;
79
+
80
+ $xml['alt'] .= '<div class="flagCatMeta">'.PHP_EOL;
81
+ $xml['alt'] .= ' <h4>'.$thegalleries['title'].'</h4>'.PHP_EOL;
82
+ $xml['alt'] .= ' <p>'.$thegalleries['galdesc'].'</p>'.PHP_EOL;
83
+ $xml['alt'] .= '</div>'.PHP_EOL;
84
+ $xml['alt'] .= '<div class="flagcategory" id="gid_'.$galID.'_'.$skinID.'">'.PHP_EOL;
85
+ $n = count($thepictures);
86
+ $var = floor($n/5);
87
+ if($var==0 || $var > 4) $var=4;
88
+ $split = ceil($n/$var);
89
+ $j=0;
90
+ $b = array();
91
+ foreach ($thepictures as $picture) {
92
+ $picture = array_map('stripslashes', $picture);
93
+ $b['data'][] = $picture;
94
+
95
+ $pid = intval($picture['pid']);
96
+
97
+ if ($isCrawler){
98
+ $xml['alt'] .= '<a style="display:block; overflow: hidden; height: auto; width: auto; margin-bottom: 10px; background-color: #eeeeee; background-position: 22px 44px; text-align: left;" class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'"><img style="float:left; margin-right: 10px;" title="'.strip_tags($picture['alttext']).'" alt="'.strip_tags($picture['alttext']).'" src="'.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].'" width="115" height="100" /><span style="display: block; overflow: hidden; text-decoration: none; color: #000; font-weight: normal;" class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.strip_tags($picture['alttext']).'</strong><br />'.strip_tags($picture['description'],'<b><u><i><span>').'</span></a>'.PHP_EOL;
99
+ } else {
100
+ $xml['alt'] .= '<a class="i'. $j++ .' flag_pic_alt" href="'.$siteurl.'/'.$thegalleries['path'].'/'.$picture['filename'].'" id="flag_pic_'.$pid.'" rel="gid_'.$galID.'_'.$skinID.'" title="'.strip_tags($picture['alttext']).'">[img src='.$siteurl.'/'.$thegalleries['path'].'/thumbs/thumbs_'.$picture['filename'].']<span class="flag_pic_desc" id="flag_desc_'.$pid.'"><strong>'.htmlspecialchars($picture['alttext']).'</strong><br /><span>'.htmlspecialchars($picture['description']).'</span></span></a>'.PHP_EOL;
101
+ }
102
+ }
103
+ $xml['alt'] .= '</div>'.PHP_EOL;
104
+ $c['galleries'][] = $a + $b;
105
+ }
106
+ }
107
+ $xml['alt'] .= '</div>'.PHP_EOL;
108
+ $d = array('properties'=>$data) + $c;
109
+ $xml['json'] = json_encode($d);
110
+ ?>
admin/js/Jcrop/css/Jcrop.gif ADDED
Binary file
admin/js/Jcrop/css/jquery.Jcrop.css ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
2
+ .jcrop-holder { text-align: left; }
3
+
4
+ .jcrop-vline, .jcrop-hline
5
+ {
6
+ font-size: 0;
7
+ position: absolute;
8
+ background: white url('Jcrop.gif') top left repeat;
9
+ }
10
+ .jcrop-vline { height: 100%; width: 1px !important; }
11
+ .jcrop-hline { width: 100%; height: 1px !important; }
12
+ .jcrop-handle {
13
+ font-size: 1px;
14
+ width: 7px !important;
15
+ height: 7px !important;
16
+ border: 1px #eee solid;
17
+ background-color: #333;
18
+ *width: 9px;
19
+ *height: 9px;
20
+ }
21
+
22
+ .jcrop-tracker { width: 100%; height: 100%; }
23
+
24
+ .custom .jcrop-vline,
25
+ .custom .jcrop-hline
26
+ {
27
+ background: yellow;
28
+ }
29
+ .custom .jcrop-handle
30
+ {
31
+ border-color: black;
32
+ background-color: #C7BB00;
33
+ -moz-border-radius: 3px;
34
+ -webkit-border-radius: 3px;
35
+ }
36
+
37
+ #actualThumb img { width: 150px; height: auto; }
admin/js/Jcrop/js/jquery.Jcrop.js ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * jquery.Jcrop.min.js v0.9.9 {{{ (build:20110724)
3
+ * jQuery Image Cropping Plugin - released under MIT License
4
+ * Copyright (c) 2008-2011 Tapmodo Interactive LLC
5
+ * https://github.com/tapmodo/Jcrop
6
+ */
7
+
8
+ (function($){$.Jcrop=function(obj,opt){var options=$.extend({},$.Jcrop.defaults),docOffset,lastcurs,ie6mode=false;function px(n){return parseInt(n,10)+'px';}
9
+ function cssClass(cl){return options.baseClass+'-'+cl;}
10
+ function supportsColorFade(){return $.fx.step.hasOwnProperty('backgroundColor');}
11
+ function getPos(obj)
12
+ {var pos=$(obj).offset();return[pos.left,pos.top];}
13
+ function mouseAbs(e)
14
+ {return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];}
15
+ function setOptions(opt)
16
+ {if(typeof(opt)!=='object')opt={};options=$.extend(options,opt);$.each(['onChange','onSelect','onRelease','onDblClick'],function(i,e){if(typeof(options[e])!=='function')options[e]=function(){};});}
17
+ function startDragMode(mode,pos)
18
+ {docOffset=getPos($img);Tracker.setCursor(mode==='move'?mode:mode+'-resize');if(mode==='move'){return Tracker.activateHandlers(createMover(pos),doneSelect);}
19
+ var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);}
20
+ function dragmodeHandler(mode,f)
21
+ {return function(pos){if(!options.aspectRatio){switch(mode){case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}}else{switch(mode){case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}}
22
+ Coords.setCurrent(pos);Selection.update();};}
23
+ function createMover(pos)
24
+ {var lloc=pos;KeyManager.watchKeys();return function(pos){Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};}
25
+ function oppLockCorner(ord)
26
+ {switch(ord){case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';}}
27
+ function createDragger(ord)
28
+ {return function(e){if(options.disabled){return false;}
29
+ if((ord==='move')&&!options.allowMove){return false;}
30
+ btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};}
31
+ function presize($obj,w,h)
32
+ {var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0){nw=w;nh=(w/$obj.width())*$obj.height();}
33
+ if((nh>h)&&h>0){nh=h;nw=(h/$obj.height())*$obj.width();}
34
+ xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);}
35
+ function unscale(c)
36
+ {return{x:parseInt(c.x*xscale,10),y:parseInt(c.y*yscale,10),x2:parseInt(c.x2*xscale,10),y2:parseInt(c.y2*yscale,10),w:parseInt(c.w*xscale,10),h:parseInt(c.h*yscale,10)};}
37
+ function doneSelect(pos)
38
+ {var c=Coords.getFixed();if((c.w>options.minSelect[0])&&(c.h>options.minSelect[1])){Selection.enableHandles();Selection.done();}else{Selection.release();}
39
+ Tracker.setCursor(options.allowSelect?'crosshair':'default');}
40
+ function newSelection(e)
41
+ {if(options.disabled){return false;}
42
+ if(!options.allowSelect){return false;}
43
+ btndown=true;docOffset=getPos($img);Selection.disableHandles();Tracker.setCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Selection.update();Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();e.stopPropagation();e.preventDefault();return false;}
44
+ function selectDrag(pos)
45
+ {Coords.setCurrent(pos);Selection.update();}
46
+ function newTracker()
47
+ {var trk=$('<div></div>').addClass(cssClass('tracker'));if($.browser.msie){trk.css({opacity:0,backgroundColor:'white'});}
48
+ return trk;}
49
+ if($.browser.msie&&($.browser.version.split('.')[0]==='6')){ie6mode=true;}
50
+ if(typeof(obj)!=='object'){obj=$(obj)[0];}
51
+ if(typeof(opt)!=='object'){opt={};}
52
+ setOptions(opt);var img_css={border:'none',margin:0,padding:0,position:'absolute'};var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css(img_css);$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass);}
53
+ var $img2=$('<img />').attr('src',$img.attr('src')).css(img_css).width(boundx).height(boundy),$img_holder=$('<div />').width('100%').height('100%').css({zIndex:310,position:'absolute',overflow:'hidden'}),$hdl_holder=$('<div />').width('100%').height('100%').css('zIndex',320),$sel=$('<div />').css({position:'absolute',zIndex:600}).dblclick(function(){var c=Coords.getFixed();options.onDblClick.call(api,c);}).insertBefore($img).append($img_holder,$hdl_holder);$img_holder.append($img2);if(ie6mode){$sel.css({overflowY:'hidden'});}
54
+ var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var bgcolor=options.bgColor,bgopacity=options.bgOpacity,xlimit,ylimit,xmin,ymin,xscale,yscale,enabled=true,btndown,animating,shift_down;docOffset=getPos($img);var Touch=(function(){function hasTouchSupport(){var support={},events=['touchstart','touchmove','touchend'],el=document.createElement('div'),i;try{for(i=0;i<events.length;i++){var eventName=events[i];eventName='on'+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,'return;');isSupported=typeof el[eventName]=='function';}
55
+ support[events[i]]=isSupported;}
56
+ return support.touchstart&&support.touchend&&support.touchmove;}
57
+ catch(err){return false;}}
58
+ function detectSupport(){if((options.touchSupport===true)||(options.touchSupport===false))return options.touchSupport;else return hasTouchSupport();}
59
+ return{createDragger:function(ord){return function(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;if(options.disabled){return false;}
60
+ if((ord==='move')&&!options.allowMove){return false;}
61
+ btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};},newSelection:function(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return newSelection(e);},isSupported:hasTouchSupport,support:detectSupport()};}());var Coords=(function(){var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
62
+ {pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];}
63
+ function setCurrent(pos)
64
+ {pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];}
65
+ function getOffset()
66
+ {return[ox,oy];}
67
+ function moveOffset(offset)
68
+ {var ox=offset[0],oy=offset[1];if(0>x1+ox){ox-=ox+x1;}
69
+ if(0>y1+oy){oy-=oy+y1;}
70
+ if(boundy<y2+oy){oy+=boundy-(y2+oy);}
71
+ if(boundx<x2+ox){ox+=boundx-(x2+ox);}
72
+ x1+=ox;x2+=ox;y1+=oy;y2+=oy;}
73
+ function getCorner(ord)
74
+ {var c=getFixed();switch(ord){case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}}
75
+ function getFixed()
76
+ {if(!options.aspectRatio){return getRect();}
77
+ var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy;if(max_x===0){max_x=boundx*10;}
78
+ if(max_y===0){max_y=boundy*10;}
79
+ if(real_ratio<aspect){yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0){xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}else if(xx>boundx){xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}else{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0){yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}else if(yy>boundy){yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
80
+ if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}
81
+ if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x;}else if(x1-xx>max_x){xx=x1-max_x;}
82
+ if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
83
+ if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
84
+ if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
85
+ return makeObj(flipCoords(x1,y1,xx,yy));}
86
+ function rebound(p)
87
+ {if(p[0]<0){p[0]=0;}
88
+ if(p[1]<0){p[1]=0;}
89
+ if(p[0]>boundx){p[0]=boundx;}
90
+ if(p[1]>boundy){p[1]=boundy;}
91
+ return[p[0],p[1]];}
92
+ function flipCoords(x1,y1,x2,y2)
93
+ {var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1){xa=x2;xb=x1;}
94
+ if(y2<y1){ya=y2;yb=y1;}
95
+ return[Math.round(xa),Math.round(ya),Math.round(xb),Math.round(yb)];}
96
+ function getRect()
97
+ {var xsize=x2-x1,ysize=y2-y1,delta;if(xlimit&&(Math.abs(xsize)>xlimit)){x2=(xsize>0)?(x1+xlimit):(x1-xlimit);}
98
+ if(ylimit&&(Math.abs(ysize)>ylimit)){y2=(ysize>0)?(y1+ylimit):(y1-ylimit);}
99
+ if(ymin/yscale&&(Math.abs(ysize)<ymin/yscale)){y2=(ysize>0)?(y1+ymin/yscale):(y1-ymin/yscale);}
100
+ if(xmin/xscale&&(Math.abs(xsize)<xmin/xscale)){x2=(xsize>0)?(x1+xmin/xscale):(x1-xmin/xscale);}
101
+ if(x1<0){x2-=x1;x1-=x1;}
102
+ if(y1<0){y2-=y1;y1-=y1;}
103
+ if(x2<0){x1-=x2;x2-=x2;}
104
+ if(y2<0){y1-=y2;y2-=y2;}
105
+ if(x2>boundx){delta=x2-boundx;x1-=delta;x2-=delta;}
106
+ if(y2>boundy){delta=y2-boundy;y1-=delta;y2-=delta;}
107
+ if(x1>boundx){delta=x1-boundy;y2-=delta;y1-=delta;}
108
+ if(y1>boundy){delta=y1-boundy;y2-=delta;y1-=delta;}
109
+ return makeObj(flipCoords(x1,y1,x2,y2));}
110
+ function makeObj(a)
111
+ {return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};}
112
+ return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}());var Shade=(function(){var enabled=false,holder=$('<div />').css({position:'absolute',zIndex:240,opacity:0}),shades={top:createShade(),left:createShade().height(boundy),right:createShade().height(boundy),bottom:createShade()};function resizeShades(w,h){shades.left.css({height:px(h)});shades.right.css({height:px(h)});}
113
+ function updateAuto()
114
+ {return updateShade(Coords.getFixed());}
115
+ function updateShade(c)
116
+ {shades.top.css({left:px(c.x),width:px(c.w),height:px(c.y)});shades.bottom.css({top:px(c.y2),left:px(c.x),width:px(c.w),height:px(boundy-c.y2)});shades.right.css({left:px(c.x2),width:px(boundx-c.x2)});shades.left.css({width:px(c.x)});}
117
+ function createShade(){return $('<div />').css({position:'absolute',backgroundColor:options.shadeColor||options.bgColor}).appendTo(holder);}
118
+ function enableShade(){if(!enabled){enabled=true;holder.insertBefore($img);updateAuto();Selection.setBgOpacity(1,0,1);$img2.hide();setBgColor(options.shadeColor||options.bgColor,1);if(Selection.isAwake())
119
+ {setOpacity(options.bgOpacity,1);}
120
+ else setOpacity(1,1);}}
121
+ function setBgColor(color,now){colorChangeMacro(getShades(),color,now);}
122
+ function disableShade(){if(enabled){holder.remove();$img2.show();enabled=false;if(Selection.isAwake()){Selection.setBgOpacity(options.bgOpacity,1,1);}else{Selection.setBgOpacity(1,1,1);Selection.disableHandles();}
123
+ colorChangeMacro($div,0,1);}}
124
+ function setOpacity(opacity,now){if(enabled){if(options.bgFade&&!now){holder.animate({opacity:1-opacity},{queue:false,duration:options.fadeTime});}
125
+ else holder.css({opacity:1-opacity});}}
126
+ function refreshAll(){options.shade?enableShade():disableShade();if(Selection.isAwake())setOpacity(options.bgOpacity);}
127
+ function getShades(){return holder.children();}
128
+ return{update:updateAuto,updateRaw:updateShade,getShades:getShades,setBgColor:setBgColor,enable:enableShade,disable:disableShade,resize:resizeShades,refresh:refreshAll,opacity:setOpacity};}());var Selection=(function(){var awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;function insertBorder(type)
129
+ {var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;}
130
+ function dragDiv(ord,zi)
131
+ {var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});if(Touch.support){jq.bind('touchstart',Touch.createDragger(ord));}
132
+ $hdl_holder.append(jq);return jq;}
133
+ function insertHandle(ord)
134
+ {var hs=options.handleSize;return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).width(hs).height(hs).addClass(cssClass('handle'));}
135
+ function insertDragbar(ord)
136
+ {var s=options.handleSize,h=s,w=s,t=hhs,l=hhs;switch(ord){case'n':case's':w='100%';break;case'e':case'w':h='100%';break;}
137
+ return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});}
138
+ function createHandles(li)
139
+ {var i;for(i=0;i<li.length;i++){handle[li[i]]=insertHandle(li[i]);}}
140
+ function moveHandles(c)
141
+ {var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=-hhs+1,west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;if(handle.e){handle.e.css({top:px(midvert),left:px(east)});handle.w.css({top:px(midvert)});handle.s.css({top:px(south),left:px(midhoriz)});handle.n.css({left:px(midhoriz)});}
142
+ if(handle.ne){handle.ne.css({left:px(east)});handle.se.css({top:px(south),left:px(east)});handle.sw.css({top:px(south)});}
143
+ if(handle.b){handle.b.css({top:px(south)});handle.r.css({left:px(east)});}}
144
+ function moveto(x,y)
145
+ {if(!options.shade){$img2.css({top:px(-y),left:px(-x)});}
146
+ $sel.css({top:px(y),left:px(x)});}
147
+ function resize(w,h)
148
+ {$sel.width(w).height(h);}
149
+ function refresh()
150
+ {var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();}
151
+ function updateVisible()
152
+ {if(awake){return update();}}
153
+ function update()
154
+ {var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);if(options.shade)Shade.updateRaw(c);if(seehandles){moveHandles(c);}
155
+ if(!awake){show();}
156
+ options.onChange.call(api,unscale(c));}
157
+ function setBgOpacity(opacity,force,now)
158
+ {if(!awake&&!force)return;if(options.bgFade&&!now){$img.animate({opacity:opacity},{queue:false,duration:options.fadeTime});}else{$img.css('opacity',opacity);}}
159
+ function show()
160
+ {$sel.show();if(options.shade)Shade.opacity(bgopacity);else setBgOpacity(bgopacity,true);awake=true;}
161
+ function release()
162
+ {disableHandles();$sel.hide();if(options.shade)Shade.opacity(1);else setBgOpacity(1);awake=false;options.onRelease.call(api);}
163
+ function showHandles()
164
+ {if(seehandles){moveHandles(Coords.getFixed());$hdl_holder.show();}}
165
+ function enableHandles()
166
+ {seehandles=true;if(options.allowResize){moveHandles(Coords.getFixed());$hdl_holder.show();return true;}}
167
+ function disableHandles()
168
+ {seehandles=false;$hdl_holder.hide();}
169
+ function animMode(v)
170
+ {if(animating===v){disableHandles();}else{enableHandles();}}
171
+ function done()
172
+ {animMode(false);refresh();}
173
+ if(options.drawBorders){borders={top:insertBorder('hline'),bottom:insertBorder('hline bottom'),left:insertBorder('vline'),right:insertBorder('vline right')};}
174
+ if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
175
+ if(options.sideHandles){createHandles(['n','s','e','w']);}
176
+ if(options.cornerHandles){createHandles(['sw','nw','ne','se']);}
177
+ var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360});if(Touch.support){$track.bind('touchstart.jcrop',Touch.createDragger('move'));}
178
+ $img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,isAwake:function(){return awake;},setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,setBgOpacity:setBgOpacity,done:done};}());var Tracker=(function(){var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;function toFront()
179
+ {$trk.css({zIndex:450});if(Touch.support){$(document).bind('touchmove',trackTouchMove).bind('touchend',trackTouchEnd);}
180
+ if(trackDoc){$(document).bind('mousemove',trackMove).bind('mouseup',trackUp);}}
181
+ function toBack()
182
+ {$trk.css({zIndex:290});if(Touch.support){$(document).unbind('touchmove',trackTouchMove).unbind('touchend',trackTouchEnd);}
183
+ if(trackDoc){$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
184
+ function trackMove(e)
185
+ {onMove(mouseAbs(e));return false;}
186
+ function trackUp(e)
187
+ {e.preventDefault();e.stopPropagation();if(btndown){btndown=false;onDone(mouseAbs(e));if(Selection.isAwake()){options.onSelect.call(api,unscale(Coords.getFixed()));}
188
+ toBack();onMove=function(){};onDone=function(){};}
189
+ return false;}
190
+ function activateHandlers(move,done)
191
+ {btndown=true;onMove=move;onDone=done;toFront();return false;}
192
+ function trackTouchMove(e)
193
+ {e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return trackMove(e);}
194
+ function trackTouchEnd(e)
195
+ {e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return trackUp(e);}
196
+ function setCursor(t)
197
+ {$trk.css('cursor',t);}
198
+ if(!trackDoc){$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
199
+ $img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}());var KeyManager=(function(){var $keymgr=$('<input type="radio" />').css({position:'fixed',left:'-120px',width:'12px'}),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
200
+ {if(options.keySupport){$keymgr.show();$keymgr.focus();}}
201
+ function onBlur(e)
202
+ {$keymgr.hide();}
203
+ function doNudge(e,x,y)
204
+ {if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();}
205
+ e.preventDefault();e.stopPropagation();}
206
+ function parseKey(e)
207
+ {if(e.ctrlKey){return true;}
208
+ shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode){case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:if(options.allowSelect)Selection.release();break;case 9:return true;}
209
+ return false;}
210
+ if(options.keySupport){$keymgr.keydown(parseKey).blur(onBlur);if(ie6mode||!options.fixedSupport){$keymgr.css({position:'absolute',left:'-20px'});$keywrap.append($keymgr).insertBefore($img);}else{$keymgr.insertBefore($img);}}
211
+ return{watchKeys:watchKeys};}());function setClass(cname)
212
+ {$div.removeClass().addClass(cssClass('holder')).addClass(cname);}
213
+ function animateTo(a,callback)
214
+ {var x1=parseInt(a[0],10)/xscale,y1=parseInt(a[1],10)/yscale,x2=parseInt(a[2],10)/xscale,y2=parseInt(a[3],10)/yscale;if(animating){return;}
215
+ var animto=Coords.flipCoords(x1,y1,x2,y2),c=Coords.getFixed(),initcr=[c.x,c.y,c.x2,c.y2],animat=initcr,interv=options.animationDelay,ix1=animto[0]-initcr[0],iy1=animto[1]-initcr[1],ix2=animto[2]-initcr[2],iy2=animto[3]-initcr[3],pcent=0,velocity=options.swingSpeed;x=animat[0];y=animat[1];x2=animat[2];y2=animat[3];Selection.animMode(true);var anim_timer;function queueAnimator(){window.setTimeout(animator,interv);}
216
+ var animator=(function(){return function(){pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent>=99.8){pcent=100;}
217
+ if(pcent<100){setSelectRaw(animat);queueAnimator();}else{Selection.done();if(typeof(callback)==='function'){callback.call(api);}}};}());queueAnimator();}
218
+ function setSelect(rect)
219
+ {setSelectRaw([parseInt(rect[0],10)/xscale,parseInt(rect[1],10)/yscale,parseInt(rect[2],10)/xscale,parseInt(rect[3],10)/yscale]);options.onSelect.call(api,unscale(Coords.getFixed()));}
220
+ function setSelectRaw(l)
221
+ {Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();}
222
+ function tellSelect()
223
+ {return unscale(Coords.getFixed());}
224
+ function tellScaled()
225
+ {return Coords.getFixed();}
226
+ function setOptionsNew(opt)
227
+ {setOptions(opt);interfaceUpdate();}
228
+ function disableCrop()
229
+ {options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');}
230
+ function enableCrop()
231
+ {options.disabled=false;interfaceUpdate();}
232
+ function cancelCrop()
233
+ {Selection.done();Tracker.activateHandlers(null,null);}
234
+ function destroy()
235
+ {$div.remove();$origimg.show();$(obj).removeData('Jcrop');}
236
+ function setImage(src,callback)
237
+ {Selection.release();disableCrop();var img=new Image();img.onload=function(){var iw=img.width;var ih=img.height;var bw=options.boxWidth;var bh=options.boxHeight;$img.width(iw).height(ih);$img.attr('src',src);$img2.attr('src',src);presize($img,bw,bh);boundx=$img.width();boundy=$img.height();$img2.width(boundx).height(boundy);$trk.width(boundx+(bound*2)).height(boundy+(bound*2));$div.width(boundx).height(boundy);Shade.resize(boundx,boundy);enableCrop();if(typeof(callback)==='function'){callback.call(api);}};img.src=src;}
238
+ function colorChangeMacro($obj,color,now){var mycolor=color||options.bgColor;if(options.bgFade&&supportsColorFade()&&options.fadeTime&&!now){$obj.animate({backgroundColor:mycolor},{queue:false,duration:options.fadeTime});}else{$obj.css('backgroundColor',mycolor);}}
239
+ function interfaceUpdate(alt)
240
+ {if(options.allowResize){if(alt){Selection.enableOnly();}else{Selection.enableHandles();}}else{Selection.disableHandles();}
241
+ Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');if(options.hasOwnProperty('setSelect')){setSelect(options.setSelect);Selection.done();delete(options.setSelect);}
242
+ if(options.hasOwnProperty('trueSize')){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
243
+ Shade.refresh();if(options.bgColor!=bgcolor){colorChangeMacro(options.shade?Shade.getShades():$div,options.shade?(options.shadeColor||options.bgColor):options.bgColor);bgcolor=options.bgColor;}
244
+ if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade)Shade.refresh();else Selection.setBgOpacity(bgopacity);}
245
+ xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty('outerImage')){$img.attr('src',options.outerImage);delete(options.outerImage);}
246
+ Selection.refresh();}
247
+ if(Touch.support)$trk.bind('touchstart',Touch.newSelection);$hdl_holder.hide();interfaceUpdate(true);var api={setImage:setImage,animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},getScaleFactor:function(){return[xscale,yscale];},ui:{holder:$div,selection:$sel}};if($.browser.msie){$div.bind('selectstart',function(){return false;});}
248
+ $origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options,callback)
249
+ {function attachWhenDone(from)
250
+ {var opt=(typeof(options)==='object')?options:{};var loadsrc=opt.useImg||from.src;var img=new Image();img.onload=function(){function attachJcrop(){var api=$.Jcrop(from,opt);if(typeof(callback)==='function'){callback.call(api);}}
251
+ function attachAttempt(){if(!img.width||!img.height){window.setTimeout(attachAttempt,50);}else{attachJcrop();}}
252
+ window.setTimeout(attachAttempt,50);};img.src=loadsrc;}
253
+ this.each(function(){if($(this).data('Jcrop')){if(options==='api'){return $(this).data('Jcrop');}
254
+ else{$(this).data('Jcrop').setOptions(options);}}
255
+ else{attachWhenDone(this);}});return this;};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,trackDocument:true,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:7,handleOffset:5,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:false,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}};}(jQuery));
admin/js/disablescroll.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function hookMouseWheel(){
2
+ if (window.addEventListener)
3
+ window.addEventListener('DOMMouseScroll', onMouseWheel, false);
4
+ window.onmousewheel = document.onmousewheel = onMouseWheel;
5
+ }
6
+
7
+ function isOverSwf(mEvent)
8
+ {
9
+ var elem;
10
+ if (mEvent.srcElement) {
11
+ elem = mEvent.srcElement.nodeName;
12
+ } else if (mEvent.target) {
13
+ elem = mEvent.target.nodeName;
14
+ }
15
+
16
+ if (elem.toLowerCase() == "object" || elem.toLowerCase() == "embed") {
17
+ // if (jQuery(elem).hasClass('flashalbum')) {
18
+ return true;
19
+ }
20
+ return false;
21
+ }
22
+
23
+ function onMouseWheel(event)
24
+ {
25
+ var delta = 0;
26
+ if (!event)
27
+ event = window.event;
28
+ if (event.wheelDelta) {
29
+ delta = event.wheelDelta/120;
30
+ if (window.opera) delta = -delta;
31
+ } else if (event.detail) {
32
+ delta = -event.detail/3;
33
+ }
34
+
35
+ if (isOverSwf(event)) {
36
+ return cancelEvent(event);
37
+ }
38
+
39
+ return true;
40
+ }
41
+
42
+ function cancelEvent(e)
43
+ {
44
+ e = e ? e : window.event;
45
+ if (e.stopPropagation)
46
+ e.stopPropagation();
47
+ if (e.preventDefault)
48
+ e.preventDefault();
49
+ e.cancelBubble = true;
50
+ e.cancel = true;
51
+ e.returnValue = false;
52
+ return false;
53
+ }
54
+
55
+ hookMouseWheel();
admin/js/farbtastic-nosharp.js ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Farbtastic Color Picker 1.2
3
+ * © 2008 Steven Wittens
4
+ *
5
+ * This program is free software; you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation; either version 2 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ jQuery.fn.farbtastic = function (callback) {
21
+ jQuery.farbtastic(this, callback);
22
+ return this;
23
+ };
24
+
25
+ jQuery.farbtastic = function (container, callback) {
26
+ var container = jQuery(container).get(0);
27
+ return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
28
+ }
29
+
30
+ jQuery._farbtastic = function (container, callback) {
31
+ // Store farbtastic object
32
+ var fb = this;
33
+
34
+ // Insert markup
35
+ jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
36
+ var e = jQuery('.farbtastic', container);
37
+ fb.wheel = jQuery('.wheel', container).get(0);
38
+ // Dimensions
39
+ fb.radius = 84;
40
+ fb.square = 100;
41
+ fb.width = 194;
42
+
43
+ // Fix background PNGs in IE6
44
+ if (navigator.appVersion.match(/MSIE [0-6]\./)) {
45
+ jQuery('*', e).each(function () {
46
+ if (this.currentStyle.backgroundImage != 'none') {
47
+ var image = this.currentStyle.backgroundImage;
48
+ image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
49
+ jQuery(this).css({
50
+ 'backgroundImage': 'none',
51
+ 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
52
+ });
53
+ }
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Link to the given element(s) or callback.
59
+ */
60
+ fb.linkTo = function (callback) {
61
+ // Unbind previous nodes
62
+ if (typeof fb.callback == 'object') {
63
+ jQuery(fb.callback).unbind('keyup', fb.updateValue);
64
+ }
65
+
66
+ // Reset color
67
+ fb.color = null;
68
+
69
+ // Bind callback or elements
70
+ if (typeof callback == 'function') {
71
+ fb.callback = callback;
72
+ }
73
+ else if (typeof callback == 'object' || typeof callback == 'string') {
74
+ fb.callback = jQuery(callback);
75
+ fb.callback.bind('keyup', fb.updateValue);
76
+ if (fb.callback.get(0).value) {
77
+ fb.setColor(fb.callback.get(0).value);
78
+ }
79
+ }
80
+ return this;
81
+ }
82
+ fb.updateValue = function (event) {
83
+ if (this.value && this.value != fb.color) {
84
+ fb.setColor(this.value);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Change color with HTML syntax #123456
90
+ */
91
+ fb.setColor = function (color) {
92
+ var unpack = fb.unpack(color);
93
+ if (fb.color != color && unpack) {
94
+ fb.color = color;
95
+ fb.rgb = unpack;
96
+ fb.hsl = fb.RGBToHSL(fb.rgb);
97
+ fb.updateDisplay();
98
+ }
99
+ return this;
100
+ }
101
+
102
+ /**
103
+ * Change color with HSL triplet [0..1, 0..1, 0..1]
104
+ */
105
+ fb.setHSL = function (hsl) {
106
+ fb.hsl = hsl;
107
+ fb.rgb = fb.HSLToRGB(hsl);
108
+ fb.color = fb.pack(fb.rgb);
109
+ fb.updateDisplay();
110
+ return this;
111
+ }
112
+
113
+ /////////////////////////////////////////////////////
114
+
115
+ /**
116
+ * Retrieve the coordinates of the given event relative to the center
117
+ * of the widget.
118
+ */
119
+ fb.widgetCoords = function (event) {
120
+ var x, y;
121
+ var el = event.target || event.srcElement;
122
+ var reference = fb.wheel;
123
+
124
+ if (typeof event.offsetX != 'undefined') {
125
+ // Use offset coordinates and find common offsetParent
126
+ var pos = { x: event.offsetX, y: event.offsetY };
127
+
128
+ // Send the coordinates upwards through the offsetParent chain.
129
+ var e = el;
130
+ while (e) {
131
+ e.mouseX = pos.x;
132
+ e.mouseY = pos.y;
133
+ pos.x += e.offsetLeft;
134
+ pos.y += e.offsetTop;
135
+ e = e.offsetParent;
136
+ }
137
+
138
+ // Look for the coordinates starting from the wheel widget.
139
+ var e = reference;
140
+ var offset = { x: 0, y: 0 }
141
+ while (e) {
142
+ if (typeof e.mouseX != 'undefined') {
143
+ x = e.mouseX - offset.x;
144
+ y = e.mouseY - offset.y;
145
+ break;
146
+ }
147
+ offset.x += e.offsetLeft;
148
+ offset.y += e.offsetTop;
149
+ e = e.offsetParent;
150
+ }
151
+
152
+ // Reset stored coordinates
153
+ e = el;
154
+ while (e) {
155
+ e.mouseX = undefined;
156
+ e.mouseY = undefined;
157
+ e = e.offsetParent;
158
+ }
159
+ }
160
+ else {
161
+ // Use absolute coordinates
162
+ var pos = fb.absolutePosition(reference);
163
+ x = (event.pageX || 0*(event.clientX + jQuery('html').get(0).scrollLeft)) - pos.x;
164
+ y = (event.pageY || 0*(event.clientY + jQuery('html').get(0).scrollTop)) - pos.y;
165
+ }
166
+ // Subtract distance to middle
167
+ return { x: x - fb.width / 2, y: y - fb.width / 2 };
168
+ }
169
+
170
+ /**
171
+ * Mousedown handler
172
+ */
173
+ fb.mousedown = function (event) {
174
+ // Capture mouse
175
+ if (!document.dragging) {
176
+ jQuery(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
177
+ document.dragging = true;
178
+ }
179
+
180
+ // Check which area is being dragged
181
+ var pos = fb.widgetCoords(event);
182
+ fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
183
+
184
+ // Process
185
+ fb.mousemove(event);
186
+ return false;
187
+ }
188
+
189
+ /**
190
+ * Mousemove handler
191
+ */
192
+ fb.mousemove = function (event) {
193
+ // Get coordinates relative to color picker center
194
+ var pos = fb.widgetCoords(event);
195
+
196
+ // Set new HSL parameters
197
+ if (fb.circleDrag) {
198
+ var hue = Math.atan2(pos.x, -pos.y) / 6.28;
199
+ if (hue < 0) hue += 1;
200
+ fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
201
+ }
202
+ else {
203
+ var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
204
+ var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
205
+ fb.setHSL([fb.hsl[0], sat, lum]);
206
+ }
207
+ return false;
208
+ }
209
+
210
+ /**
211
+ * Mouseup handler
212
+ */
213
+ fb.mouseup = function () {
214
+ // Uncapture mouse
215
+ jQuery(document).unbind('mousemove', fb.mousemove);
216
+ jQuery(document).unbind('mouseup', fb.mouseup);
217
+ document.dragging = false;
218
+ }
219
+
220
+ /**
221
+ * Update the markers and styles
222
+ */
223
+ fb.updateDisplay = function () {
224
+ // Markers
225
+ var angle = fb.hsl[0] * 6.28;
226
+ jQuery('.h-marker', e).css({
227
+ left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
228
+ top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
229
+ });
230
+
231
+ jQuery('.sl-marker', e).css({
232
+ left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
233
+ top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
234
+ });
235
+
236
+ // Saturation/Luminance gradient
237
+ jQuery('.color', e).css('backgroundColor', '#'+fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
238
+
239
+ // Linked elements or callback
240
+ if (typeof fb.callback == 'object') {
241
+ // Set background/foreground color
242
+ jQuery(fb.callback).css({
243
+ backgroundColor: '#'+fb.color,
244
+ color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
245
+ });
246
+
247
+ // Change linked value
248
+ jQuery(fb.callback).each(function() {
249
+ if (this.value && this.value != fb.color) {
250
+ this.value = fb.color;
251
+ }
252
+ });
253
+ }
254
+ else if (typeof fb.callback == 'function') {
255
+ fb.callback.call(fb, fb.color);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Get absolute position of element
261
+ */
262
+ fb.absolutePosition = function (el) {
263
+ var r = { x: el.offsetLeft, y: el.offsetTop };
264
+ // Resolve relative to offsetParent
265
+ if (el.offsetParent) {
266
+ var tmp = fb.absolutePosition(el.offsetParent);
267
+ r.x += tmp.x;
268
+ r.y += tmp.y;
269
+ }
270
+ return r;
271
+ };
272
+
273
+ /* Various color utility functions */
274
+ fb.pack = function (rgb) {
275
+ var r = Math.round(rgb[0] * 255);
276
+ var g = Math.round(rgb[1] * 255);
277
+ var b = Math.round(rgb[2] * 255);
278
+ return (r < 16 ? '0' : '') + r.toString(16) +
279
+ (g < 16 ? '0' : '') + g.toString(16) +
280
+ (b < 16 ? '0' : '') + b.toString(16);
281
+ }
282
+
283
+ fb.unpack = function (color) {
284
+ if (color.length == 6) {
285
+ return [parseInt('0x' + color.substring(0, 2)) / 255,
286
+ parseInt('0x' + color.substring(2, 4)) / 255,
287
+ parseInt('0x' + color.substring(4, 6)) / 255];
288
+ }
289
+ else if (color.length == 3) {
290
+ return [parseInt('0x' + color.substring(0, 1)) / 15,
291
+ parseInt('0x' + color.substring(1, 2)) / 15,
292
+ parseInt('0x' + color.substring(2, 3)) / 15];
293
+ }
294
+ }
295
+
296
+ fb.HSLToRGB = function (hsl) {
297
+ var m1, m2, r, g, b;
298
+ var h = hsl[0], s = hsl[1], l = hsl[2];
299
+ m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
300
+ m1 = l * 2 - m2;
301
+ return [this.hueToRGB(m1, m2, h+0.33333),
302
+ this.hueToRGB(m1, m2, h),
303
+ this.hueToRGB(m1, m2, h-0.33333)];
304
+ }
305
+
306
+ fb.hueToRGB = function (m1, m2, h) {
307
+ h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
308
+ if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
309
+ if (h * 2 < 1) return m2;
310
+ if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
311
+ return m1;
312
+ }
313
+
314
+ fb.RGBToHSL = function (rgb) {
315
+ var min, max, delta, h, s, l;
316
+ var r = rgb[0], g = rgb[1], b = rgb[2];
317
+ min = Math.min(r, Math.min(g, b));
318
+ max = Math.max(r, Math.max(g, b));
319
+ delta = max - min;
320
+ l = (min + max) / 2;
321
+ s = 0;
322
+ if (l > 0 && l < 1) {
323
+ s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
324
+ }
325
+ h = 0;
326
+ if (delta > 0) {
327
+ if (max == r && max != g) h += (g - b) / delta;
328
+ if (max == g && max != b) h += (2 + (b - r) / delta);
329
+ if (max == b && max != r) h += (4 + (r - g) / delta);
330
+ h /= 6;
331
+ }
332
+ return [h, s, l];
333
+ }
334
+
335
+ // Install mousedown handler (the others are set on the document on-demand)
336
+ jQuery('*', e).mousedown(fb.mousedown);
337
+
338
+ // Init color
339
+ fb.setColor('000000');
340
+
341
+ // Set linked elements/callback
342
+ if (callback) {
343
+ fb.linkTo(callback);
344
+ }
345
+ }
admin/js/flag.ajax.js ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Ajax Plugin for Flash Album Gallery
3
+ */
4
+ (function($) {
5
+ flagAjax = {
6
+ settings: {
7
+ url: flagAjaxSetup.url,
8
+ type: "POST",
9
+ action: flagAjaxSetup.action,
10
+ operation : flagAjaxSetup.operation,
11
+ nonce: flagAjaxSetup.nonce,
12
+ ids: flagAjaxSetup.ids,
13
+ permission: flagAjaxSetup.permission,
14
+ error: flagAjaxSetup.error,
15
+ failure: flagAjaxSetup.failure,
16
+ timeout: 10000
17
+ },
18
+
19
+ run: function( index ) {
20
+ s = this.settings;
21
+ var req = $.ajax({
22
+ type: "POST",
23
+ url: s.url,
24
+ data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
25
+ cache: false,
26
+ timeout: 10000,
27
+ success: function(msg){
28
+ switch ( parseInt(msg) ) {
29
+ case -1:
30
+ flagProgressBar.addNote( flagAjax.settings.permission );
31
+ break;
32
+ case 0:
33
+ flagProgressBar.addNote( flagAjax.settings.error );
34
+ break;
35
+ case 1:
36
+ // show nothing, its better
37
+ break;
38
+ default:
39
+ // Return the message
40
+ flagProgressBar.addNote( "<strong>ID " + flagAjax.settings.ids[index] + ":</strong> " + flagAjax.settings.failure, msg );
41
+ break;
42
+ }
43
+
44
+ },
45
+ error: function (msg) {
46
+ flagProgressBar.addNote( "<strong>ID " + flagAjax.settings.ids[index] + ":</strong> " + flagAjax.settings.failure, msg.responseText );
47
+ },
48
+ complete: function () {
49
+ index++;
50
+ flagProgressBar.increase( index );
51
+ // parse the whole array
52
+ if (index < flagAjax.settings.ids.length)
53
+ flagAjax.run( index );
54
+ else
55
+ flagProgressBar.finished();
56
+ }
57
+ });
58
+ },
59
+
60
+ readIDs: function( index ) {
61
+ s = this.settings;
62
+ var req = $.ajax({
63
+ type: "POST",
64
+ url: s.url,
65
+ data:"action=" + s.action + "&operation=" + s.operation + "&_wpnonce=" + s.nonce + "&image=" + s.ids[index],
66
+ dataType: "json",
67
+ cache: false,
68
+ timeout: 10000,
69
+ success: function(msg){
70
+ // join the array
71
+ imageIDS = imageIDS.concat(msg);
72
+ },
73
+ error: function (msg) {
74
+ flagProgressBar.addNote( "<strong>ID " + flagAjax.settings.ids[index] + ":</strong> " + flagAjax.settings.failure, msg.responseText );
75
+ },
76
+ complete: function () {
77
+ index++;
78
+ flagProgressBar.increase( index );
79
+ // parse the whole array
80
+ if (index < flagAjax.settings.ids.length)
81
+ flagAjax.readIDs( index );
82
+ else {
83
+ // and now run the image operation
84
+ index = 0;
85
+ flagAjax.settings.ids = imageIDS;
86
+ flagAjax.settings.operation = nextOperation;
87
+ flagAjax.settings.maxStep = imageIDS.length;
88
+ flagProgressBar.init( flagAjax.settings );
89
+ flagAjax.run( index );
90
+ }
91
+ }
92
+ });
93
+ },
94
+
95
+ init: function( s ) {
96
+
97
+ var index = 0;
98
+
99
+ // get the settings
100
+ this.settings = $.extend( {}, this.settings, {}, s || {} );
101
+
102
+ // a gallery operation need first all image ids via ajax
103
+ if ( this.settings.operation.substring(0, 8) == 'gallery_' ) {
104
+ nextOperation = this.settings.operation.substring(8);
105
+ //first run, get all the ids
106
+ this.settings.operation = 'get_image_ids';
107
+ imageIDS = new Array();
108
+ this.readIDs( index );
109
+ } else {
110
+ // start the ajax process
111
+ this.run( index );
112
+ }
113
+ }
114
+ }
115
+
116
+ }(jQuery));
admin/js/flag.progressbar.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Progress bar Plugin for FlashGen gallery
3
+ * Version: 1.0.0
4
+ * Author : Sergey Pasyuk
5
+ */
6
+ (function($) {
7
+ flagProgressBar = {
8
+
9
+ settings: {
10
+ id: 'progressbar',
11
+ maxStep: 100,
12
+ wait: false,
13
+ header: ''
14
+ },
15
+
16
+ init: function( s ) {
17
+
18
+ s = this.settings = $.extend( {}, this.settings, {}, s || {} );
19
+
20
+ div = $('#' + s.id + '_container');
21
+ width = Math.round( ( 100 / s.maxStep ) * 100 ) /100;
22
+
23
+ if ( div.find("#" + s.id).length == 0) {
24
+ if (s.header.length > 0)
25
+ div.append('<h2>'+ s.header +'</h2>');
26
+ div.append('<div id="' + s.id + '" class="progressborder"><div class="' + s.id + '"><span>0%</span></div></div>');
27
+ }
28
+ },
29
+
30
+ addMessage: function( message ) {
31
+ s = this.settings;
32
+ if ( div.find("#" + s.id + "_message").length == 0)
33
+ div.append('<div class="' + s.id + '_message"><span style="display:block" id="' + s.id + '_message">' + message + '</span></div>');
34
+ else
35
+ $("#" + s.id + "_message").html( message );
36
+ },
37
+
38
+ addNote: function( note, detail ) {
39
+ s = this.settings;
40
+ s.wait = true;
41
+ if ( div.find("#" + s.id + "_note").length == 0)
42
+ div.append('<ul id="' + s.id + '_note">&nbsp;</ul>');
43
+
44
+ if (detail)
45
+ $("#" + s.id + "_note").append("<li>" + note + "<div class='show_details'><span>[more]</span><br />" + detail + "</div></li>");
46
+ else
47
+ $("#" + s.id + "_note").append("<li>" + note + "</li>");
48
+ },
49
+
50
+ increase: function( step ) {
51
+ s = this.settings;
52
+ var value = step * width + "%";
53
+ var rvalue = Math.round (step * width) + "%" ;
54
+ $("#" + s.id + " div").width( value );
55
+ $("#" + s.id + " span").html( rvalue );
56
+ },
57
+
58
+ finished: function() {
59
+ s = this.settings;
60
+ $("#" + s.id + " div").width( '100%' );
61
+ $("#" + s.id + " span").html( '100%' );
62
+ // in the case we add a note , we should wait for a click
63
+ if (s.wait) {
64
+ setTimeout(function() {
65
+ $("#" + s.id).hide("slow");
66
+ }, 2000);
67
+ div.click(function () {
68
+ jQuery('.flagform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"0\">");
69
+ jQuery('.flagform').submit();
70
+ });
71
+ } else {
72
+ //div.hide("slow");
73
+ jQuery("#" + s.id).hide("slow");
74
+ jQuery("#" + s.id + "_container h2").hide("slow");
75
+ jQuery('.flagform').prepend("<input type=\"hidden\" name=\"ajax_callback\" value=\"1\">");
76
+ jQuery('.flagform').submit();
77
+ }
78
+ }
79
+ };
80
+ })(jQuery);
admin/js/flagscroll.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('div.flashalbum').bind("mouseenter",function(){
3
+ var obj_id = jQuery('object, embed',this).attr('id');
4
+ var flash = flagFind(obj_id);
5
+ if(flash && jQuery.isFunction(flash[obj_id])) {
6
+ flash[obj_id]("false");
7
+ console.log(flash[obj_id]);
8
+ }
9
+ }).bind("mouseleave",function(){
10
+ var obj_id = jQuery('object, embed',this).attr('id');
11
+ var flash = flagFind(obj_id);
12
+ if(flash && jQuery.isFunction(flash[obj_id])) {
13
+ flash[obj_id]("true");
14
+ console.log(flash[obj_id]);
15
+ }
16
+ });
17
+ });
18
+
19
+ function flagFind(flagName){
20
+ if (window.document[flagName]){
21
+ return window.document[flagName];
22
+ }
23
+ if (navigator.appName.indexOf("Microsoft Internet")==-1){
24
+ if (document.embeds && document.embeds[flagName])
25
+ return document.embeds[flagName];
26
+ }
27
+ if (document.getElementById(flagName)){
28
+ return document.getElementById(flagName);
29
+ }
30
+ else {
31
+ return false;
32
+ }
33
+ }
admin/js/images/arrows.png ADDED
Binary file
admin/js/images/blank.gif ADDED
Binary file
admin/js/images/bullets.png ADDED
Binary file
admin/js/images/fancy_close.png ADDED
Binary file
admin/js/images/fancy_loading.png ADDED
Binary file
admin/js/images/fancy_nav_left.png ADDED
Binary file
admin/js/images/fancy_nav_right.png ADDED
Binary file
admin/js/images/fancy_nav_slide.png ADDED
Binary file
admin/js/images/fancy_shadow_e.png ADDED
Binary file
admin/js/images/fancy_shadow_n.png ADDED
Binary file
admin/js/images/fancy_shadow_ne.png ADDED
Binary file
admin/js/images/fancy_shadow_nw.png ADDED
Binary file
admin/js/images/fancy_shadow_s.png ADDED
Binary file
admin/js/images/fancy_shadow_se.png ADDED
Binary file
admin/js/images/fancy_shadow_sw.png ADDED
Binary file
admin/js/images/fancy_shadow_w.png ADDED
Binary file
admin/js/images/fancy_title_left.png ADDED
Binary file
admin/js/images/fancy_title_main.png ADDED
Binary file
admin/js/images/fancy_title_over.png ADDED
Binary file
admin/js/images/fancy_title_right.png ADDED
Binary file
admin/js/images/fancybox-x.png ADDED
Binary file
admin/js/images/fancybox-y.png ADDED
Binary file
admin/js/images/fancybox.png ADDED
Binary file
admin/js/images/loading.gif ADDED
Binary file
admin/js/jquery.MultiFile.js ADDED
@@ -0,0 +1,535 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ### jQuery Multiple File Upload Plugin v1.46 - 2009-05-12 ###
3
+ * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
+ * Code: http://code.google.com/p/jquery-multifile-plugin/
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ ###
10
+ */
11
+
12
+ /*# AVOID COLLISIONS #*/
13
+ ;if(window.jQuery) (function($){
14
+ /*# AVOID COLLISIONS #*/
15
+
16
+ // plugin initialization
17
+ $.fn.MultiFile = function(options){
18
+ if(this.length==0) return this; // quick fail
19
+
20
+ // Handle API methods
21
+ if(typeof arguments[0]=='string'){
22
+ // Perform API methods on individual elements
23
+ if(this.length>1){
24
+ var args = arguments;
25
+ return this.each(function(){
26
+ $.fn.MultiFile.apply($(this), args);
27
+ });
28
+ };
29
+ // Invoke API method handler
30
+ $.fn.MultiFile[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
31
+ // Quick exit...
32
+ return this;
33
+ };
34
+
35
+ // Initialize options for this call
36
+ var options = $.extend(
37
+ {}/* new object */,
38
+ $.fn.MultiFile.options/* default options */,
39
+ options || {} /* just-in-time options */
40
+ );
41
+
42
+ // Empty Element Fix!!!
43
+ // this code will automatically intercept native form submissions
44
+ // and disable empty file elements
45
+ $('form')
46
+ .not('MultiFile-intercepted')
47
+ .addClass('MultiFile-intercepted')
48
+ .submit($.fn.MultiFile.disableEmpty);
49
+
50
+ //### http://plugins.jquery.com/node/1363
51
+ // utility method to integrate this plugin with others...
52
+ if($.fn.MultiFile.options.autoIntercept){
53
+ $.fn.MultiFile.intercept( $.fn.MultiFile.options.autoIntercept /* array of methods to intercept */ );
54
+ $.fn.MultiFile.options.autoIntercept = null; /* only run this once */
55
+ };
56
+
57
+ // loop through each matched element
58
+ this
59
+ .not('.MultiFile-applied')
60
+ .addClass('MultiFile-applied')
61
+ .each(function(){
62
+ //#####################################################################
63
+ // MAIN PLUGIN FUNCTIONALITY - START
64
+ //#####################################################################
65
+
66
+ // BUG 1251 FIX: http://plugins.jquery.com/project/comments/add/1251
67
+ // variable group_count would repeat itself on multiple calls to the plugin.
68
+ // this would cause a conflict with multiple elements
69
+ // changes scope of variable to global so id will be unique over n calls
70
+ window.MultiFile = (window.MultiFile || 0) + 1;
71
+ var group_count = window.MultiFile;
72
+
73
+ // Copy parent attributes - Thanks to Jonas Wagner
74
+ // we will use this one to create new input elements
75
+ var MultiFile = {e:this, E:$(this), clone:$(this).clone()};
76
+
77
+ //===
78
+
79
+ //# USE CONFIGURATION
80
+ if(typeof options=='number') options = {max:options};
81
+ var o = $.extend({},
82
+ $.fn.MultiFile.options,
83
+ options || {},
84
+ ($.metadata? MultiFile.E.metadata(): ($.meta?MultiFile.E.data():null)) || {}, /* metadata options */
85
+ {} /* internals */
86
+ );
87
+ // limit number of files that can be selected?
88
+ if(!(o.max>0) /*IsNull(MultiFile.max)*/){
89
+ o.max = MultiFile.E.attr('maxlength');
90
+ if(!(o.max>0) /*IsNull(MultiFile.max)*/){
91
+ o.max = (String(MultiFile.e.className.match(/\b(max|limit)\-([0-9]+)\b/gi) || ['']).match(/[0-9]+/gi) || [''])[0];
92
+ if(!(o.max>0)) o.max = -1;
93
+ else o.max = String(o.max).match(/[0-9]+/gi)[0];
94
+ }
95
+ };
96
+ o.max = new Number(o.max);
97
+ // limit extensions?
98
+ o.accept = o.accept || MultiFile.E.attr('accept') || '';
99
+ if(!o.accept){
100
+ o.accept = (MultiFile.e.className.match(/\b(accept\-[\w\|]+)\b/gi)) || '';
101
+ o.accept = new String(o.accept).replace(/^(accept|ext)\-/i,'');
102
+ };
103
+
104
+ //===
105
+
106
+ // APPLY CONFIGURATION
107
+ $.extend(MultiFile, o || {});
108
+ MultiFile.STRING = $.extend({},$.fn.MultiFile.options.STRING,MultiFile.STRING);
109
+
110
+ //===
111
+
112
+ //#########################################
113
+ // PRIVATE PROPERTIES/METHODS
114
+ $.extend(MultiFile, {
115
+ n: 0, // How many elements are currently selected?
116
+ slaves: [], files: [],
117
+ instanceKey: MultiFile.e.id || 'MultiFile'+String(group_count), // Instance Key?
118
+ generateID: function(z){ return MultiFile.instanceKey + (z>0 ?'_F'+String(z):''); },
119
+ trigger: function(event, element){
120
+ var handler = MultiFile[event], value = $(element).attr('value');
121
+ if(handler){
122
+ var returnValue = handler(element, value, MultiFile);
123
+ if( returnValue!=null ) return returnValue;
124
+ }
125
+ return true;
126
+ }
127
+ });
128
+
129
+ //===
130
+
131
+ // Setup dynamic regular expression for extension validation
132
+ // - thanks to John-Paul Bader: http://smyck.de/2006/08/11/javascript-dynamic-regular-expresions/
133
+ if(String(MultiFile.accept).length>1){
134
+ MultiFile.accept = MultiFile.accept.replace(/\W+/g,'|').replace(/^\W|\W$/g,'');
135
+ MultiFile.rxAccept = new RegExp('\\.('+(MultiFile.accept?MultiFile.accept:'')+')$','gi');
136
+ };
137
+
138
+ //===
139
+
140
+ // Create wrapper to hold our file list
141
+ MultiFile.wrapID = MultiFile.instanceKey+'_wrap'; // Wrapper ID?
142
+ MultiFile.E.wrap('<div class="MultiFile-wrap" id="'+MultiFile.wrapID+'"></div>');
143
+ MultiFile.wrapper = $('#'+MultiFile.wrapID+'');
144
+
145
+ //===
146
+
147
+ // MultiFile MUST have a name - default: file1[], file2[], file3[]
148
+ MultiFile.e.name = MultiFile.e.name || 'file'+ group_count +'[]';
149
+
150
+ //===
151
+
152
+ if(!MultiFile.list){
153
+ // Create a wrapper for the list
154
+ // * OPERA BUG: NO_MODIFICATION_ALLOWED_ERR ('list' is a read-only property)
155
+ // this change allows us to keep the files in the order they were selected
156
+ MultiFile.wrapper.append( '<div class="MultiFile-list" id="'+MultiFile.wrapID+'_list"></div>' );
157
+ MultiFile.list = $('#'+MultiFile.wrapID+'_list');
158
+ };
159
+ MultiFile.list = $(MultiFile.list);
160
+
161
+ //===
162
+
163
+ // Bind a new element
164
+ MultiFile.addSlave = function( slave, slave_count ){
165
+ //if(window.console) console.log('MultiFile.addSlave',slave_count);
166
+
167
+ // Keep track of how many elements have been displayed
168
+ MultiFile.n++;
169
+ // Add reference to master element
170
+ slave.MultiFile = MultiFile;
171
+
172
+ // BUG FIX: http://plugins.jquery.com/node/1495
173
+ // Clear identifying properties from clones
174
+ if(slave_count>0) slave.id = slave.name = '';
175
+
176
+ // Define element's ID and name (upload components need this!)
177
+ //slave.id = slave.id || MultiFile.generateID(slave_count);
178
+ if(slave_count>0) slave.id = MultiFile.generateID(slave_count);
179
+ //FIX for: http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=23
180
+
181
+ // 2008-Apr-29: New customizable naming convention (see url below)
182
+ // http://groups.google.com/group/jquery-dev/browse_frm/thread/765c73e41b34f924#
183
+ slave.name = String(MultiFile.namePattern
184
+ /*master name*/.replace(/\$name/gi,$(MultiFile.clone).attr('name'))
185
+ /*master id */.replace(/\$id/gi, $(MultiFile.clone).attr('id'))
186
+ /*group count*/.replace(/\$g/gi, group_count)//(group_count>0?group_count:''))
187
+ /*slave count*/.replace(/\$i/gi, slave_count)//(slave_count>0?slave_count:''))
188
+ );
189
+
190
+ // If we've reached maximum number, disable input slave
191
+ if( (MultiFile.max > 0) && ((MultiFile.n-1) > (MultiFile.max)) )//{ // MultiFile.n Starts at 1, so subtract 1 to find true count
192
+ slave.disabled = true;
193
+ //};
194
+
195
+ // Remember most recent slave
196
+ MultiFile.current = MultiFile.slaves[slave_count] = slave;
197
+
198
+ // We'll use jQuery from now on
199
+ slave = $(slave);
200
+
201
+ // Clear value
202
+ slave.val('').attr('value','')[0].value = '';
203
+
204
+ // Stop plugin initializing on slaves
205
+ slave.addClass('MultiFile-applied');
206
+
207
+ // Triggered when a file is selected
208
+ slave.change(function(){
209
+ //if(window.console) console.log('MultiFile.slave.change',slave_count);
210
+
211
+ // Lose focus to stop IE7 firing onchange again
212
+ $(this).blur();
213
+
214
+ //# Trigger Event! onFileSelect
215
+ if(!MultiFile.trigger('onFileSelect', this, MultiFile)) return false;
216
+ //# End Event!
217
+
218
+ //# Retrive value of selected file from element
219
+ var ERROR = '', v = String(this.value || ''/*.attr('value)*/);
220
+
221
+ // check extension
222
+ if(MultiFile.accept && v && !v.match(MultiFile.rxAccept))//{
223
+ ERROR = MultiFile.STRING.denied.replace('$ext', String(v.match(/\.\w{1,4}$/gi)));
224
+ //}
225
+ //};
226
+
227
+ // Disallow duplicates
228
+ for(var f in MultiFile.slaves)//{
229
+ if(MultiFile.slaves[f] && MultiFile.slaves[f]!=this)//{
230
+ //console.log(MultiFile.slaves[f],MultiFile.slaves[f].value);
231
+ if(MultiFile.slaves[f].value==v)//{
232
+ ERROR = MultiFile.STRING.duplicate.replace('$file', v.match(/[^\/\\]+$/gi));
233
+ //};
234
+ //};
235
+ //};
236
+
237
+ // Create a new file input element
238
+ var newEle = $(MultiFile.clone).clone();// Copy parent attributes - Thanks to Jonas Wagner
239
+ //# Let's remember which input we've generated so
240
+ // we can disable the empty ones before submission
241
+ // See: http://plugins.jquery.com/node/1495
242
+ newEle.addClass('MultiFile');
243
+
244
+ // Handle error
245
+ if(ERROR!=''){
246
+ // Handle error
247
+ MultiFile.error(ERROR);
248
+
249
+ // 2007-06-24: BUG FIX - Thanks to Adrian Wr�bel <adrian [dot] wrobel [at] gmail.com>
250
+ // Ditch the trouble maker and add a fresh new element
251
+ MultiFile.n--;
252
+ MultiFile.addSlave(newEle[0], slave_count);
253
+ slave.parent().prepend(newEle);
254
+ slave.remove();
255
+ return false;
256
+ };
257
+
258
+ // Hide this element (NB: display:none is evil!)
259
+ $(this).css({ position:'absolute', top: '-3000px' });
260
+
261
+ // Add new element to the form
262
+ slave.after(newEle);
263
+
264
+ // Update list
265
+ MultiFile.addToList( this, slave_count );
266
+
267
+ // Bind functionality
268
+ MultiFile.addSlave( newEle[0], slave_count+1 );
269
+
270
+ //# Trigger Event! afterFileSelect
271
+ if(!MultiFile.trigger('afterFileSelect', this, MultiFile)) return false;
272
+ //# End Event!
273
+
274
+ }); // slave.change()
275
+
276
+ // Save control to element
277
+ $(slave).data('MultiFile', MultiFile);
278
+
279
+ };// MultiFile.addSlave
280
+ // Bind a new element
281
+
282
+
283
+
284
+ // Add a new file to the list
285
+ MultiFile.addToList = function( slave, slave_count ){
286
+ //if(window.console) console.log('MultiFile.addToList',slave_count);
287
+
288
+ //# Trigger Event! onFileAppend
289
+ if(!MultiFile.trigger('onFileAppend', slave, MultiFile)) return false;
290
+ //# End Event!
291
+
292
+ // Create label elements
293
+ var
294
+ r = $('<div class="MultiFile-label"></div>'),
295
+ v = String(slave.value || ''/*.attr('value)*/),
296
+ a = $('<span class="MultiFile-title" title="'+MultiFile.STRING.selected.replace('$file', v)+'">'+MultiFile.STRING.file.replace('$file', v.match(/[^\/\\]+$/gi)[0])+'</span>'),
297
+ b = $('<a class="MultiFile-remove" href="#'+MultiFile.wrapID+'">'+MultiFile.STRING.remove+'</a>');
298
+
299
+ // Insert label
300
+ MultiFile.list.append(
301
+ r.append(b, ' ', a)
302
+ );
303
+
304
+ b
305
+ .click(function(){
306
+
307
+ //# Trigger Event! onFileRemove
308
+ if(!MultiFile.trigger('onFileRemove', slave, MultiFile)) return false;
309
+ //# End Event!
310
+
311
+ MultiFile.n--;
312
+ MultiFile.current.disabled = false;
313
+
314
+ // Remove element, remove label, point to current
315
+ MultiFile.slaves[slave_count] = null;
316
+ $(slave).remove();
317
+ $(this).parent().remove();
318
+
319
+ // Show most current element again (move into view) and clear selection
320
+ $(MultiFile.current).css({ position:'', top: '' });
321
+ $(MultiFile.current).reset().val('').attr('value', '')[0].value = '';
322
+
323
+ //# Trigger Event! afterFileRemove
324
+ if(!MultiFile.trigger('afterFileRemove', slave, MultiFile)) return false;
325
+ //# End Event!
326
+
327
+ return false;
328
+ });
329
+
330
+ //# Trigger Event! afterFileAppend
331
+ if(!MultiFile.trigger('afterFileAppend', slave, MultiFile)) return false;
332
+ //# End Event!
333
+
334
+ }; // MultiFile.addToList
335
+ // Add element to selected files list
336
+
337
+
338
+
339
+ // Bind functionality to the first element
340
+ if(!MultiFile.MultiFile) MultiFile.addSlave(MultiFile.e, 0);
341
+
342
+ // Increment control count
343
+ //MultiFile.I++; // using window.MultiFile
344
+ MultiFile.n++;
345
+
346
+ // Save control to element
347
+ MultiFile.E.data('MultiFile', MultiFile);
348
+
349
+
350
+ //#####################################################################
351
+ // MAIN PLUGIN FUNCTIONALITY - END
352
+ //#####################################################################
353
+ }); // each element
354
+ };
355
+
356
+ /*--------------------------------------------------------*/
357
+
358
+ /*
359
+ ### Core functionality and API ###
360
+ */
361
+ $.extend($.fn.MultiFile, {
362
+ /**
363
+ * This method removes all selected files
364
+ *
365
+ * Returns a jQuery collection of all affected elements.
366
+ *
367
+ * @name reset
368
+ * @type jQuery
369
+ * @cat Plugins/MultiFile
370
+ * @author Diego A. (http://www.fyneworks.com/)
371
+ *
372
+ * @example $.fn.MultiFile.reset();
373
+ */
374
+ reset: function(){
375
+ var settings = $(this).data('MultiFile');
376
+ //if(settings) settings.wrapper.find('a.MultiFile-remove').click();
377
+ if(settings) settings.list.find('a.MultiFile-remove').click();
378
+ return $(this);
379
+ },
380
+
381
+
382
+ /**
383
+ * This utility makes it easy to disable all 'empty' file elements in the document before submitting a form.
384
+ * It marks the affected elements so they can be easily re-enabled after the form submission or validation.
385
+ *
386
+ * Returns a jQuery collection of all affected elements.
387
+ *
388
+ * @name disableEmpty
389
+ * @type jQuery
390
+ * @cat Plugins/MultiFile
391
+ * @author Diego A. (http://www.fyneworks.com/)
392
+ *
393
+ * @example $.fn.MultiFile.disableEmpty();
394
+ * @param String class (optional) A string specifying a class to be applied to all affected elements - Default: 'mfD'.
395
+ */
396
+ disableEmpty: function(klass){ klass = (typeof(klass)=='string'?klass:'')||'mfD';
397
+ var o = [];
398
+ $('input:file.MultiFile').each(function(){ if($(this).val()=='') o[o.length] = this; });
399
+ return $(o).each(function(){ this.disabled = true }).addClass(klass);
400
+ },
401
+
402
+
403
+ /**
404
+ * This method re-enables 'empty' file elements that were disabled (and marked) with the $.fn.MultiFile.disableEmpty method.
405
+ *
406
+ * Returns a jQuery collection of all affected elements.
407
+ *
408
+ * @name reEnableEmpty
409
+ * @type jQuery
410
+ * @cat Plugins/MultiFile
411
+ * @author Diego A. (http://www.fyneworks.com/)
412
+ *
413
+ * @example $.fn.MultiFile.reEnableEmpty();
414
+ * @param String klass (optional) A string specifying the class that was used to mark affected elements - Default: 'mfD'.
415
+ */
416
+ reEnableEmpty: function(klass){ klass = (typeof(klass)=='string'?klass:'')||'mfD';
417
+ return $('input:file.'+klass).removeClass(klass).each(function(){ this.disabled = false });
418
+ },
419
+
420
+
421
+ /**
422
+ * This method will intercept other jQuery plugins and disable empty file input elements prior to form submission
423
+ *
424
+
425
+ * @name intercept
426
+ * @cat Plugins/MultiFile
427
+ * @author Diego A. (http://www.fyneworks.com/)
428
+ *
429
+ * @example $.fn.MultiFile.intercept();
430
+ * @param Array methods (optional) Array of method names to be intercepted
431
+ */
432
+ intercepted: {},
433
+ intercept: function(methods, context, args){
434
+ var method, value; args = args || [];
435
+ if(args.constructor.toString().indexOf("Array")<0) args = [ args ];
436
+ if(typeof(methods)=='function'){
437
+ $.fn.MultiFile.disableEmpty();
438
+ value = methods.apply(context || window, args);
439
+ //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27
440
+ setTimeout(function(){ $.fn.MultiFile.reEnableEmpty() },1000);
441
+ return value;
442
+ };
443
+ if(methods.constructor.toString().indexOf("Array")<0) methods = [methods];
444
+ for(var i=0;i<methods.length;i++){
445
+ method = methods[i]+''; // make sure that we have a STRING
446
+ if(method) (function(method){ // make sure that method is ISOLATED for the interception
447
+ $.fn.MultiFile.intercepted[method] = $.fn[method] || function(){};
448
+ $.fn[method] = function(){
449
+ $.fn.MultiFile.disableEmpty();
450
+ value = $.fn.MultiFile.intercepted[method].apply(this, arguments);
451
+ //SEE-http://code.google.com/p/jquery-multifile-plugin/issues/detail?id=27
452
+ setTimeout(function(){ $.fn.MultiFile.reEnableEmpty() },1000);
453
+ return value;
454
+ }; // interception
455
+ })(method); // MAKE SURE THAT method IS ISOLATED for the interception
456
+ };// for each method
457
+ }
458
+ });
459
+
460
+ /*--------------------------------------------------------*/
461
+
462
+ /*
463
+ ### Default Settings ###
464
+ eg.: You can override default control like this:
465
+ $.fn.MultiFile.options.accept = 'gif|jpg';
466
+ */
467
+ $.fn.MultiFile.options = { //$.extend($.fn.MultiFile, { options: {
468
+ accept: '', // accepted file extensions
469
+ max: -1, // maximum number of selectable files
470
+
471
+ // name to use for newly created elements
472
+ namePattern: '$name', // same name by default (which creates an array)
473
+
474
+ // STRING: collection lets you show messages in different languages
475
+ STRING: {
476
+ remove:'x',
477
+ denied:'You cannot select a $ext file.\nTry again...',
478
+ file:'$file',
479
+ selected:'File selected: $file',
480
+ duplicate:'This file has already been selected:\n$file'
481
+ },
482
+
483
+ // name of methods that should be automcatically intercepted so the plugin can disable
484
+ // extra file elements that are empty before execution and automatically re-enable them afterwards
485
+ autoIntercept: [ 'submit', 'ajaxSubmit', 'ajaxForm', 'validate' /* array of methods to intercept */ ],
486
+
487
+ // error handling function
488
+ error: function(s){
489
+ /*
490
+ ERROR! blockUI is not currently working in IE
491
+ if($.blockUI){
492
+ $.blockUI({
493
+ message: s.replace(/\n/gi,'<br/>'),
494
+ css: {
495
+ border:'none', padding:'15px', size:'12.0pt',
496
+ backgroundColor:'#900', color:'#fff',
497
+ opacity:'.8','-webkit-border-radius': '10px','-moz-border-radius': '10px'
498
+ }
499
+ });
500
+ window.setTimeout($.unblockUI, 2000);
501
+ }
502
+ else//{// save a byte!
503
+ */
504
+ alert(s);
505
+ //}// save a byte!
506
+ }
507
+ }; //} });
508
+
509
+ /*--------------------------------------------------------*/
510
+
511
+ /*
512
+ ### Additional Methods ###
513
+ Required functionality outside the plugin's scope
514
+ */
515
+
516
+ // Native input reset method - because this alone doesn't always work: $(element).val('').attr('value', '')[0].value = '';
517
+ $.fn.reset = function(){ return this.each(function(){ try{ this.reset(); }catch(e){} }); };
518
+
519
+ /*--------------------------------------------------------*/
520
+
521
+ /*
522
+ ### Default implementation ###
523
+ The plugin will attach itself to file inputs
524
+ with the class 'multi' when the page loads
525
+ */
526
+ $(function(){
527
+ //$("input:file.multi").MultiFile();
528
+ $("input[type=file].multi").MultiFile();
529
+ });
530
+
531
+
532
+
533
+ /*# AVOID COLLISIONS #*/
534
+ })(jQuery);
535
+ /*# AVOID COLLISIONS #*/
admin/js/jquery.MultiFile.pack.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ### jQuery Multiple File Upload Plugin v1.46 - 2009-05-12 ###
3
+ * Home: http://www.fyneworks.com/jquery/multiple-file-upload/
4
+ * Code: http://code.google.com/p/jquery-multifile-plugin/
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ ###
10
+ */
11
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(U.1u)(6($){$.7.2=6(h){3(5.V==0)8 5;3(T S[0]==\'19\'){3(5.V>1){m i=S;8 5.M(6(){$.7.2.13($(5),i)})};$.7.2[S[0]].13(5,$.1N(S).27(1)||[]);8 5};m h=$.N({},$.7.2.F,h||{});$(\'2d\').1B(\'2-R\').Q(\'2-R\').1n($.7.2.Z);3($.7.2.F.15){$.7.2.1M($.7.2.F.15);$.7.2.F.15=10};5.1B(\'.2-1e\').Q(\'2-1e\').M(6(){U.2=(U.2||0)+1;m e=U.2;m g={e:5,E:$(5),L:$(5).L()};3(T h==\'21\')h={l:h};m o=$.N({},$.7.2.F,h||{},($.1m?g.E.1m():($.1S?g.E.17():10))||{},{});3(!(o.l>0)){o.l=g.E.D(\'28\');3(!(o.l>0)){o.l=(u(g.e.1D.B(/\\b(l|23)\\-([0-9]+)\\b/q)||[\'\']).B(/[0-9]+/q)||[\'\'])[0];3(!(o.l>0))o.l=-1;2b o.l=u(o.l).B(/[0-9]+/q)[0]}};o.l=18 2f(o.l);o.j=o.j||g.E.D(\'j\')||\'\';3(!o.j){o.j=(g.e.1D.B(/\\b(j\\-[\\w\\|]+)\\b/q))||\'\';o.j=18 u(o.j).t(/^(j|1d)\\-/i,\'\')};$.N(g,o||{});g.A=$.N({},$.7.2.F.A,g.A);$.N(g,{n:0,J:[],2c:[],1c:g.e.I||\'2\'+u(e),1i:6(z){8 g.1c+(z>0?\'1Z\'+u(z):\'\')},G:6(a,b){m c=g[a],k=$(b).D(\'k\');3(c){m d=c(b,k,g);3(d!=10)8 d}8 1a}});3(u(g.j).V>1){g.j=g.j.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');g.1k=18 2t(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'q\')};g.O=g.1c+\'1P\';g.E.1l(\'<P X="2-1l" I="\'+g.O+\'"></P>\');g.1q=$(\'#\'+g.O+\'\');g.e.H=g.e.H||\'p\'+e+\'[]\';3(!g.K){g.1q.1g(\'<P X="2-K" I="\'+g.O+\'1F"></P>\');g.K=$(\'#\'+g.O+\'1F\')};g.K=$(g.K);g.16=6(c,d){g.n++;c.2=g;3(d>0)c.I=c.H=\'\';3(d>0)c.I=g.1i(d);c.H=u(g.1j.t(/\\$H/q,$(g.L).D(\'H\')).t(/\\$I/q,$(g.L).D(\'I\')).t(/\\$g/q,e).t(/\\$i/q,d));3((g.l>0)&&((g.n-1)>(g.l)))c.14=1a;g.Y=g.J[d]=c;c=$(c);c.1b(\'\').D(\'k\',\'\')[0].k=\'\';c.Q(\'2-1e\');c.1V(6(){$(5).1X();3(!g.G(\'1Y\',5,g))8 y;m a=\'\',v=u(5.k||\'\');3(g.j&&v&&!v.B(g.1k))a=g.A.1o.t(\'$1d\',u(v.B(/\\.\\w{1,4}$/q)));1p(m f 2a g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].k==v)a=g.A.1r.t(\'$p\',v.B(/[^\\/\\\\]+$/q));m b=$(g.L).L();b.Q(\'2\');3(a!=\'\'){g.1s(a);g.n--;g.16(b[0],d);c.1t().2e(b);c.C();8 y};$(5).1v({1w:\'1O\',1x:\'-1Q\'});c.1R(b);g.1y(5,d);g.16(b[0],d+1);3(!g.G(\'1T\',5,g))8 y});$(c).17(\'2\',g)};g.1y=6(c,d){3(!g.G(\'1U\',c,g))8 y;m r=$(\'<P X="2-1W"></P>\'),v=u(c.k||\'\'),a=$(\'<1z X="2-1A" 1A="\'+g.A.12.t(\'$p\',v)+\'">\'+g.A.p.t(\'$p\',v.B(/[^\\/\\\\]+$/q)[0])+\'</1z>\'),b=$(\'<a X="2-C" 2y="#\'+g.O+\'">\'+g.A.C+\'</a>\');g.K.1g(r.1g(b,\' \',a));b.1C(6(){3(!g.G(\'22\',c,g))8 y;g.n--;g.Y.14=y;g.J[d]=10;$(c).C();$(5).1t().C();$(g.Y).1v({1w:\'\',1x:\'\'});$(g.Y).11().1b(\'\').D(\'k\',\'\')[0].k=\'\';3(!g.G(\'24\',c,g))8 y;8 y});3(!g.G(\'25\',c,g))8 y};3(!g.2)g.16(g.e,0);g.n++;g.E.17(\'2\',g)})};$.N($.7.2,{11:6(){m a=$(5).17(\'2\');3(a)a.K.26(\'a.2-C\').1C();8 $(5)},Z:6(a){a=(T(a)==\'19\'?a:\'\')||\'1E\';m o=[];$(\'1h:p.2\').M(6(){3($(5).1b()==\'\')o[o.V]=5});8 $(o).M(6(){5.14=1a}).Q(a)},1f:6(a){a=(T(a)==\'19\'?a:\'\')||\'1E\';8 $(\'1h:p.\'+a).29(a).M(6(){5.14=y})},R:{},1M:6(b,c,d){m e,k;d=d||[];3(d.1G.1H().1I("1J")<0)d=[d];3(T(b)==\'6\'){$.7.2.Z();k=b.13(c||U,d);1K(6(){$.7.2.1f()},1L);8 k};3(b.1G.1H().1I("1J")<0)b=[b];1p(m i=0;i<b.V;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.R[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.Z();k=$.7.2.R[a].13(5,S);1K(6(){$.7.2.1f()},1L);8 k}})(e)}}});$.7.2.F={j:\'\',l:-1,1j:\'$H\',A:{C:\'x\',1o:\'2g 2h 2i a $1d p.\\2j 2k...\',p:\'$p\',12:\'2l 12: $p\',1r:\'2m p 2n 2o 2p 12:\\n$p\'},15:[\'1n\',\'2q\',\'2r\',\'2s\'],1s:6(s){2u(s)}};$.7.11=6(){8 5.M(6(){2v{5.11()}2w(e){}})};$(6(){$("1h[2x=p].20").2()})})(1u);',62,159,'||MultiFile|if||this|function|fn|return|||||||||||accept|value|max|var|||file|gi|||replace|String||||false||STRING|match|remove|attr||options|trigger|name|id|slaves|list|clone|each|extend|wrapID|div|addClass|intercepted|arguments|typeof|window|length||class|current|disableEmpty|null|reset|selected|apply|disabled|autoIntercept|addSlave|data|new|string|true|val|instanceKey|ext|applied|reEnableEmpty|append|input|generateID|namePattern|rxAccept|wrap|metadata|submit|denied|for|wrapper|duplicate|error|parent|jQuery|css|position|top|addToList|span|title|not|click|className|mfD|_list|constructor|toString|indexOf|Array|setTimeout|1000|intercept|makeArray|absolute|_wrap|3000px|after|meta|afterFileSelect|onFileAppend|change|label|blur|onFileSelect|_F|multi|number|onFileRemove|limit|afterFileRemove|afterFileAppend|find|slice|maxlength|removeClass|in|else|files|form|prepend|Number|You|cannot|select|nTry|again|File|This|has|already|been|ajaxSubmit|ajaxForm|validate|RegExp|alert|try|catch|type|href'.split('|'),0,{}))
admin/js/jquery.dataset.js ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// jquery.dataset v0.1.0 -- HTML5 dataset jQuery plugin
2
+ /// http://orangesoda.net/jquery.dataset.html
3
+
4
+ /// Copyright (c) 2009, Ben Weaver. All rights reserved.
5
+ /// This software is issued "as is" under a BSD license
6
+ /// <http://orangesoda.net/license.html>. All warrenties disclaimed.
7
+
8
+ /// The HTML5 specification allows elements to have custom data
9
+ /// attributes that are prefixed with `data-'. They may be
10
+ /// conveniently accessed through an element's `dataset' property.
11
+ /// This plugin provides similar functionality.
12
+ ///
13
+ /// The methods in the plugin are designed to be similar to the
14
+ /// built-in `attr' and `data' methods. All names are without the
15
+ /// `data-' prefix.
16
+ //
17
+ /// These methods are defined:
18
+ ///
19
+ /// dataset()
20
+ /// Return an object with all custom attribute (name, value) items.
21
+ ///
22
+ /// dataset(name)
23
+ /// Return the value of the attribute `data-NAME'.
24
+ ///
25
+ /// dataset(name, value)
26
+ /// Set the value of attribtue `data-NAME' to VALUE.
27
+ ///
28
+ /// dataset({...})
29
+ /// Set many custom attributes at once.
30
+ ///
31
+ /// removeDataset(name)
32
+ /// Remove the attribute `data-NAME'.
33
+ ///
34
+ /// removeDataset([n1, n2, ...])
35
+ /// Remove the attributes `data-N1', `data-N2', ...
36
+
37
+ (function($) {
38
+ var PREFIX = 'data-',
39
+ PATTERN = /^data\-(.*)$/;
40
+
41
+ function dataset(name, value) {
42
+ if (value !== undefined) {
43
+ // dataset(name, value): set the NAME attribute to VALUE.
44
+ return this.attr(PREFIX + name, value);
45
+ }
46
+
47
+ switch (typeof name) {
48
+ case 'string':
49
+ // dataset(name): get the value of the NAME attribute.
50
+ return this.attr(PREFIX + name);
51
+
52
+ case 'object':
53
+ // dataset(items): set the values of all (name, value) items.
54
+ return set_items.call(this, name);
55
+
56
+ case 'undefined':
57
+ // dataset(): return a mapping of (name, value) items for the
58
+ // first element.
59
+ return get_items.call(this);
60
+
61
+ default:
62
+ throw 'dataset: invalid argument ' + name;
63
+ }
64
+ }
65
+
66
+ function get_items() {
67
+ return this.foldAttr(function(index, attr, result) {
68
+ var match = PATTERN.exec(this.name);
69
+ if (match) result[match[1]] = this.value;
70
+ });
71
+ }
72
+
73
+ function set_items(items) {
74
+ for (var key in items) {
75
+ this.attr(PREFIX + key, items[key]);
76
+ }
77
+ return this;
78
+ }
79
+
80
+ function remove(name) {
81
+ if (typeof name == 'string') {
82
+ // Remove a single attribute;
83
+ return this.removeAttr(PREFIX + name);
84
+ }
85
+ return remove_names(name);
86
+ }
87
+
88
+ function remove_names(obj) {
89
+ var idx, length = obj && obj.length;
90
+
91
+ // For any object, remove attributes named by the keys.
92
+ if (length === undefined) {
93
+ for (idx in obj) {
94
+ this.removeAttr(PREFIX + idx);
95
+ }
96
+ }
97
+ // For an array, remove attributes named by the values.
98
+ else {
99
+ for (idx = 0; idx < length; idx++) {
100
+ this.removeAttr(PREFIX + obj[idx]);
101
+ }
102
+ }
103
+
104
+ return this;
105
+ }
106
+
107
+ $.fn.dataset = dataset;
108
+ $.fn.removeDataset = remove_names;
109
+
110
+ })(jQuery);
111
+
112
+ (function($) {
113
+
114
+ function each_attr(proc) {
115
+ if (this.length > 0) {
116
+ $.each(this[0].attributes, proc);
117
+ }
118
+ return this;
119
+ }
120
+
121
+ function fold_attr(proc, acc) {
122
+ return fold((this.length > 0) && this[0].attributes, proc, acc);
123
+ }
124
+
125
+ /*
126
+ * A left-fold operator. The behavior is the same as $.each(),
127
+ * but the callback is called with the accumulator as the third
128
+ * argument. The default accumulator is an empty object.
129
+ */
130
+ function fold(object, proc, acc) {
131
+ var length = object && object.length;
132
+
133
+ // The default accumulator is an empty object.
134
+ if (acc === undefined) acc = {};
135
+
136
+ // Returning an empty accumulator when OBJECT is "false"
137
+ // makes FOLD more composable.
138
+ if (!object) return acc;
139
+
140
+ // Check to see if OBJECT is an array.
141
+ if (length !== undefined) {
142
+ for (var i = 0, value = object[i];
143
+ (i < length) && (proc.call(value, i, value, acc) !== false);
144
+ value = object[++i])
145
+ { }
146
+ }
147
+ // Object is a map of (name, value) items.
148
+ else {
149
+ for (var name in object) {
150
+ if (proc.call(object[name], name, object[name], acc) === false) break;
151
+ }
152
+ }
153
+
154
+ return acc;
155
+ }
156
+
157
+ function fold_jquery(proc, acc) {
158
+ if (acc === undefined) acc = [];
159
+ return fold(this, proc, acc);
160
+ }
161
+
162
+ $.fn.eachAttr = each_attr;
163
+ $.fn.foldAttr = fold_attr;
164
+ $.fn.fold = fold_jquery;
165
+ $.fold = fold;
166
+
167
+ })(jQuery);
admin/js/jquery.easing-1.3.pack.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
+ *
4
+ * Uses the built in easing capabilities added In jQuery 1.1
5
+ * to offer multiple easing options
6
+ *
7
+ * TERMS OF USE - jQuery Easing
8
+ *
9
+ * Open source under the BSD License.
10
+ *
11
+ * Copyright © 2008 George McGinley Smith
12
+ * All rights reserved.
13
+ *
14
+ * Redistribution and use in source and binary forms, with or without modification,
15
+ * are permitted provided that the following conditions are met:
16
+ *
17
+ * Redistributions of source code must retain the above copyright notice, this list of
18
+ * conditions and the following disclaimer.
19
+ * Redistributions in binary form must reproduce the above copyright notice, this list
20
+ * of conditions and the following disclaimer in the documentation and/or other materials
21
+ * provided with the distribution.
22
+ *
23
+ * Neither the name of the author nor the names of contributors may be used to endorse
24
+ * or promote products derived from this software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
27
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ *
36
+ */
37
+
38
+ // t: current time, b: begInnIng value, c: change In value, d: duration
39
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))
40
+
41
+ /*
42
+ *
43
+ * TERMS OF USE - EASING EQUATIONS
44
+ *
45
+ * Open source under the BSD License.
46
+ *
47
+ * Copyright © 2001 Robert Penner
48
+ * All rights reserved.
49
+ *
50
+ * Redistribution and use in source and binary forms, with or without modification,
51
+ * are permitted provided that the following conditions are met:
52
+ *
53
+ * Redistributions of source code must retain the above copyright notice, this list of
54
+ * conditions and the following disclaimer.
55
+ * Redistributions in binary form must reproduce the above copyright notice, this list
56
+ * of conditions and the following disclaimer in the documentation and/or other materials
57
+ * provided with the distribution.
58
+ *
59
+ * Neither the name of the author nor the names of contributors may be used to endorse
60
+ * or promote products derived from this software without specific prior written permission.
61
+ *
62
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
63
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
64
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
65
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
66
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
67
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
68
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
69
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
71
+ *
72
+ */
admin/js/jquery.fancybox-1.3.4.css ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ #fancybox-loading { position: fixed; top: 50%; left: 50%; width: 40px; height: 40px; margin-top: -20px; margin-left: -20px; cursor: pointer; overflow: hidden; z-index: 10104; display: none; }
19
+ #fancybox-loading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background-image: url('images/fancybox.png'); }
20
+ #fancybox-overlay { position: absolute; top: 0; left: 0; width: 100%; z-index: 10100; display: none; }
21
+ #fancybox-tmp { padding: 0; margin: 0; border: 0; overflow: auto; display: none; }
22
+ #fancybox-wrap { position: absolute; top: 0; left: 0; padding: 20px; z-index: 10101; outline: none; display: none; }
23
+ #fancybox-outer { position: relative; width: 100%; height: 100%; background: #fff; }
24
+ #fancybox-content { width: 0; height: 0; padding: 0; outline: none; position: relative; overflow: hidden; z-index: 10102; border: 0px solid #fff; }
25
+ #fancybox-hide-sel-frame { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; z-index: 10101; }
26
+ #fancybox-close { position: absolute; top: -15px; right: -15px; width: 30px; height: 30px; background: transparent url('images/fancybox.png') -40px 0px; cursor: pointer; z-index: 10103; display: none; border: none; padding: 0; margin: 0; }
27
+ #fancybox-error { color: #444; font: normal 12px/20px Arial; padding: 14px; margin: 0; }
28
+ #fancybox-img { width: 100%; height: 100%; padding: 0; margin: 0; border: none; outline: none; line-height: 0; vertical-align: top; }
29
+ #fancybox-frame { width: 100%; height: 100%; border: none; display: block; }
30
+ #fancybox-left, #fancybox-right { position: absolute; bottom: 0px; height: 100%; width: 35%; cursor: pointer; outline: none; background: transparent url('images/blank.gif'); z-index: 10102; display: block; }
31
+ #fancybox-left { left: 0px; }
32
+ #fancybox-right { right: 0px; }
33
+ #fancybox-left-ico { position: absolute; top: 50%; right: auto; left: 20px; width: 30px; height: 30px; margin-top: -15px; cursor: pointer; z-index: 10102; display: block; }
34
+ #fancybox-right-ico { position: absolute; top: 50%; left: auto; right: 20px; width: 30px; height: 30px; margin-top: -15px; cursor: pointer; z-index: 10102; display: block; }
35
+ #fancybox-left-ico { background-image: url('images/fancybox.png'); background-position: -40px -30px; }
36
+ #fancybox-right-ico { background-image: url('images/fancybox.png'); background-position: -40px -60px; }
37
+ #fancybox-left:hover, #fancybox-right:hover { visibility: visible; /* IE6 */ }
38
+ #fancybox-left:hover span { left: 20px; }
39
+ #fancybox-right:hover span { left: auto; right: 20px; }
40
+ .fancybox-bg { position: absolute; padding: 0; margin: 0; border: 0; width: 20px; height: 20px; z-index: 10001; }
41
+ #fancybox-bg-n { top: -20px; left: 0; width: 100%; background-image: url('images/fancybox-x.png'); }
42
+ #fancybox-bg-ne { top: -20px; right: -20px; background-image: url('images/fancybox.png'); background-position: -40px -162px; }
43
+ #fancybox-bg-e { top: 0; right: -20px; height: 100%; background-image: url('images/fancybox-y.png'); background-position: -20px 0px; }
44
+ #fancybox-bg-se { bottom: -20px; right: -20px; background-image: url('images/fancybox.png'); background-position: -40px -182px; }
45
+ #fancybox-bg-s { bottom: -20px; left: 0; width: 100%; background-image: url('images/fancybox-x.png'); background-position: 0px -20px; }
46
+ #fancybox-bg-sw { bottom: -20px; left: -20px; background-image: url('images/fancybox.png'); background-position: -40px -142px; }
47
+ #fancybox-bg-w { top: 0; left: -20px; height: 100%; background-image: url('images/fancybox-y.png'); }
48
+ #fancybox-bg-nw { top: -20px; left: -20px; background-image: url('images/fancybox.png'); background-position: -40px -122px; }
49
+ #fancybox-title { font-family: Helvetica; font-size: 12px; z-index: 10102; }
50
+ .fancybox-title-inside { padding-bottom: 10px; text-align: center; color: #333; background: #fff; position: relative; }
51
+ .fancybox-title-outside { padding-top: 10px; color: #fff; }
52
+ .fancybox-title-over { position: absolute; bottom: 0; left: 0; color: #FFF; text-align: left; display: none; }
53
+ .grand .fancybox-title-over { top: 10px; }
54
+ #fancybox-title-over { padding: 10px; background-image: url('images/fancy_title_over.png'); display: block; }
55
+ .grand #fancybox-title-over { position: absolute; left: 0; bottom: 0; right: 0; }
56
+ .grand .grand_controls { position: absolute; right: 4px; top: -25px; }
57
+ .grand .grand_controls span { display: inline-block; width: 30px; height: 30px; margin-left: 0px; overflow: hidden; text-indent: -100em; cursor: pointer; }
58
+ .grand .grand_controls .g_prev { background: url('images/fancy_nav_left.png') 0 0 no-repeat; }
59
+ .grand .grand_controls .g_next { background: url('images/fancy_nav_right.png') 0 0 no-repeat; }
60
+ .grand .grand_controls .g_slideshow.play { background: url('images/fancy_nav_slide.png') -30px 0 no-repeat; }
61
+ .grand .grand_controls .g_slideshow.stop { background: url('images/fancy_nav_slide.png') 0px 0 no-repeat; }
62
+ .fancybox-title-float { position: absolute; left: 0; bottom: -20px; height: 32px; }
63
+ #fancybox-title-float-wrap { border: none; border-collapse: collapse; width: auto; }
64
+ #fancybox-title-float-wrap td { border: none; white-space: nowrap; }
65
+ #fancybox-title-float-left { padding: 0 0 0 15px; background: url('images/fancybox.png') -40px -90px no-repeat; }
66
+ #fancybox-title-float-main { color: #FFF; line-height: 29px; font-weight: bold; padding: 0 0 3px 0; background: url('images/fancybox-x.png') 0px -40px; }
67
+ #fancybox-title-float-right { padding: 0 0 0 15px; background: url('images/fancybox.png') -55px -90px no-repeat; }
68
+ /* IE6 */
69
+ .fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_close.png', sizingMethod='scale'); }
70
+ .fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_nav_left.png', sizingMethod='scale'); }
71
+ .fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_nav_right.png', sizingMethod='scale'); }
72
+ .fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
73
+ .fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_title_left.png', sizingMethod='scale'); }
74
+ .fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_title_main.png', sizingMethod='scale'); }
75
+ .fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_title_right.png', sizingMethod='scale'); }
76
+ .fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame { height: expression(this.parentNode.clientHeight + "px"); }
77
+ #fancybox-loading.fancybox-ie6 { position: absolute; margin-top: 0; top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'); }
78
+ #fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_loading.png', sizingMethod='scale'); }
79
+ /* IE6, IE7, IE8 */
80
+ .fancybox-ie .fancybox-bg { background: transparent !important; }
81
+ .fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_n.png', sizingMethod='scale'); }
82
+ .fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_ne.png', sizingMethod='scale'); }
83
+ .fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_e.png', sizingMethod='scale'); }
84
+ .fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_se.png', sizingMethod='scale'); }
85
+ .fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_s.png', sizingMethod='scale'); }
86
+ .fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_sw.png', sizingMethod='scale'); }
87
+ .fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_w.png', sizingMethod='scale'); }
88
+ .fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/fancy_shadow_nw.png', sizingMethod='scale'); }
89
+ #fancybox-title-over em { font-size: 11px; }
90
+ #fancybox-title-over .title { font-size: 14px; }
91
+ #fancybox-title-over .descr { font-size: 12px; display: block; margin-top: 4px; }
admin/js/jquery.fancybox-1.3.4.pack.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
19
+ F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
20
+ c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
21
+ false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
22
+ function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
23
+ '"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
24
+ "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
25
+ ";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
26
+ opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
27
+ d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
28
+ y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
29
+ i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
30
+ f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
31
+ 37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
32
+ s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
33
+ f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
34
+ j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
35
+ "image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
36
+ 10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
37
+ b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
38
+ 0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
39
+ 1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
40
+ true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
41
+ b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
42
+ d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
43
+ D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
44
+ b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
45
+ b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
46
+ easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
admin/js/jquery.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.6.1
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2011, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2011, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Thu May 12 15:04:36 2011 -0400
15
+ */
16
+ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("<!doctype><html><body></body></html>");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bF.test(a)?d(a,e):b_(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bU,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bQ),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bD(a,b,c){var d=b==="width"?bx:by,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bn(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bm(a){f.nodeName(a,"input")?bl(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bl)}function bl(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bk(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bj(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bi(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bh(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(S.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(y,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem
17
+ )});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,O(a.origType,a.selector),f.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,O(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?F:E):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=F;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=F;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=F,this.stopPropagation()},isDefaultPrevented:E,isPropagationStopped:E,isImmediatePropagationStopped:E};var G=function(a){var b=a.relatedTarget;a.type=a.data;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&f.event.handle.apply(this,arguments)}catch(d){}},H=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?H:G,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?H:G)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&L("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&L("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var I,J=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var M={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||E,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=y.exec(h),k="",j&&(k=j[0],h=h.replace(y,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,M[h]?(a.push(M[h]+k),h=h+k):h=(M[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+O(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+O(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var P=/Until$/,Q=/^(?:parents|prevUntil|prevAll)/,R=/,/,S=/^.[^:#\[\.,]*$/,T=Array.prototype.slice,U=f.expr.match.POS,V={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(X(this,a,!1),"not",a)},filter:function(a){return this.pushStack(X(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=U.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/<tbody/i,bb=/<|&#?\w+;/,bc=/<(?:script|object|embed|option|style)/i,bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bh(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bn)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bc.test(a[0])&&(f.support.checkClone||!bd.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||
18
+ b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1></$2>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bm(k[i]);else bm(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bo=/alpha\([^)]*\)/i,bp=/opacity=([^)]*)/,bq=/-([a-z])/ig,br=/([A-Z]|^ms)/g,bs=/^-?\d+(?:px)?$/i,bt=/^-?\d/,bu=/^[+\-]=/,bv=/[^+\-\.\de]+/g,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB,bC=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bu.test(d)&&(d=+d.replace(bv,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bq,bC)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bD(a,b,d):f.swap(a,bw,function(){e=bD(a,b,d)});if(e<=0){e=bz(a,b,b),e==="0px"&&bB&&(e=bB(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bs.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cv(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cm.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cn.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cq||cs(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!co&&(cr?(co=1,g=function(){co&&(cr(g),e.tick())},cr(g)):co=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cq||cs(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);jQuery.noConflict();
admin/js/jquery.nivo.slider.pack.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Nivo Slider v3.1
3
+ * http://nivo.dev7studios.com
4
+ *
5
+ * Copyright 2012, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ (function(a){var b=function(b,c){var d=a.extend({},a.fn.nivoSlider.defaults,c);var e={currentSlide:0,currentImage:"",totalSlides:0,running:false,paused:false,stop:false,controlNavEl:false};var f=a(b);f.data("nivo:vars",e).addClass("nivoSlider");var g=f.children();g.each(function(){var b=a(this);var c="";if(!b.is("img")){if(b.is("a")){b.addClass("nivo-imageLink");c=b}b=b.find("img:first")}var d=d===0?b.attr("width"):b.width(),f=f===0?b.attr("height"):b.height();if(c!==""){c.css("display","none")}b.css("display","none");e.totalSlides++});if(d.randomStart){d.startSlide=Math.floor(Math.random()*e.totalSlides)}if(d.startSlide>0){if(d.startSlide>=e.totalSlides){d.startSlide=e.totalSlides-1}e.currentSlide=d.startSlide}if(a(g[e.currentSlide]).is("img")){e.currentImage=a(g[e.currentSlide])}else{e.currentImage=a(g[e.currentSlide]).find("img:first")}if(a(g[e.currentSlide]).is("a")){a(g[e.currentSlide]).css("display","block")}var h=a('<img class="nivo-main-image" src="#" />');h.attr("src",e.currentImage.attr("src")).show();f.append(h);a(window).resize(function(){f.children("img").width(f.width());h.attr("src",e.currentImage.attr("src"));h.stop().height("auto");a(".nivo-slice").remove();a(".nivo-box").remove()});f.append(a('<div class="nivo-caption"></div>'));var i=function(b){var c=a(".nivo-caption",f);if(e.currentImage.attr("title")!=""&&e.currentImage.attr("title")!=undefined){var d=e.currentImage.attr("title");if(d.substr(0,1)=="#")d=a(d).html();if(c.css("display")=="block"){setTimeout(function(){c.html(d)},b.animSpeed)}else{c.html(d);c.stop().fadeIn(b.animSpeed)}}else{c.stop().fadeOut(b.animSpeed)}};i(d);var j=0;if(!d.manualAdvance&&g.length>1){j=setInterval(function(){o(f,g,d,false)},d.pauseTime)}if(d.directionNav){f.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+d.prevText+'</a><a class="nivo-nextNav">'+d.nextText+"</a></div>");a("a.nivo-prevNav",f).live("click",function(){if(e.running){return false}clearInterval(j);j="";e.currentSlide-=2;o(f,g,d,"prev")});a("a.nivo-nextNav",f).live("click",function(){if(e.running){return false}clearInterval(j);j="";o(f,g,d,"next")})}if(d.controlNav){e.controlNavEl=a('<div class="nivo-controlNav"></div>');f.after(e.controlNavEl);for(var k=0;k<g.length;k++){if(d.controlNavThumbs){e.controlNavEl.addClass("nivo-thumbs-enabled");var l=g.eq(k);if(!l.is("img")){l=l.find("img:first")}if(l.attr("data-thumb"))e.controlNavEl.append('<a class="nivo-control" rel="'+k+'"><img src="'+l.attr("data-thumb")+'" alt="" /></a>')}else{e.controlNavEl.append('<a class="nivo-control" rel="'+k+'">'+(k+1)+"</a>")}}a("a:eq("+e.currentSlide+")",e.controlNavEl).addClass("active");a("a",e.controlNavEl).bind("click",function(){if(e.running)return false;if(a(this).hasClass("active"))return false;clearInterval(j);j="";h.attr("src",e.currentImage.attr("src"));e.currentSlide=a(this).attr("rel")-1;o(f,g,d,"control")})}if(d.pauseOnHover){f.hover(function(){e.paused=true;clearInterval(j);j=""},function(){e.paused=false;if(j===""&&!d.manualAdvance){j=setInterval(function(){o(f,g,d,false)},d.pauseTime)}})}f.bind("nivo:animFinished",function(){h.attr("src",e.currentImage.attr("src"));e.running=false;a(g).each(function(){if(a(this).is("a")){a(this).css("display","none")}});if(a(g[e.currentSlide]).is("a")){a(g[e.currentSlide]).css("display","block")}if(j===""&&!e.paused&&!d.manualAdvance){j=setInterval(function(){o(f,g,d,false)},d.pauseTime)}d.afterChange.call(this)});var m=function(b,c,d){if(a(d.currentImage).parent().is("a"))a(d.currentImage).parent().css("display","block");a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").width(b.width()).css("visibility","hidden").show();var e=a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").parent().is("a")?a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").parent().height():a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").height();for(var f=0;f<c.slices;f++){var g=Math.round(b.width()/c.slices);if(f===c.slices-1){b.append(a('<div class="nivo-slice" name="'+f+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+b.width()+"px; height:auto; display:block !important; top:0; left:-"+(g+f*g-g)+'px;" /></div>').css({left:g*f+"px",width:b.width()-g*f+"px",height:e+"px",opacity:"0",overflow:"hidden"}))}else{b.append(a('<div class="nivo-slice" name="'+f+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+b.width()+"px; height:auto; display:block !important; top:0; left:-"+(g+f*g-g)+'px;" /></div>').css({left:g*f+"px",width:g+"px",height:e+"px",opacity:"0",overflow:"hidden"}))}}a(".nivo-slice",b).height(e);h.stop().animate({height:a(d.currentImage).height()},c.animSpeed)};var n=function(b,c,d){if(a(d.currentImage).parent().is("a"))a(d.currentImage).parent().css("display","block");a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").width(b.width()).css("visibility","hidden").show();var e=Math.round(b.width()/c.boxCols),f=Math.round(a('img[src="'+d.currentImage.attr("src")+'"]',b).not(".nivo-main-image,.nivo-control img").height()/c.boxRows);for(var g=0;g<c.boxRows;g++){for(var i=0;i<c.boxCols;i++){if(i===c.boxCols-1){b.append(a('<div class="nivo-box" name="'+i+'" rel="'+g+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+b.width()+"px; height:auto; display:block; top:-"+f*g+"px; left:-"+e*i+'px;" /></div>').css({opacity:0,left:e*i+"px",top:f*g+"px",width:b.width()-e*i+"px"}));a('.nivo-box[name="'+i+'"]',b).height(a('.nivo-box[name="'+i+'"] img',b).height()+"px")}else{b.append(a('<div class="nivo-box" name="'+i+'" rel="'+g+'"><img src="'+d.currentImage.attr("src")+'" style="position:absolute; width:'+b.width()+"px; height:auto; display:block; top:-"+f*g+"px; left:-"+e*i+'px;" /></div>').css({opacity:0,left:e*i+"px",top:f*g+"px",width:e+"px"}));a('.nivo-box[name="'+i+'"]',b).height(a('.nivo-box[name="'+i+'"] img',b).height()+"px")}}}h.stop().animate({height:a(d.currentImage).height()},c.animSpeed)};var o=function(b,c,d,e){var f=b.data("nivo:vars");if(f&&f.currentSlide===f.totalSlides-1){d.lastSlide.call(this)}if((!f||f.stop)&&!e){return false}d.beforeChange.call(this);if(!e){h.attr("src",f.currentImage.attr("src"))}else{if(e==="prev"){h.attr("src",f.currentImage.attr("src"))}if(e==="next"){h.attr("src",f.currentImage.attr("src"))}}f.currentSlide++;if(f.currentSlide===f.totalSlides){f.currentSlide=0;d.slideshowEnd.call(this)}if(f.currentSlide<0){f.currentSlide=f.totalSlides-1}if(a(c[f.currentSlide]).is("img")){f.currentImage=a(c[f.currentSlide])}else{f.currentImage=a(c[f.currentSlide]).find("img:first")}if(d.controlNav){a("a",f.controlNavEl).removeClass("active");a("a:eq("+f.currentSlide+")",f.controlNavEl).addClass("active")}i(d);a(".nivo-slice",b).remove();a(".nivo-box",b).remove();var g=d.effect,j="";if(d.effect==="random"){j=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse");g=j[Math.floor(Math.random()*(j.length+1))];if(g===undefined){g="fade"}}if(d.effect.indexOf(",")!==-1){j=d.effect.split(",");g=j[Math.floor(Math.random()*j.length)];if(g===undefined){g="fade"}}if(f.currentImage.attr("data-transition")){g=f.currentImage.attr("data-transition")}f.running=true;var k=0,l=0,o="",q="",r="",s="";if(g==="sliceDown"||g==="sliceDownRight"||g==="sliceDownLeft"){m(b,d,f);k=0;l=0;o=a(".nivo-slice",b);if(g==="sliceDownLeft"){o=a(".nivo-slice",b)._reverse()}o.each(function(){var c=a(this);c.css({top:"0px"});if(l===d.slices-1){setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+k)}else{setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed)},100+k)}k+=50;l++})}else if(g==="sliceUp"||g==="sliceUpRight"||g==="sliceUpLeft"){m(b,d,f);k=0;l=0;o=a(".nivo-slice",b);if(g==="sliceUpLeft"){o=a(".nivo-slice",b)._reverse()}o.each(function(){var c=a(this);c.css({bottom:"0px"});if(l===d.slices-1){setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+k)}else{setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed)},100+k)}k+=50;l++})}else if(g==="sliceUpDown"||g==="sliceUpDownRight"||g==="sliceUpDownLeft"){m(b,d,f);k=0;l=0;var t=0;o=a(".nivo-slice",b);if(g==="sliceUpDownLeft"){o=a(".nivo-slice",b)._reverse()}o.each(function(){var c=a(this);if(l===0){c.css("top","0px");l++}else{c.css("bottom","0px");l=0}if(t===d.slices-1){setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+k)}else{setTimeout(function(){c.animate({opacity:"1.0"},d.animSpeed)},100+k)}k+=50;t++})}else if(g==="fold"){m(b,d,f);k=0;l=0;a(".nivo-slice",b).each(function(){var c=a(this);var e=c.width();c.css({top:"0px",width:"0px"});if(l===d.slices-1){setTimeout(function(){c.animate({width:e,opacity:"1.0"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+k)}else{setTimeout(function(){c.animate({width:e,opacity:"1.0"},d.animSpeed)},100+k)}k+=50;l++})}else if(g==="fade"){m(b,d,f);q=a(".nivo-slice:first",b);q.css({width:b.width()+"px"});q.animate({opacity:"1.0"},d.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(g==="slideInRight"){m(b,d,f);q=a(".nivo-slice:first",b);q.css({width:"0px",opacity:"1"});q.animate({width:b.width()+"px"},d.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(g==="slideInLeft"){m(b,d,f);q=a(".nivo-slice:first",b);q.css({width:"0px",opacity:"1",left:"",right:"0px"});q.animate({width:b.width()+"px"},d.animSpeed*2,"",function(){q.css({left:"0px",right:""});b.trigger("nivo:animFinished")})}else if(g==="boxRandom"){n(b,d,f);r=d.boxCols*d.boxRows;l=0;k=0;s=p(a(".nivo-box",b));s.each(function(){var c=a(this);if(l===r-1){setTimeout(function(){c.animate({opacity:"1"},d.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+k)}else{setTimeout(function(){c.animate({opacity:"1"},d.animSpeed)},100+k)}k+=20;l++})}else if(g==="boxRain"||g==="boxRainReverse"||g==="boxRainGrow"||g==="boxRainGrowReverse"){n(b,d,f);r=d.boxCols*d.boxRows;l=0;k=0;var u=0;var v=0;var w=[];w[u]=[];s=a(".nivo-box",b);if(g==="boxRainReverse"||g==="boxRainGrowReverse"){s=a(".nivo-box",b)._reverse()}s.each(function(){w[u][v]=a(this);v++;if(v===d.boxCols){u++;v=0;w[u]=[]}});for(var x=0;x<d.boxCols*2;x++){var y=x;for(var z=0;z<d.boxRows;z++){if(y>=0&&y<d.boxCols){(function(c,e,f,h,i){var j=a(w[c][e]);var k=j.width();var l=j.height();if(g==="boxRainGrow"||g==="boxRainGrowReverse"){j.width(0).height(0)}if(h===i-1){setTimeout(function(){j.animate({opacity:"1",width:k,height:l},d.animSpeed/1.3,"",function(){b.trigger("nivo:animFinished")})},100+f)}else{setTimeout(function(){j.animate({opacity:"1",width:k,height:l},d.animSpeed/1.3)},100+f)}})(z,y,k,l,r);l++}y--}k+=100}}};var p=function(a){for(var b,c,d=a.length;d;b=parseInt(Math.random()*d,10),c=a[--d],a[d]=a[b],a[b]=c);return a};var q=function(a){if(this.console&&typeof console.log!=="undefined"){console.log(a)}};this.stop=function(){if(!a(b).data("nivo:vars").stop){a(b).data("nivo:vars").stop=true;q("Stop Slider")}};this.start=function(){if(a(b).data("nivo:vars").stop){a(b).data("nivo:vars").stop=false;q("Start Slider")}};d.afterLoad.call(this);return this};a.fn.nivoSlider=function(c){return this.each(function(d,e){var f=a(this);if(f.data("nivoslider")){return f.data("nivoslider")}var g=new b(this,c);f.data("nivoslider",g)})};a.fn.nivoSlider.defaults={effect:"random",slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3e3,startSlide:0,directionNav:true,controlNav:true,controlNavThumbs:false,pauseOnHover:true,manualAdvance:false,prevText:"Prev",nextText:"Next",randomStart:false,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};a.fn._reverse=[].reverse})(jQuery)
admin/js/jquery.tablednd_0_5.js ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * TableDnD plug-in for JQuery, allows you to drag and drop table rows
3
+ * You can set up various options to control how the system will work
4
+ * Copyright (c) Denis Howlett <denish@isocra.com>
5
+ * Licensed like jQuery, see http://docs.jquery.com/License.
6
+ *
7
+ * Configuration options:
8
+ *
9
+ * onDragStyle
10
+ * This is the style that is assigned to the row during drag. There are limitations to the styles that can be
11
+ * associated with a row (such as you can't assign a border--well you can, but it won't be
12
+ * displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
13
+ * a map (as used in the jQuery css(...) function).
14
+ * onDropStyle
15
+ * This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
16
+ * to what you can do. Also this replaces the original style, so again consider using onDragClass which
17
+ * is simply added and then removed on drop.
18
+ * onDragClass
19
+ * This class is added for the duration of the drag and then removed when the row is dropped. It is more
20
+ * flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
21
+ * is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
22
+ * stylesheet.
23
+ * onDrop
24
+ * Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
25
+ * and the row that was dropped. You can work out the new order of the rows by using
26
+ * table.rows.
27
+ * onDragStart
28
+ * Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
29
+ * table and the row which the user has started to drag.
30
+ * onAllowDrop
31
+ * Pass a function that will be called as a row is over another row. If the function returns true, allow
32
+ * dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
33
+ * the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
34
+ * scrollAmount
35
+ * This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
36
+ * window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
37
+ * FF3 beta
38
+ * dragHandle
39
+ * This is the name of a class that you assign to one or more cells in each row that is draggable. If you
40
+ * specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
41
+ * will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
42
+ * the whole row is draggable.
43
+ *
44
+ * Other ways to control behaviour:
45
+ *
46
+ * Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
47
+ * that you don't want to be draggable.
48
+ *
49
+ * Inside the onDrop method you can also call jQuery.tableDnD.serialize() this returns a string of the form
50
+ * <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
51
+ * an ID as must all the rows.
52
+ *
53
+ * Other methods:
54
+ *
55
+ * jQuery("...").tableDnDUpdate()
56
+ * Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
57
+ * This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
58
+ * The table maintains the original configuration (so you don't have to specify it again).
59
+ *
60
+ * jQuery("...").tableDnDSerialize()
61
+ * Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
62
+ * called from anywhere and isn't dependent on the currentTable being set up correctly before calling
63
+ *
64
+ * Known problems:
65
+ * - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
66
+ *
67
+ * Version 0.2: 2008-02-20 First public version
68
+ * Version 0.3: 2008-02-07 Added onDragStart option
69
+ * Made the scroll amount configurable (default is 5 as before)
70
+ * Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
71
+ * Added onAllowDrop to control dropping
72
+ * Fixed a bug which meant that you couldn't set the scroll amount in both directions
73
+ * Added serialize method
74
+ * Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
75
+ * draggable
76
+ * Improved the serialize method to use a default (and settable) regular expression.
77
+ * Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
78
+ */
79
+ jQuery.tableDnD = {
80
+ /** Keep hold of the current table being dragged */
81
+ currentTable : null,
82
+ /** Keep hold of the current drag object if any */
83
+ dragObject: null,
84
+ /** The current mouse offset */
85
+ mouseOffset: null,
86
+ /** Remember the old value of Y so that we don't do too much processing */
87
+ oldY: 0,
88
+
89
+ /** Actually build the structure */
90
+ build: function(options) {
91
+ // Set up the defaults if any
92
+
93
+ this.each(function() {
94
+ // This is bound to each matching table, set up the defaults and override with user options
95
+ this.tableDnDConfig = jQuery.extend({
96
+ onDragStyle: null,
97
+ onDropStyle: null,
98
+ // Add in the default class for whileDragging
99
+ onDragClass: "tDnD_whileDrag",
100
+ onDrop: null,
101
+ onDragStart: null,
102
+ scrollAmount: 5,
103
+ serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
104
+ serializeParamName: null, // If you want to specify another parameter name instead of the table ID
105
+ dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
106
+ }, options || {});
107
+ // Now make the rows draggable
108
+ jQuery.tableDnD.makeDraggable(this);
109
+ });
110
+
111
+ // Now we need to capture the mouse up and mouse move event
112
+ // We can use bind so that we don't interfere with other event handlers
113
+ jQuery(document)
114
+ .bind('mousemove', jQuery.tableDnD.mousemove)
115
+ .bind('mouseup', jQuery.tableDnD.mouseup);
116
+
117
+ // Don't break the chain
118
+ return this;
119
+ },
120
+
121
+ /** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
122
+ makeDraggable: function(table) {
123
+ var config = table.tableDnDConfig;
124
+ if (table.tableDnDConfig.dragHandle) {
125
+ // We only need to add the event to the specified cells
126
+ var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
127
+ cells.each(function() {
128
+ // The cell is bound to "this"
129
+ jQuery(this).mousedown(function(ev) {
130
+ jQuery.tableDnD.dragObject = this.parentNode;
131
+ jQuery.tableDnD.currentTable = table;
132
+ jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
133
+ if (config.onDragStart) {
134
+ // Call the onDrop method if there is one
135
+ config.onDragStart(table, this);
136
+ }
137
+ return false;
138
+ });
139
+ })
140
+ } else {
141
+ // For backwards compatibility, we add the event to the whole row
142
+ var rows = jQuery("tr", table); // get all the rows as a wrapped set
143
+ rows.each(function() {
144
+ // Iterate through each row, the row is bound to "this"
145
+ var row = jQuery(this);
146
+ if (! row.hasClass("nodrag")) {
147
+ row.mousedown(function(ev) {
148
+ if (ev.target.tagName == "TD") {
149
+ jQuery.tableDnD.dragObject = this;
150
+ jQuery.tableDnD.currentTable = table;
151
+ jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
152
+ if (config.onDragStart) {
153
+ // Call the onDrop method if there is one
154
+ config.onDragStart(table, this);
155
+ }
156
+ return false;
157
+ }
158
+ }).css("cursor", "move"); // Store the tableDnD object
159
+ }
160
+ });
161
+ }
162
+ },
163
+
164
+ updateTables: function() {
165
+ this.each(function() {
166
+ // this is now bound to each matching table
167
+ if (this.tableDnDConfig) {
168
+ jQuery.tableDnD.makeDraggable(this);
169
+ }
170
+ })
171
+ },
172
+
173
+ /** Get the mouse coordinates from the event (allowing for browser differences) */
174
+ mouseCoords: function(ev){
175
+ if(ev.pageX || ev.pageY){
176
+ return {x:ev.pageX, y:ev.pageY};
177
+ }
178
+ return {
179
+ x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
180
+ y:ev.clientY + document.body.scrollTop - document.body.clientTop
181
+ };
182
+ },
183
+
184
+ /** Given a target element and a mouse event, get the mouse offset from that element.
185
+ To do this we need the element's position and the mouse position */
186
+ getMouseOffset: function(target, ev) {
187
+ ev = ev || window.event;
188
+
189
+ var docPos = this.getPosition(target);
190
+ var mousePos = this.mouseCoords(ev);
191
+ return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
192
+ },
193
+
194
+ /** Get the position of an element by going up the DOM tree and adding up all the offsets */
195
+ getPosition: function(e){
196
+ var left = 0;
197
+ var top = 0;
198
+ /** Safari fix -- thanks to Luis Chato for this! */
199
+ if (e.offsetHeight == 0) {
200
+ /** Safari 2 doesn't correctly grab the offsetTop of a table row
201
+ this is detailed here:
202
+ http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
203
+ the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
204
+ note that firefox will return a text node as a first child, so designing a more thorough
205
+ solution may need to take that into account, for now this seems to work in firefox, safari, ie */
206
+ e = e.firstChild; // a table cell
207
+ }
208
+
209
+ while (e.offsetParent){
210
+ left += e.offsetLeft;
211
+ top += e.offsetTop;
212
+ e = e.offsetParent;
213
+ }
214
+
215
+ left += e.offsetLeft;
216
+ top += e.offsetTop;
217
+
218
+ return {x:left, y:top};
219
+ },
220
+
221
+ mousemove: function(ev) {
222
+ if (jQuery.tableDnD.dragObject == null) {
223
+ return;
224
+ }
225
+
226
+ var dragObj = jQuery(jQuery.tableDnD.dragObject);
227
+ var config = jQuery.tableDnD.currentTable.tableDnDConfig;
228
+ var mousePos = jQuery.tableDnD.mouseCoords(ev);
229
+ var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
230
+ //auto scroll the window
231
+ var yOffset = window.pageYOffset;
232
+ if (document.all) {
233
+ // Windows version
234
+ //yOffset=document.body.scrollTop;
235
+ if (typeof document.compatMode != 'undefined' &&
236
+ document.compatMode != 'BackCompat') {
237
+ yOffset = document.documentElement.scrollTop;
238
+ }
239
+ else if (typeof document.body != 'undefined') {
240
+ yOffset=document.body.scrollTop;
241
+ }
242
+
243
+ }
244
+
245
+ if (mousePos.y-yOffset < config.scrollAmount) {
246
+ window.scrollBy(0, -config.scrollAmount);
247
+ } else {
248
+ var windowHeight = window.innerHeight ? window.innerHeight
249
+ : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
250
+ if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
251
+ window.scrollBy(0, config.scrollAmount);
252
+ }
253
+ }
254
+
255
+
256
+ if (y != jQuery.tableDnD.oldY) {
257
+ // work out if we're going up or down...
258
+ var movingDown = y > jQuery.tableDnD.oldY;
259
+ // update the old value
260
+ jQuery.tableDnD.oldY = y;
261
+ // update the style to show we're dragging
262
+ if (config.onDragClass) {
263
+ dragObj.addClass(config.onDragClass);
264
+ } else {
265
+ dragObj.css(config.onDragStyle);
266
+ }
267
+