function flag_tune($show_error = true, $skins_reset = false) { /* Move skins outside the plugin folder */ $flag_options = get_option('flag_options'); $skins_dir = str_replace("\\", "/", WP_PLUGIN_DIR . '/flagallery-skins/'); $old_skins_dir = FLAG_ABSPATH . 'skins/'; $flag_options['skinsDirABS'] = $skins_dir; $flag_options['skinsDirURL'] = WP_PLUGIN_URL . '/flagallery-skins/'; update_option('flag_options', $flag_options); if (version_compare(get_option('flagVersion'), '4.25', '<')) { $skins_reset = true; @unlink($skins_dir . 'banner_default'); @unlink($skins_dir . 'banner_widget_default'); } $errors = ''; // check for main folder if (!wp_mkdir_p($skins_dir)) { $errors .= __('Directory <strong>"', 'flash-album-gallery') . $skins_dir . __('"</strong> doesn\'t exist. Please create first the <strong>"flagallery-skins"</strong> folder!', 'flash-album-gallery') . '<br />'; } else { // check for permission settings, Safe mode limitations are not taken into account. if (!is_writeable($skins_dir)) { $errors .= __('Directory <strong>"', 'flash-album-gallery') . $skins_dir . __('"</strong> is not writeable!', 'flash-album-gallery') . '<br />'; } else { // Files in flash-album-gallery/skins directory $open_old_skins_dir = @opendir($old_skins_dir); if ($open_old_skins_dir) { while (($file = readdir($open_old_skins_dir)) !== false) { if (substr($file, 0, 1) == '.') { continue; } if (is_dir($old_skins_dir . $file)) { if (is_dir($skins_dir . $file)) { if ($skins_reset) { flagGallery::flagFolderDelete($skins_dir . $file); } else { continue; } } if (!@rename($old_skins_dir . $file, $skins_dir . $file)) { $errors .= sprintf(__('Failed to move files from %1$s to %2$s', 'flash-album-gallery'), '<strong>' . $old_skins_dir . $file . '</strong>', $skins_dir . $file) . '<br />'; } } } } @closedir($open_old_skins_dir); } } if ($errors != '') { if ($show_error) { flagGallery::show_error($errors); } return false; } return true; }
function flag_picturelist() { // *** show picture list global $wpdb, $flagdb, $user_ID, $flag; // Look if its a search result $is_search = isset($_GET['s']) ? true : false; if ($is_search) { // fetch the imagelist $picturelist = $flag->manage_page->search_result; // we didn't set a gallery or a pagination $act_gid = 0; $_GET['paged'] = 1; $page_links = false; } else { // GET variables $act_gid = $flag->manage_page->gid; // Load the gallery metadata $gallery = $flagdb->find_gallery($act_gid); if (!$gallery) { flagGallery::show_error(__('Gallery not found.', 'flash-album-gallery')); return; } // Check if you have the correct capability if (!flagAdmin::can_manage_this_gallery($gallery->author)) { flagGallery::show_error(__('Sorry, you have no access here', 'flash-album-gallery')); return; } // look for pagination if (!isset($_GET['paged']) || intval($_GET['paged']) < 1) { $_GET['paged'] = 1; } $_GET['paged'] = intval($_GET['paged']); $start = ($_GET['paged'] - 1) * 50; // get picture values $picturelist = $flagdb->get_gallery($act_gid, $flag->options['galSort'], $flag->options['galSortDir'], false, 50, $start); // build pagination $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged'])); // get the current author $act_author_user = get_userdata((int) $gallery->author); } // list all galleries $gallerylist = $flagdb->find_all_galleries(); //get the columns $gallery_columns = flag_manage_gallery_columns(); $hidden_columns = get_hidden_columns('flag-manage-images'); $hidden_columns = array_filter($hidden_columns); if ($picturelist) { $a_hits = array(); foreach ($picturelist as $p) { $a_hits[] = $p->hitcounter; } if (!array_sum($a_hits)) { $hidden_columns[] = 'views_likes'; $hidden_columns[] = 'rating'; } } else { $hidden_columns[] = 'views_likes'; $hidden_columns[] = 'rating'; } $num_columns = count($gallery_columns) - count($hidden_columns); ?> <!--[if lt IE 8]> <style type="text/css"> .custom_thumb { display : none; } </style> <![endif]--> <script type="text/javascript"> //<![CDATA[ function showDialog( windowId, height ) { var form = document.getElementById('updategallery'); var elementlist = ""; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) if (elementlist == "") elementlist = form.elements[i].value; else elementlist += "," + form.elements[i].value ; } } jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val()); jQuery("#" + windowId + "_imagelist").val(elementlist); // console.log (jQuery("#TB_imagelist").val()); tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false); } function checkAll(form) { for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") { if(form.elements[i].checked == true) form.elements[i].checked = false; else form.elements[i].checked = true; } } } } function getNumChecked(form) { var num = 0; for (i = 0, n = form.elements.length; i < n; i++) { if(form.elements[i].type == "checkbox") { if(form.elements[i].name == "doaction[]") if(form.elements[i].checked == true) num++; } } return num; } // this function check for a the number of selected images, sumbmit false when no one selected function checkSelected() { var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo esc_js(__("No images selected", "flash-album-gallery")); ?> '); return false; } actionId = jQuery('#bulkaction').val(); switch (actionId) { case "copy_to": case "move_to": showDialog('selectgallery', 120); return false; break; case "resize_images": showDialog('resize_images', 120); return false; break; case "new_thumbnail": showDialog('new_thumbnail', 160); return false; break; } return confirm('<?php echo sprintf(esc_js(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'flash-album-gallery')), "' + numchecked + '"); ?> '); } jQuery(document).ready( function() { // close postboxes that should be closed jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); postboxes.add_postbox_toggles('flag-manage-gallery'); }); //]]> </script> <div class="flag-wrap"> <?php if ($is_search) { ?> <h2><?php printf(__('Search results for “%s”', 'flash-album-gallery'), esc_html(stripslashes(get_search_query()))); ?> </h2> <form class="search-form" action="" method="get"> <p class="search-box"> <label class="hidden" for="media-search-input"><?php _e('Search Images', 'flash-album-gallery'); ?> :</label> <input type="hidden" id="page-name" name="page" value="flag-manage-gallery" /> <input type="text" id="media-search-input" name="s" value="<?php the_search_query(); ?> " /> <input type="submit" value="<?php _e('Search Images', 'flash-album-gallery'); ?> " class="button" /> </p> </form> <br style="clear: both;" /> <form id="updategallery" class="flagform" method="POST" action="<?php echo esc_url($flag->manage_page->base_page . '&mode=edit&s=' . urlencode(get_search_query())); ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_updategallery'); ?> <input type="hidden" name="page" value="manage-images" /> <?php } else { ?> <h2><?php echo _n('Gallery', 'Galleries', 1, 'flash-album-gallery'); ?> : <?php echo esc_html($gallery->title); ?> </h2> <select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value"> <option selected="selected"><?php _e('Choose another gallery', 'flash-album-gallery'); ?> </option> <?php foreach ($gallerylist as $gal) { if ($gal->gid != $act_gid) { ?> <option value="<?php echo wp_nonce_url($flag->manage_page->base_page . "&mode=edit&gid=" . $gal->gid, 'flag_editgallery'); ?> " ><?php if ($flag->options['albSort'] == 'gid') { echo $gal->gid . ' - '; } echo esc_html(stripslashes($gal->title)); if ($flag->options['albSort'] == 'title') { echo ' (' . $gal->gid . ')'; } ?> </option> <?php } } ?> </select> <form id="updategallery" class="flagform" method="POST" action="<?php echo $flag->manage_page->base_page . '&mode=edit&gid=' . $act_gid . '&paged=' . intval($_GET['paged']); ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_updategallery'); ?> <input type="hidden" name="page" value="manage-images" /> <div id="poststuff" class="metabox-holder"> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <div id="post-body"><div id="post-body-content"><div id="normal-sortables" class="meta-box-sortables ui-sortable" style="position: relative;"> <div id="flagalleryset" class="postbox <?php echo postbox_classes('flagalleryset', 'flag-manage-gallery'); ?> " > <div class="handlediv" title="Click to toggle"><br/></div> <h3 class="hndle"><span><?php _e('Gallery settings', 'flash-album-gallery'); ?> </span></h3> <div class="inside"> <table class="flag-form-table" > <tr> <th align="right" scope="row"><?php _e('Title', 'flash-album-gallery'); ?> :</th> <td> </td> <td align="left"><input type="text" size="50" name="title" value="<?php echo esc_html($gallery->title); ?> " /></td> </tr> <tr> <th align="right" valign="top" scope="row"><?php _e('Description', 'flash-album-gallery'); ?> :</th> <td> </td> <td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo esc_html($gallery->galdesc); ?> </textarea></td> </tr> <tr> <th align="right" scope="row"><?php _e('Path', 'flash-album-gallery'); ?> :</th> <td> </td> <td align="left"><input <?php if (IS_WPMU) { echo 'readonly = "readonly"'; } ?> type="text" size="50" name="path" value="<?php echo esc_attr($gallery->path); ?> " /></td> </tr> <tr> <th align="right" scope="row"><?php _e('Author', 'flash-album-gallery'); ?> :</th> <td> </td> <td align="left"> <?php $editable_ids = $flag->manage_page->get_editable_user_ids($user_ID); if ($editable_ids && count($editable_ids) > 1) { wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author)); } else { echo $act_author_user->display_name; } ?> <input type="hidden" name="previewpic" value="<?php if (is_array($picturelist)) { echo $picturelist[0]->pid; } ?> " /> </td> </tr> </table> <div class="submit"> <input type="submit" class="button-secondary" name="scanfolder" value="<?php _e("Scan Folder for new images", 'flash-album-gallery'); ?> " /> <input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'flash-album-gallery'); ?> " /> </div> <div class="clear"></div> </div> </div> </div></div></div> </div> <!-- poststuff --> <?php } ?> <div class="tablenav flag-tablenav"> <?php if ($page_links) { ?> <div class="tablenav-pages"><?php $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s–%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $flagdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $flagdb->paged['objects_per_page'], $flagdb->paged['total_objects'])), number_format_i18n($flagdb->paged['total_objects']), $page_links); echo $page_links_text; ?> </div> <?php } ?> <div class="alignleft actions"> <select id="bulkaction" name="bulkaction" class="alignleft"> <option value="no_action" ><?php _e("No action", 'flash-album-gallery'); ?> </option> <option value="webview_images" ><?php _e("Create images optimized for web", 'flash-album-gallery'); ?> </option> <option value="new_thumbnail" ><?php _e("Create new thumbnails", 'flash-album-gallery'); ?> </option> <option value="resize_images" ><?php _e("Resize images", 'flash-album-gallery'); ?> </option> <option value="delete_images" ><?php _e("Delete images", 'flash-album-gallery'); ?> </option> <option value="import_meta" ><?php _e("Import metadata", 'flash-album-gallery'); ?> </option> <option value="copy_meta" ><?php _e("Metadata to description", 'flash-album-gallery'); ?> </option> <option value="copy_to" ><?php _e("Copy to...", 'flash-album-gallery'); ?> </option> <option value="move_to"><?php _e("Move to...", 'flash-album-gallery'); ?> </option> <option value="reset_counters"><?php _e("Reset Views & Likes counters", 'flash-album-gallery'); ?> </option> <?php do_action('flag_manage_images_bulkaction'); ?> </select> <input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php _e("OK", 'flash-album-gallery'); ?> " onclick="if ( !checkSelected() ) return false;" /> <?php if ($flag->options['galSort'] == "sortorder" && !$is_search) { ?> <a href="<?php echo wp_nonce_url($flag->manage_page->base_page . "&mode=sort&gid=" . $act_gid, 'flag_sortgallery'); ?> " class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php _e("Sort gallery", 'flash-album-gallery'); ?> </a> <?php } if (current_user_can('FlAG Upload images') && !$is_search) { ?> <a href="<?php echo wp_nonce_url($flag->manage_page->base_page . "&gid=" . $act_gid . "&tabs=1", 'flag_addimages'); ?> " class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php _e("Add Images", 'flash-album-gallery'); ?> </a> <?php } ?> <input type="submit" name="updatepictures" class="button-primary action alignleft" value="<?php _e("Save Changes", 'flash-album-gallery'); ?> " /> </div> </div> <table id="flag-listimages" class="widefat fixed flag-table" cellspacing="0" > <thead> <tr> <?php foreach ($gallery_columns as $key => $value) { if (in_array($key, $hidden_columns)) { continue; } echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>'; } ?> </tr> </thead> <tfoot> <tr> <?php foreach ($gallery_columns as $key => $value) { if (in_array($key, $hidden_columns)) { continue; } if ($key == 'cb') { $value = ''; } echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>'; } ?> </tr> </tfoot> <tbody> <?php $counter = 0; if ($picturelist) { $rt = array(24.5, 45.7, 54.8, 59.3, 64.7, 68.90000000000001, 71.5, 73.7, 75.90000000000001, 77.09999999999999); foreach ($picturelist as $picture) { //for search result we need to check the capatibiliy if (!flagAdmin::can_manage_this_gallery($picture->author) && $is_search) { continue; } $hits = intval($picture->hitcounter); $votes = intval($picture->total_votes); $counter++; $pid = (int) $picture->pid; $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : 'alternate'; $exclude = $picture->exclude ? 'checked="checked"' : ''; $date = mysql2date(get_option('date_format'), $picture->imagedate); $time = mysql2date(get_option('time_format'), $picture->imagedate); ?> <tr id="picture-<?php echo $pid; ?> " class="<?php echo $alternate; ?> iedit" valign="top"> <?php foreach ($gallery_columns as $gallery_column_key => $column_display_name) { $class = "class=\"{$gallery_column_key} column-{$gallery_column_key}\""; $style = ''; if (in_array($gallery_column_key, $hidden_columns)) { continue; } $attributes = "{$class}{$style}"; switch ($gallery_column_key) { case 'cb': ?> <th <?php echo $attributes; ?> scope="row"><input name="doaction[]" type="checkbox" value="<?php echo $pid; ?> " /></th> <?php break; case 'id': ?> <td <?php echo $attributes; ?> ><?php echo $pid; ?> <input type="hidden" name="pid[]" value="<?php echo $pid; ?> " /> </td> <?php break; case 'thumbnail': ?> <td <?php echo $attributes; ?> ><a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <img class="thumb" src="<?php echo $picture->thumbURL; ?> " id="thumb-<?php echo $pid; ?> " /> </a> </td> <?php break; case 'filename': ?> <td <?php echo $attributes; ?> > <strong><a href="<?php echo $picture->imageURL; ?> " class="thickbox" title="<?php echo $picture->filename; ?> "> <?php echo $picture->filename; ?> </a></strong> <br /><?php echo $date; ?> <?php if (!empty($picture->meta_data['width'])) { echo '<br />' . __('Image size: ', 'flash-album-gallery') . $picture->meta_data['width'] . 'x' . $picture->meta_data['height']; } else { $imgpath = WINABSPATH . $picture->path . "/" . $picture->filename; $img = @getimagesize($imgpath); if ($img) { echo '<br />' . __('Image size: ', 'flash-album-gallery') . $img[0] . 'x' . $img[1]; } } ?> <?php if (!empty($picture->meta_data['thumbnail'])) { echo '<br />' . __('Thumbnail size: ', 'flash-album-gallery') . $picture->meta_data['thumbnail']['width'] . 'x' . $picture->meta_data['thumbnail']['height']; } ?> <?php if (!empty($picture->meta_data['webview'])) { echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . $picture->meta_data['webview'][0] . 'x' . $picture->meta_data['webview'][1]; } else { echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . __('not optimized ', 'flash-album-gallery'); } ?> <p> <?php $actions = array(); $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flash-album-gallery') . '</a>'; $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'flash-album-gallery') . '">' . __('Meta', 'flash-album-gallery') . '</a>'; $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'flash-album-gallery') . '">' . __('Edit thumb', 'flash-album-gallery') . '</a>'; $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&mode=delpic&gid=" . $act_gid . "&pid=" . $pid, 'flag_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s"', 'flash-album-gallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete', 'flash-album-gallery') . '</a>'; $action_count = count($actions); $i = 0; echo '<div class="row-actions">'; foreach ($actions as $action => $link) { ++$i; $i == $action_count ? $sep = '' : ($sep = ' | '); echo "<span class='{$action}'>{$link}{$sep}</span>"; } echo '</div>'; ?> </p> </td> <?php break; case 'views_likes': ?> <td <?php echo $attributes; ?> > <input name="hitcounter[<?php echo $pid; ?> ]" type="text" value="<?php echo stripslashes($picture->hitcounter); ?> " /> / <input name="total_votes[<?php echo $pid; ?> ]" type="text" value="<?php echo stripslashes($picture->total_votes); ?> " /> </td> <?php break; case 'rating': ?> <td <?php echo $attributes; ?> > <?php if ($votes == 0) { $like = '0.0'; } else { if ($votes < 11) { $like = $rt[$votes - 1]; } else { $like = round((100 - $rt[count($rt) - 1]) / ($hits > 0 ? $hits : 1) * ($votes <= $hits ? $votes : $hits), 1) + $rt[count($rt) - 1]; } } echo $like . '%'; ?> </td> <?php break; case 'alt_title_desc': ?> <td <?php echo $attributes; ?> > <input name="alttext[<?php echo $pid; ?> ]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo esc_html(stripslashes($picture->alttext)); ?> " /><br/> <textarea name="description[<?php echo $pid; ?> ]" style="width:95%; margin-top: 2px;" rows="2" ><?php echo esc_html(stripslashes($picture->description)); ?> </textarea> <input name="link[<?php echo $pid; ?> ]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php echo esc_attr(stripslashes($picture->link)); ?> " placeholder="(optional for skin) URL for linked button" /><br/> </td> <?php break; case 'exclude': ?> <td <?php echo $attributes; ?> ><input name="exclude[<?php echo $pid; ?> ]" type="checkbox" value="1" <?php echo $exclude; ?> /></td> <?php break; /* case 'views' : ?> <td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td> <?php break; */ /* case 'views' : ?> <td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td> <?php break; */ default: ?> <td <?php echo $attributes; ?> ><?php do_action('flag_manage_gallery_custom_column', $gallery_column_key, $pid); ?> </td> <?php break; } ?> <?php } ?> </tr> <?php } } // In the case you have no capaptibility to see the search result if ($counter == 0) { echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'flash-album-gallery') . '</strong></td></tr>'; } ?> </tbody> </table> <p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php _e("Save Changes", 'flash-album-gallery'); ?> " /></p> </form> <br class="clear"/> </div><!-- /#wrap --> <!-- #selectgallery --> <div id="selectgallery" style="display: none;" > <form id="form-select-gallery" method="POST" action="<?php echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1'); ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_thickbox_form'); ?> <input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" /> <input type="hidden" name="page" value="manage-images" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr> <th> <?php _e('Select the destination gallery:', 'flash-album-gallery'); ?> <select name="dest_gid" style="width:90%" > <?php foreach ($gallerylist as $gallery) { if ($gallery->gid != $act_gid) { ?> <option value="<?php echo $gallery->gid; ?> " ><?php echo $gallery->gid; ?> - <?php echo esc_html($gallery->title); ?> </option> <?php } } ?> </select> </th> </tr> <tr align="right"> <td class="submit"> <input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php _e("OK", 'flash-album-gallery'); ?> " /> <input class="button-secondary" type="reset" value="<?php _e("Cancel", 'flash-album-gallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#selectgallery --> <!-- #resize_images --> <div id="resize_images" style="display: none;" > <form id="form-resize-images" method="POST" action="<?php echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1'); ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_thickbox_form'); ?> <input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" /> <input type="hidden" name="page" value="manage-images" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr valign="top"> <td> <strong><?php _e('Resize Images to', 'flash-album-gallery'); ?> :</strong> </td> <td> <input type="text" size="5" name="imgWidth" value="<?php echo $flag->options['imgWidth']; ?> " /> x <input type="text" size="5" name="imgHeight" value="<?php echo $flag->options['imgHeight']; ?> " /> <br /><small><?php _e('Width x height (in pixel). Grand Flagallery will keep ratio size', 'flash-album-gallery'); ?> </small> </td> </tr> <tr align="right"> <td colspan="2" class="submit"> <input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php _e('OK', 'flash-album-gallery'); ?> " /> <input class="button-secondary" type="reset" value=" <?php _e('Cancel', 'flash-album-gallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#resize_images --> <!-- #new_thumbnail --> <div id="new_thumbnail" style="display: none;" > <form id="form-new-thumbnail" method="POST" action="<?php echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1'); ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_thickbox_form'); ?> <input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" /> <input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" /> <input type="hidden" name="page" value="manage-images" /> <table width="100%" border="0" cellspacing="3" cellpadding="3" > <tr valign="top"> <th align="left"><?php _e('Width x height (in pixel)', 'flash-album-gallery'); ?> </th> <td><input type="text" size="5" maxlength="5" name="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?> " /> x <input type="text" size="5" maxlength="5" name="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?> " /> <br /><small><?php _e('These values are maximum values ', 'flash-album-gallery'); ?> </small></td> </tr> <tr valign="top"> <th align="left"><?php _e('Set fix dimension', 'flash-album-gallery'); ?> </th> <td><input type="checkbox" name="thumbFix" value="1" <?php checked('1', $flag->options['thumbFix']); ?> /> <br /><small><?php _e('Ignore the aspect ratio, no portrait thumbnails', 'flash-album-gallery'); ?> </small></td> </tr> <tr align="right"> <td colspan="2" class="submit"> <input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php _e('OK', 'flash-album-gallery'); ?> " /> <input class="button-secondary" type="reset" value=" <?php _e('Cancel', 'flash-album-gallery'); ?> " onclick="tb_remove()"/> </td> </tr> </table> </form> </div> <!-- /#new_thumbnail --> <script type="text/javascript"> /* <![CDATA[ */ jQuery(document).ready(function(){columns.init('flag-manage-images');}); /* ]]> */ </script> <?php }
function flag_admin_options() { global $flag; // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0 $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']); if (isset($_POST['updateoption'])) { check_admin_referer('flag_settings'); // get the hidden option fields, taken from WP core $options = array(); if ($_POST['page_options']) { $options = explode(',', stripslashes($_POST['page_options'])); } if (!empty($options)) { foreach ($options as $option) { $option = trim($option); if (isset($_POST[$option])) { $value = trim($_POST[$option]); } else { $value = false; } $flag->options[$option] = $value; } if (isset($_POST['galleryPath'])) { // the path should always end with a slash $flag->options['galleryPath'] = trailingslashit($flag->options['galleryPath']); } // the custom sortorder must be ascending //$flag->options['galSortDir'] = ($flag->options['galSort'] == 'sortorder') ? 'ASC' : $flag->options['galSortDir']; } // Save options update_option('flag_options', $flag->options); flagGallery::show_message(__('Update Successfully', 'flag')); } $regform = 0; if (isset($_POST['membership'])) { if (function_exists('curl_init')) { check_admin_referer('flag_settings'); $ch = curl_init('http://mypgc.co/app/account_st.php'); curl_setopt($ch, CURLOPT_REFERER, site_url()); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array('access_key' => $_POST['access_key'], 'access_url' => $_POST['access_url'], 'license_key' => $_POST['license_key'])); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $access_key_return = curl_exec($ch); curl_close($ch); } else { $access_key_return = __('cURL library is not installed on your server.', 'flag'); } if (strpos($access_key_return, 'Error') !== FALSE) { $_POST['license_key'] = ''; } $options = explode(',', stripslashes($_POST['page_options'])); foreach ($options as $option) { $option = trim($option); $value = trim($_POST[$option]); $flag->options[$option] = $value; } if (strpos($access_key_return, 'Error') === FALSE || strpos($access_key_return, 'not a member') !== FALSE) { flagGallery::show_message($access_key_return); if (strpos($access_key_return, 'not a member') !== FALSE) { $regform = 1; //$flag->options['access_key'] = ''; } } else { flagGallery::show_error($access_key_return); //$flag->options['access_key'] = ''; } // Save options update_option('flag_options', $flag->options); } if (isset($_POST['register_subscriber'])) { if (empty($_POST['customer_first_name']) || empty($_POST['customer_last_name']) || empty($_POST['customer_email'])) { $regform = 1; flagGallery::show_error(__('Error: All fields required.')); } else { if (function_exists('curl_init')) { check_admin_referer('flag_settings'); $ch = curl_init('http://mypgc.co/app/account_st.php'); curl_setopt($ch, CURLOPT_REFERER, site_url()); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array('access_key' => $_POST['access_key'], 'access_url' => $_POST['access_url'], 'customer_first_name' => $_POST['customer_first_name'], 'customer_last_name' => $_POST['customer_last_name'], 'customer_email' => $_POST['customer_email'])); $reg_return = curl_exec($ch); curl_close($ch); } else { $reg_return = __('cURL library is not installed on your server.', 'flag'); } if (strpos($reg_return, 'Error') === FALSE) { flagGallery::show_message($reg_return); } else { flagGallery::show_error($reg_return); $regform = 1; } } } if (isset($_POST['update_cap'])) { check_admin_referer('flag_addroles'); // now set or remove the capability flag_set_capability($_POST['general'], "FlAG overview"); flag_set_capability($_POST['tinymce'], "FlAG Use TinyMCE"); flag_set_capability($_POST['add_gallery'], "FlAG Upload images"); flag_set_capability($_POST['import_gallery'], "FlAG Import folder"); flag_set_capability($_POST['manage_gallery'], "FlAG Manage gallery"); flag_set_capability($_POST['manage_others'], "FlAG Manage others gallery"); flag_set_capability($_POST['change_skin'], "FlAG Change skin"); flag_set_capability($_POST['add_skins'], "FlAG Add skins"); flag_set_capability($_POST['delete_skins'], "FlAG Delete skins"); flag_set_capability($_POST['change_options'], "FlAG Change options"); flag_set_capability($_POST['manage_music'], "FlAG Manage music"); flag_set_capability($_POST['manage_video'], "FlAG Manage video"); flag_set_capability($_POST['manage_banners'], "FlAG Manage banners"); flag_set_capability($_POST['flagframe_page'], "FlAG iFrame page"); flagGallery::show_message(__('Updated capabilities', "flag")); } // message windows if (!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>' . $messagetext . '</p></div>'; } $flag_options = get_option('flag_options'); ?> <div id="slider" class="flag-wrap"> <ul id="tabs" class="tabs"> <li class="selected"><a href="#" rel="imageoptions"><?php _e('Gallery Options', 'flag'); ?> </a></li> <li><a href="#" rel="grandpages"><?php _e('GRAND Pages', 'flag'); ?> </a></li> <?php if (current_user_can('administrator')) { ?> <li><a href="#" rel="rControl"><?php _e('License Key & Remote Control', 'flag'); ?> </a></li> <?php } ?> <li><a href="#" rel="vPlayer"><?php _e('FLV Single Player Options', 'flag'); ?> </a></li> <li><a href="#" rel="mPlayer"><?php _e('MP3 Single Player Options', 'flag'); ?> </a></li> <?php if (flagGallery::flag_wpmu_enable_function('wpmuRoles')) { ?> <li><a href="#" rel="roles"><?php _e('Roles', 'flag'); ?> </a></li> <?php } ?> </ul> <!-- Image Gallery Options --> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.flag_colors .colorPick').each( function(){ var inpID = jQuery(this).attr('name'); jQuery('#cp_'+inpID).farbtastic('#'+inpID); jQuery('#'+inpID).focus( function(){ jQuery('#cp_'+inpID).show(); }); jQuery('#'+inpID).blur( function(){ jQuery('#cp_'+inpID).hide(); }); }); }); </script> <div id="imageoptions" class="cptab"> <form name="generaloptions" method="post"> <?php wp_nonce_field('flag_settings'); ?> <input type="hidden" name="page_options" value="galleryPath,flashWidth,flashHeight,deleteImg,deepLinks,useMediaRSS,optimized_imgs,jAlterGal,jAlterGalScript,BarsBG,CatBGColor,CatBGColorOver,CatColor,CatColorOver,ThumbBG,ThumbLoaderColor,TitleColor,DescrColor,imgQuality,albSort,albSortDir,albPerPage,galSort,galSortDir,disableViews" /> <h2><?php _e('Image Gallery Options', 'flag'); ?> </h2> <h3><?php _e('General Options', 'flag'); ?> </h3> <table class="form-table flag-options" style="width: auto; white-space: nowrap;"> <tr valign="top"> <th align="left" width="200"><?php _e('Gallery path', 'flag'); ?> </th> <td><input readonly="readonly" type="text" size="35" name="galleryPath" value="<?php echo $flag_options['galleryPath']; ?> " /> <span class="setting-description"><?php _e('This is the default path for all galleries', 'flag'); ?> </span></td> </tr> <tr valign="top"> <th><?php _e('Default flash size (W x H)', 'flag'); ?> :</th> <td><input type="text" size="4" maxlength="4" name="flashWidth" value="<?php echo $flag_options['flashWidth']; ?> " /> x <input type="text" size="4" maxlength="4" name="flashHeight" value="<?php echo $flag_options['flashHeight']; ?> " /></td> </tr> <tr valign="top"> <th align="left"><?php _e('Delete image files', 'flag'); ?> </th> <td><input <?php if (IS_WPMU) { echo 'readonly = "readonly"'; } ?> type="checkbox" name="deleteImg" value="1" <?php checked('1', $flag_options['deleteImg']); ?> /> <?php _e('Delete files, when removing a gallery in the database', 'flag'); ?> </td> </tr> <tr> <th align="left"><?php _e('Activate Deep Linking (optional)', 'flag'); ?> <br /><small><?php _e('Not all skins support this feature.', 'flag'); ?> </small></th> <td><input type="checkbox" name="deepLinks" value="1" <?php checked('1', $flag_options['deepLinks']); ?> /> <span class="setting-description"><?php _e('Deep links for images in flash.', 'flag'); ?> </span></td> </tr> <tr> <th align="left"><?php _e('Activate Media RSS feed', 'flag'); ?> </th> <td><input type="checkbox" name="useMediaRSS" value="1" <?php checked('1', $flag_options['useMediaRSS']); ?> /> <span class="setting-description"><?php _e('A RSS feed will be added to you blog header.', 'flag'); ?> </span></td> </tr> </table> <h3><?php _e('Image settings', 'flag'); ?> </h3> <table class="form-table flag-options" style="width: auto; white-space: nowrap;"> <tr valign="top"> <th scope="row" width="200"><label><?php _e('Use optimized images for mobile browsers', 'flag'); ?> </label><br /><small>(Manage Gallery -> 'Optimize images for web' action)</small></th> <td><input type="checkbox" name="optimized_imgs" value="1" <?php checked('1', $flag_options['optimized_imgs']); ?> /> <span class="setting-description"><?php _e('Optimized images loads faster, save traffic and make page more lightweight for browser', 'flag'); ?> </span></td> </tr> <tr valign="top"> <th align="left"><?php _e('Image quality', 'flag'); ?> </th> <td><input type="text" size="3" maxlength="3" name="imgQuality" value="<?php echo $flag_options['imgQuality']; ?> " /> % <span class="setting-description"><?php _e('Default: 85%', 'flag'); ?> </span></td> </tr> </table> <h3><?php _e('Sort options', 'flag'); ?> </h3> <table class="form-table flag-options" style="width: auto; white-space: nowrap;"> <tr> <th valign="top" width="200"><?php _e('Sort galleries', 'flag'); ?> :</th> <td valign="top"> <label><input name="albSort" type="radio" value="gid" <?php checked('gid', $flag_options['albSort']); ?> /> <?php _e('Gallery ID', 'flag'); ?> </label><br /> <label><input name="albSort" type="radio" value="title" <?php checked('title', $flag_options['albSort']); ?> /> <?php _e('Title', 'flag'); ?> </label><br /> </td> <td valign="top"><label><input name="albSortDir" type="radio" value="ASC" <?php checked('ASC', $flag_options['albSortDir']); ?> /> <?php _e('Ascending', 'flag'); ?> </label><br /> <label><input name="albSortDir" type="radio" value="DESC" <?php checked('DESC', $flag_options['albSortDir']); ?> /> <?php _e('Descending', 'flag'); ?> </label> </td> </tr> <tr style="border-bottom: 1px solid #000000;"> <th valign="top" width="200"><?php _e('Galleries per page: <br><small>on Manage Galleries page</small>', 'flag'); ?> </th> <td valign="top"> <input name="albPerPage" type="text" value="<?php echo $flag_options['albPerPage']; ?> " /> </td> <td valign="top"></td> </tr> <tr> <th valign="top" width="200"><?php _e('Sort images', 'flag'); ?> :</th> <td valign="top"> <label><input name="galSort" type="radio" value="sortorder" <?php checked('sortorder', $flag_options['galSort']); ?> /> <?php _e('Custom order', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="pid" <?php checked('pid', $flag_options['galSort']); ?> /> <?php _e('Image ID', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="filename" <?php checked('filename', $flag_options['galSort']); ?> /> <?php _e('File name', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $flag_options['galSort']); ?> /> <?php _e('Alt / Title text', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="imagedate" <?php checked('imagedate', $flag_options['galSort']); ?> /> <?php _e('Date / Time', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="hitcounter" <?php checked('hitcounter', $flag_options['galSort']); ?> /> <?php _e('Image views', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="total_votes" <?php checked('total_votes', $flag_options['galSort']); ?> /> <?php _e('Image likes', 'flag'); ?> </label><br /> <label><input name="galSort" type="radio" value="rand()" <?php checked('rand()', $flag_options['galSort']); ?> /> <?php _e('Randomly', 'flag'); ?> </label> </td> <td valign="top"><label><input name="galSortDir" type="radio" value="ASC" <?php checked('ASC', $flag_options['galSortDir']); ?> /> <?php _e('Ascending', 'flag'); ?> </label><br /> <label><input name="galSortDir" type="radio" value="DESC" <?php checked('DESC', $flag_options['galSortDir']); ?> /> <?php _e('Descending', 'flag'); ?> </label> </td> </tr> </table> <h3><?php _e('Alternative Gallery Options', 'flag'); ?> <br><small style="color: darkgreen;"><?php _e('(Note: this is not flash skin option. Options below only for alternative gallery in mobile browsers)', 'flag'); ?> </small></h3> <table class="flag_colors form-table flag-options" style="width: auto; white-space: nowrap;"> <tr> <th align="left"><?php _e('Show jQuery gallery for browsers without flashplayer', 'flag'); ?> </th> <td><input type="checkbox" name="jAlterGal" value="1" <?php checked('1', $flag_options['jAlterGal']); ?> /></td> </tr> <tr> <th align="left"><?php _e('jQuery gallery script', 'flag'); ?> </th> <td><select name="jAlterGalScript"> <option value="0" <?php selected('0', $flag_options['jAlterGalScript']); ?> >FancyBox</option> <option value="1" <?php selected('1', $flag_options['jAlterGalScript']); ?> >PhotoSwipe</option> </select> </td> </tr> <tr> <th align="left"><?php _e('Disable image views/likes counter on thumbnails', 'flag'); ?> </th> <td><input type="checkbox" name="disableViews" value="1" <?php checked('1', $flag_options['disableViews']); ?> /></td> </tr> <tr> <th width="200"><?php _e('Top Bar BG', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="BarsBG" name="BarsBG" value="<?php echo $flag_options['BarsBG']; ?> " /><div id="cp_BarsBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Category Buttons BG', 'flag'); ?> :</th> <td> <input class="colorPick" type="text" size="7" maxlength="6" id="CatBGColorOver" name="CatBGColorOver" value="<?php echo $flag_options['CatBGColorOver']; ?> " /> mouseOver<br /> <div id="cp_CatBGColorOver" style="background:#F9F9F9;position:absolute;display:none;"></div> <input class="colorPick" type="text" size="7" maxlength="6" id="CatBGColor" name="CatBGColor" value="<?php echo $flag_options['CatBGColor']; ?> " /> mouseOut<br /> <div id="cp_CatBGColor" style="background:#F9F9F9;position:absolute;display:none;"></div> </td> </tr> <tr> <th><?php _e('Category Buttons Color', 'flag'); ?> :</th> <td> <input class="colorPick" type="text" size="7" maxlength="6" id="CatColorOver" name="CatColorOver" value="<?php echo $flag_options['CatColorOver']; ?> " /> mouseOver<br /> <div id="cp_CatColorOver" style="background:#F9F9F9;position:absolute;display:none;"></div> <input class="colorPick" type="text" size="7" maxlength="6" id="CatColor" name="CatColor" value="<?php echo $flag_options['CatColor']; ?> " /> mouseOut<br /> <div id="cp_CatColor" style="background:#F9F9F9;position:absolute;display:none;"></div> </td> </tr> <tr> <th><?php _e('Thumbnail BG', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="ThumbBG" name="ThumbBG" value="<?php echo $flag_options['ThumbBG']; ?> " /><div id="cp_ThumbBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Thumbnail MouseOver BG', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="ThumbLoaderColor" name="ThumbLoaderColor" value="<?php echo $flag_options['ThumbLoaderColor']; ?> " /><div id="cp_ThumbLoaderColor" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Fancybox Title', 'flag'); ?> :<br /><small><?php _e('Only if FancyBox script is selected', 'flag'); ?> </small></th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="TitleColor" name="TitleColor" value="<?php echo $flag_options['TitleColor']; ?> " /><div id="cp_TitleColor" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Fancybox Description Text', 'flag'); ?> :<br /><small><?php _e('Only if FancyBox script is selected', 'flag'); ?> </small></th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="DescrColor" name="DescrColor" value="<?php echo $flag_options['DescrColor']; ?> " /><div id="cp_DescrColor" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> </table> <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes', 'flag'); ?> "/></div> </form> </div> <div id="grandpages" class="cptab"> <form name="grandpages" method="post"> <?php wp_nonce_field('flag_settings'); ?> <input type="hidden" name="page_options" value="gp_jscode" /> <h2><?php _e('GRAND Pages settings', 'flag'); ?> </h2> <h3><?php _e('Google Analytics Tracking Code', 'flag'); ?> </h3> <textarea name="gp_jscode" rows="5" cols="50"><?php if (isset($flag_options['gp_jscode'])) { echo stripslashes($flag_options['gp_jscode']); } ?> </textarea> <p><?php _e('Enter your Google analytics tracking Code here. It will automatically be added to GRAND Pages so google can track your visitors behavior.', 'flag'); ?> </p> <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes', 'flag'); ?> "/></div> </form> </div> <?php if (current_user_can('administrator')) { ?> <div id="rControl" class="cptab"> <form name="rControl" method="post" style="float: left;width: 50%;"> <?php wp_nonce_field('flag_settings'); ?> <input type="hidden" name="page_options" value="access_key,license_key" /> <h2><?php _e('License Key & Remote Control', 'flag'); ?> </h2> <input type="hidden" name="access_url" value="<?php echo plugins_url() . '/' . FLAGFOLDER . '/lib/app.php'; ?> " /> <table class="form-table flag-options" style=""> <tr> <th valign="top" width="200"><a href="http://mypgc.co/membership/" target="_blank"><?php _e('License Key', 'flag'); ?> </a>:</th> <td valign="top"><input type="text" size="40" id="license_key" name="license_key" value="<?php echo $flag_options['license_key']; ?> " /></td> </tr> <tr> <td colspan="2"><br><?php _e('If you want to upload photos to FlAGallery right from your iPhone <a href="https://itunes.apple.com/us/app/mypgc/id663405181?ls=1&mt=8">download application</a> and enter access key below. You can enter your own access key. You can change these at any point in time and this will force all users to have to log in again in application.', 'flag'); ?> </td> </tr> <tr> <th valign="top" width="200"><?php _e('Remote App Access Key', 'flag'); ?> :</th> <td valign="top"><input type="text" size="40" id="access_key" name="access_key" value="<?php echo $flag_options['access_key']; ?> " /> <button type="button" onclick="jQuery('#flag_register_form').toggle();"><?php _e('Register free account Form', 'flag'); ?> </button> <br><small><?php _e('Leave blank to disable access from application', 'flag'); ?> </small></td> </tr> </table> <p><a href="https://itunes.apple.com/us/app/mypgc/id663405181?ls=1&mt=8"><img src="<?php echo plugins_url() . '/' . FLAGFOLDER; ?> /admin/images/appstore_button.png" alt="Download from AppStore" /></a></p> <div class="submit"><input class="button-primary" type="submit" name="membership" value="<?php _e('Update Settings for Remote Access', 'flag'); ?> "/></div> </form> <form id="flag_register_form" name="reg_on_mypgc" method="post" style="<?php if (!$regform || !empty($flag_options['access_key'])) { ?> display:none;<?php } ?> float: left; border: 1px solid #666666; background-color: #ffffee; margin-top: 95px; width: 49%;"> <?php wp_nonce_field('flag_settings'); ?> <h3 style="padding-left: 10px;"><?php _e('Register with form below or <a href="http://mypgc.co/membership/" target="_blank">purchase license key</a>', 'flag'); ?> </h3> <div style="padding:0 10px;"> <p><?php _e("this email and password that you'll receive will be used to login in iOS application", 'flag'); ?> </p> <p><b><?php _e("Note: if you already purchased license key or already registered this website you don't need register again. Just create your own Access Key and Save", 'flag'); ?> </b></p> </div> <input type="hidden" name="access_key" value="<?php echo $flag_options['access_key']; ?> " /> <input type="hidden" name="access_url" value="<?php echo plugins_url() . '/' . FLAGFOLDER . '/lib/app.php'; ?> " /> <table class="form-table" style="100%;"> <tr> <td valign="top" style="width: 50%;"><?php _e('First Name', 'flag'); ?> :<br><input type="text" id="customer_first_name" name="customer_first_name" value="" style="width: 95%;" /></td> <td valign="top"><?php _e('Last Name', 'flag'); ?> :<br><input type="text" id="customer_last_name" name="customer_last_name" value="" style="width: 95%;" /></td> </tr> <tr> <td valign="top"><?php _e('Email', 'flag'); ?> :<br><input type="text" size="54" id="customer_email" name="customer_email" value="" style="width: 95%;" /></td> <td valign="top"><div class="submit"><input class="button-primary" type="submit" name="register_subscriber" value="<?php _e('Register', 'flag'); ?> "/></div></td> </tr> </table> </form> <div style="clear: both;"> </div> </div> <?php } ?> <div id="vPlayer" class="cptab"> <form name="vPlayer" method="post"> <?php wp_nonce_field('flag_settings'); ?> <input type="hidden" name="page_options" value="videoBG,vmColor1,vmColor2,vmAutoplay,vmWidth,vmHeight" /> <h2><?php _e('Flash Video Player Colors', 'flag'); ?> </h2> <table class="flag_colors form-table flag-options" style="width: auto; white-space: nowrap;"> <tr> <th width="200"><?php _e('Video BG', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="videoBG" name="videoBG" value="<?php echo $flag_options['videoBG']; ?> " /><div id="cp_videoBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Color 1', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="vmColor1" name="vmColor1" value="<?php echo $flag_options['vmColor1']; ?> " /><div id="cp_vmColor1" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Color 2', 'flag'); ?> :</th> <td> <input class="colorPick" type="text" size="7" maxlength="6" id="vmColor2" name="vmColor2" value="<?php echo $flag_options['vmColor2']; ?> " /><div id="cp_vmColor2" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Autoplay', 'flag'); ?> :</th> <td> <label><input name="vmAutoplay" type="radio" value="true" <?php checked('true', $flag_options['vmAutoplay']); ?> /> <?php _e('True', 'flag'); ?> </label><br /> <label><input name="vmAutoplay" type="radio" value="false" <?php checked('false', $flag_options['vmAutoplay']); ?> /> <?php _e('False', 'flag'); ?> </label><br /> </td> </tr> <tr> <th><?php _e('Default Size', 'flag'); ?> :<br /><small>(width x height)</small></th> <td> <input name="vmWidth" type="text" size="3" maxlength="3" value="<?php echo $flag_options['vmWidth']; ?> " /> x <input name="vmHeight" type="text" size="3" maxlength="3" value="<?php echo $flag_options['vmHeight']; ?> " /> </td> </tr> </table> <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes', 'flag'); ?> "/></div> </form> </div> <div id="mPlayer" class="cptab"> <form name="mPlayer" method="post"> <?php wp_nonce_field('flag_settings'); ?> <input type="hidden" name="page_options" value="mpBG,mpColor1,mpColor2,mpAutoplay" /> <h2><?php _e('MP3 Player Colors', 'flag'); ?> </h2> <table class="flag_colors form-table flag-options" style="width: auto; white-space: nowrap;"> <tr> <th width="200"><?php _e('Player BG', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="mpBG" name="mpBG" value="<?php echo $flag_options['mpBG']; ?> " /><div id="cp_mpBG" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Color 1', 'flag'); ?> :</th> <td><input class="colorPick" type="text" size="7" maxlength="6" id="mpColor1" name="mpColor1" value="<?php echo $flag_options['mpColor1']; ?> " /><div id="cp_mpColor1" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Color 2', 'flag'); ?> :</th> <td> <input class="colorPick" type="text" size="7" maxlength="6" id="mpColor2" name="mpColor2" value="<?php echo $flag_options['mpColor2']; ?> " /><div id="cp_mpColor2" style="background:#F9F9F9;position:absolute;display:none;"></div></td> </tr> <tr> <th><?php _e('Autoplay', 'flag'); ?> :</th> <td> <label><input name="mpAutoplay" type="radio" value="true" <?php checked('true', $flag_options['mpAutoplay']); ?> /> <?php _e('True', 'flag'); ?> </label><br /> <label><input name="mpAutoplay" type="radio" value="false" <?php checked('false', $flag_options['mpAutoplay']); ?> /> <?php _e('False', 'flag'); ?> </label><br /> </td> </tr> </table> <div class="submit"><input class="button-primary" type="submit" name="updateoption" value="<?php _e('Save Changes', 'flag'); ?> "/></div> </form> </div> <?php if (flagGallery::flag_wpmu_enable_function('wpmuRoles')) { ?> <div id="roles" class="cptab"> <form method="POST" name="addroles" id="addroles" accept-charset="utf-8"> <?php wp_nonce_field('flag_addroles'); ?> <h2><?php _e('Roles / capabilities', 'flag'); ?> </h2> <div> </div> <p><?php _e('Select the lowest role which should be able to access the follow capabilities. Flash Album Gallery supports the standard roles from WordPress.', 'flag'); ?> </p> <table class="form-table"> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Main Flash Album Gallery overview', 'flag'); ?> :</th> <td><label for="general"><select style="width: 150px;" name="general" id="general"><?php wp_dropdown_roles(flag_get_role('FlAG overview')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('View TinyMCE Button / GRAND Pages', 'flag'); ?> :</th> <td><label for="tinymce"><select style="width: 150px;" name="tinymce" id="tinymce"><?php wp_dropdown_roles(flag_get_role('FlAG Use TinyMCE')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Add gallery / Upload images', 'flag'); ?> :</th> <td><label for="add_gallery"><select style="width: 150px;" name="add_gallery" id="add_gallery"><?php wp_dropdown_roles(flag_get_role('FlAG Upload images')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Import images folder', 'flag'); ?> :</th> <td><label for="add_gallery"><select style="width: 150px;" name="import_gallery" id="import_gallery"><?php wp_dropdown_roles(flag_get_role('FlAG Import folder')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Manage gallery', 'flag'); ?> :</th> <td><label for="manage_gallery"><select style="width: 150px;" name="manage_gallery" id="manage_gallery"><?php wp_dropdown_roles(flag_get_role('FlAG Manage gallery')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Manage others galleries and Albums', 'flag'); ?> :</th> <td><label for="manage_others"><select style="width: 150px;" name="manage_others" id="manage_others"><?php wp_dropdown_roles(flag_get_role('FlAG Manage others gallery')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Manage music', 'flag'); ?> :</th> <td><label for="manage_music"><select style="width: 150px;" name="manage_music" id="manage_music"><?php wp_dropdown_roles(flag_get_role('FlAG Manage music')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Manage video', 'flag'); ?> :</th> <td><label for="manage_video"><select style="width: 150px;" name="manage_video" id="manage_video"><?php wp_dropdown_roles(flag_get_role('FlAG Manage video')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Manage banners', 'flag'); ?> :</th> <td><label for="manage_banners"><select style="width: 150px;" name="manage_banners" id="manage_banners"><?php wp_dropdown_roles(flag_get_role('FlAG Manage banners')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Change skin', 'flag'); ?> :</th> <td><label for="change_skin"><select style="width: 150px;" name="change_skin" id="change_skin"><?php wp_dropdown_roles(flag_get_role('FlAG Change skin')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Add skins', 'flag'); ?> :</th> <td><label for="add_skins"><select style="width: 150px;" name="add_skins" id="add_skins"><?php wp_dropdown_roles(flag_get_role('FlAG Add skins')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Delete skins', 'flag'); ?> :</th> <td><label for="delete_skins"><select style="width: 150px;" name="delete_skins" id="delete_skins"><?php wp_dropdown_roles(flag_get_role('FlAG Delete skins')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('Change options', 'flag'); ?> :</th> <td><label for="change_options"><select style="width: 150px;" name="change_options" id="change_options"><?php wp_dropdown_roles(flag_get_role('FlAG Change options')); ?> </select></label></td> </tr> <tr valign="top"> <th scope="row" style="white-space: nowrap"><?php _e('iFrame page', 'flag'); ?> :</th> <td><label for="flagframe_page"><select style="width: 150px;" name="flagframe_page" id="flagframe_page"><?php wp_dropdown_roles(flag_get_role('FlAG iFrame page')); ?> </select></label></td> </tr> </table> <div class="submit"><input type="submit" class="button-primary" name= "update_cap" value="<?php _e('Update capabilities', 'flag'); ?> "/></div> </form> </div> <?php } ?> </div> <script type="text/javascript"> var cptabs=new ddtabcontent("tabs"); cptabs.setpersist(true); cptabs.setselectedClassTarget("linkparent"); cptabs.init(); </script> <?php }
/** * Copy images to another gallery * * @class flagAdmin * @param array|int $pic_ids ID's of the images * @param int $dest_gid destination gallery * @return void */ static function copy_images($pic_ids, $dest_gid) { $errors = $messages = ''; if (!is_array($pic_ids)) { $pic_ids = array($pic_ids); } // Get destination gallery $destination = flagdb::find_gallery($dest_gid); if ($destination == null) { flagGallery::show_error(__('The destination gallery does not exist', 'flag')); return; } // Check for folder permission if (!is_writeable(WINABSPATH . $destination->path)) { $message = sprintf(__('Unable to write to directory %s. Is this directory writable by the server?', 'flag'), WINABSPATH . $destination->path); flagGallery::show_error($message); return; } // Get pictures $images = flagdb::find_images_in_list($pic_ids); $destination_path = WINABSPATH . $destination->path; foreach ($images as $image) { // WPMU action if (flagAdmin::check_quota()) { return; } $i = 0; $tmp_prefix = ''; $destination_file_name = $image->filename; while (file_exists($destination_path . '/' . $destination_file_name)) { $tmp_prefix = 'copy_' . $i++ . '_'; $destination_file_name = $tmp_prefix . $image->filename; } $destination_file_path = $destination_path . '/' . $destination_file_name; $destination_thumb_file_path = $destination_path . '/' . $image->thumbFolder . $image->thumbPrefix . $destination_file_name; // Copy files if (!@copy($image->imagePath, $destination_file_path)) { $errors .= sprintf(__('Failed to copy image %1$s to %2$s', 'flag'), $image->filename, $destination_file_path) . '<br />'; continue; } // Copy the thumbnail if possible @copy($image->thumbPath, $destination_thumb_file_path); // Create new database entry for the image $new_pid = flagdb::insert_image($destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude); if (!isset($new_pid)) { $errors .= sprintf(__('Failed to copy database row for picture %s', 'flag'), $image->pid) . '<br />'; continue; } if ($tmp_prefix != '') { $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s) » The file already existed in the destination gallery.', 'flag'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />'; } else { $messages .= sprintf(__('Image %1$s (%2$s) copied as image %3$s (%4$s)', 'flag'), $image->pid, $image->filename, $new_pid, $destination_file_name) . '<br />'; } } // Finish by showing errors or success if ($errors == '') { $link = '<a href="' . admin_url() . 'admin.php?page=flag-manage-gallery&mode=edit&gid=' . $destination->gid . '" >' . $destination->title . '</a>'; $messages .= '<hr />' . sprintf(__('Copied %1$s picture(s) to gallery: %2$s .', 'flag'), count($images), $link); } if ($messages != '') { flagGallery::show_message($messages); } if ($errors != '') { flagGallery::show_error($errors); } return; }
static function saveFile($sName, $sContent, $mode = 'w+') { if (!($dFile = fopen($sName, $mode))) { flagGallery::show_error(__("Can't create/open file '", "flag") . $sName . "'."); exit; } flock($dFile, LOCK_EX); ftruncate($dFile, 0); if ($result = fwrite($dFile, $sContent) === FALSE) { flagGallery::show_error(__("Can't write data to file '", "flag") . $sName . "'."); exit; } fflush($dFile); flock($dFile, LOCK_UN); fclose($dFile); return $result; }
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); } // check for correct capability if (!is_user_logged_in()) { die('-1'); } // check for correct FlAG capability if (!current_user_can('FlAG iFrame page')) { die('-1'); } if (isset($_POST['copy_file'])) { if (copy(FLAG_ABSPATH . 'flagframe.php', ABSPATH . 'flagframe.php')) { flagGallery::show_message(__('Success', 'flash-album-gallery')); } else { flagGallery::show_error(__('Failure', 'flash-album-gallery')); } } global $flag, $flagdb; require_once dirname(__FILE__) . '/get_skin.php'; require_once dirname(__FILE__) . '/playlist.functions.php'; require_once dirname(__FILE__) . '/video.functions.php'; require_once dirname(__FILE__) . '/banner.functions.php'; $i_skins = get_skins(); $all_m_playlists = get_playlists(); $all_v_playlists = get_v_playlists(); $all_b_playlists = get_b_playlists(); $fb_url = plugins_url() . '/flash-album-gallery/flagframe.php'; if (file_exists(ABSPATH . 'flagframe.php')) { $fb_url = home_url() . '/flagframe.php'; }
function flag_admin_add_gallery() { global $wpdb, $flagdb, $flag; // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0 $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']); // check for the max image size $maxsize = flagGallery::check_memory_limit(); $defaultpath = $flag->options['galleryPath']; if ($_POST['addgallery']) { check_admin_referer('flag_addgallery'); $newgallery = trim($_POST['galleryname']); if (!empty($newgallery)) { flagAdmin::create_gallery($newgallery, $defaultpath); } } if ($_POST['uploadimage']) { check_admin_referer('flag_upload'); $flag->options['thumbWidth'] = intval($_POST['thumbWidth']) ? intval($_POST['thumbWidth']) : 100; $flag->options['thumbHeight'] = intval($_POST['thumbHeight']) ? intval($_POST['thumbHeight']) : 100; $flag->options['thumbFix'] = isset($_POST['thumbFix']) ? 1 : 0; update_option('flag_options', $flag->options); if ($_FILES['MF__F_0_0']['error'] == 0) { flagAdmin::upload_images(); } else { flagGallery::show_error(__('Upload failed!', 'flag')); } } if ($_POST['importfolder']) { check_admin_referer('flag_addgallery'); $galleryfolder = $_POST['galleryfolder']; if (!empty($galleryfolder) and $defaultpath != $galleryfolder and false === strpos($galleryfolder, '..')) { flagAdmin::import_gallery($galleryfolder); } } if (isset($_POST['disable_flash'])) { check_admin_referer('flag_upload'); $flag->options['swfUpload'] = false; update_option('flag_options', $flag->options); } if (isset($_POST['enable_flash'])) { check_admin_referer('flag_upload'); $flag->options['swfUpload'] = true; update_option('flag_options', $flag->options); } //get all galleries (after we added new ones) $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir'], false, 0, 0, 0, true); ?> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?> admin/js/jqueryFileTree/jqueryFileTree.css"/> <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?> admin/js/jqueryFileTree/jqueryFileTree.js"></script> <script type="text/javascript"> /* <![CDATA[ */ jQuery(function(){ jQuery("span.browsefiles").show().click(function(){ jQuery("#file_browser").fileTree({ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce('flag-ajax'); ?> ", root: jQuery("#galleryfolder").val() }, function(file){ //var path = file.replace("<?php echo WINABSPATH; ?> ", ""); jQuery("#galleryfolder").val(file); }); jQuery("#file_browser").show("slide"); }); }); /* ]]> */ </script> <?php } ?> <div id="slider" class="flag-wrap"> <ul id="tabs" class="tabs"> <li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?> </a></li> <li><a href="#" rel="uploadimage"><?php _e('Upload Images', 'flag'); ?> </a></li> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <li><a href="#" rel="importfolder"><?php _e('Import image folder', 'flag'); ?> </a></li> <?php } ?> </ul> <!-- create gallery --> <div id="addgallery" class="cptab"> <h2><?php _e('Create a new gallery', 'flag'); ?> </h2> <form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_addgallery'); ?> <table class="form-table" style="width: auto;"> <tr> <th scope="col" colspan="2" style="padding-bottom: 0;"> <strong><?php _e('New Gallery', 'flag'); ?> </strong></th> </tr> <tr valign="top"> <td><input type="text" size="65" name="galleryname" value=""/><br/> <?php if (!IS_WPMU) { ?> <?php _e('Create a new , empty gallery below the folder', 'flag'); ?> <strong><?php echo $defaultpath; ?> </strong><br/> <?php } ?> <i>( <?php _e('Allowed characters for file and folder names are', 'flag'); ?> : a-z, A-Z, 0-9, -, _ )</i> </td> <?php do_action('flag_add_new_gallery_form'); ?> <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> </tr> </table> <p> </p> </form> </div> <!-- upload images --> <div id="uploadimage" class="cptab"> <h2><?php _e('Upload images', 'flag'); ?> </h2> <form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_upload'); ?> <table class="flag-form-table"> <tr valign="top"> <td style="width: 216px;"> <label for="galleryselect"><?php _e('Upload images in', 'flag'); ?> *</label> <select name="galleryselect" id="galleryselect" style="width: 200px"> <option value="0"><?php _e('Choose gallery', 'flag'); ?> </option> <?php $ingallery = isset($_GET['gid']) ? (int) $_GET['gid'] : ''; foreach ($gallerylist as $gallery) { if (!flagAdmin::can_manage_this_gallery($gallery->author)) { continue; } $name = empty($gallery->title) ? $gallery->name : esc_html(stripslashes($gallery->title)); if ($flag->options['albSort'] == 'gid') { $name = '#' . $gallery->gid . ' - ' . $name; } if ($flag->options['albSort'] == 'title') { $name = $name . ' (#' . $gallery->gid . ')'; } $sel = $ingallery == $gallery->gid ? 'selected="selected" ' : ''; echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n"; } ?> </select> <?php echo $maxsize; ?> <br/><?php if (IS_WPMU && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) { display_space_usage(); } ?> <br/> <p><?php _e('Thumbnail WIDTH x HEIGHT (in pixel)', 'flag'); ?> * <br/><input type="text" size="5" maxlength="5" name="thumbWidth" id="thumbWidth" value="<?php echo $flag->options['thumbWidth']; ?> "/> x <input type="text" size="5" maxlength="5" name="thumbHeight" id="thumbHeight" value="<?php echo $flag->options['thumbHeight']; ?> "/> <br/> <small><?php _e('These values are maximum values ', 'flag'); ?> </small> </p> <p> <label><input type="checkbox" name="thumbFix" id="thumbFix" value="1" <?php checked('1', $flag->options['thumbFix']); ?> /> <?php _e('Ignore the aspect ratio, no portrait thumbnails', 'flag'); ?> </label></p> <div class="submit"> <span class="useflashupload"> <?php if ($flag->options['swfUpload']) { ?> <input type="submit" class="button-secondary" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload via Plupload, disable it if you have problems', 'flag'); ?> " value="<?php _e('Switch to Browser Upload', 'flag'); ?> "/> <?php } else { ?> <input type="submit" class="button-secondary" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag'); ?> " value="<?php _e('Switch to Plupload based Upload', 'flag'); ?> "/> <?php } ?> </span> <div class="clear"></div> </div> </td> <td> <div id="pluploadUploader"> <?php if (!$flag->options['swfUpload']) { ?> <strong><?php _e('Upload image(s):', 'flag'); ?> </strong><br> <input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/> </div> <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> <?php } ?> </td> </tr> </table> <div id="pl-message"></div> </form> <?php if ($flag->options['swfUpload']) { $nonce = wp_create_nonce('flag_upload'); ?> <script type="text/javascript"> // Convert divs to queue widgets when the DOM is ready jQuery(function($){ var files_remaining = 0; $("#pluploadUploader").plupload({ runtimes: 'html5,flash,html4', url: '<?php echo str_replace('&', '&', wp_nonce_url(admin_url('admin-ajax.php?action=plupload_uploader'), 'flag_upload')); ?> ', multipart: true, multipart_params: {postData: '', pluploadimage: 1}, max_file_size: '<?php echo floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1; ?> Mb', unique_names: false, rename: true, chunk_size: '<?php echo min(floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1, 6); ?> Mb', max_retries: 2, sortable: true, dragdrop: true, views: { list: true, thumbs: true, active: 'thumbs' }, filters: [{title: "Images", extensions: "jpg,gif,png"}], flash_swf_url: '<?php echo plugins_url(FLAGFOLDER . '/admin/js/plupload/plupload.flash.swf'); ?> ' }); var uploader = $("#pluploadUploader").plupload('getUploader'); uploader.bind('QueueChanged StateChanged', function(up){ if(up.state == plupload.QUEUED){ files_remaining = up.files.length; } if(up.state == plupload.STARTED){ up.settings.multipart_params = { galleryselect: jQuery('#galleryselect').val(), thumbw: jQuery('#thumbWidth').val(), thumbh: jQuery('#thumbHeight').val(), thumbf: jQuery('#thumbFix').prop("checked"), last: files_remaining, action: 'flag_plupload_uploader', _wpnonce: '<?php echo $nonce; ?> ' }; } if($("#galleryselect").val() == 0){ $("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled'); } console.log('[StateChanged]', up.state, up.settings.multipart_params); }); uploader.bind('ChunkUploaded', function(up, file, info){ console.log('[ChunkUploaded] File:', file, "Info:", info); var response = jQuery.parseJSON(info.response); if(response && response.error){ up.stop(); file.status = plupload.FAILED; console.log(response.error); up.trigger('QueueChanged StateChanged'); up.trigger('UploadProgress', file); up.start(); } }); uploader.bind('FileUploaded', function(up, file, info){ console.log('[FileUploaded] File:', file, "Info:", info); files_remaining--; if(info.response){ file.status = plupload.FAILED; jQuery('<div/>').addClass('error').html('<span><u><em>' + file.name + ':</em></u> ' + info.response + '</span>').appendTo('#pl-message'); } }); uploader.bind('UploadProgress', function(up, file){ var percent = uploader.total.percent; $('#total-progress-info .progress-bar').css('width', percent + "%").attr('aria-valuenow', percent); }); uploader.bind('Error', function(up, args){ jQuery('<div/>').addClass('error').html('<span><u><em>' + args.file.name + ':</em></u> ' + args.message + ' ' + args.status + '</span>').appendTo('#pl-message'); console.log('[error] ', args); }); uploader.bind('UploadComplete', function(up, files){ console.log('[UploadComplete]', files); jQuery('<div/>').addClass('success').html('<?php _e('Done!', 'flag'); ?> <a href="<?php echo wp_nonce_url($flag->manage_page->base_page . "&mode=edit", 'flag_editgallery'); ?> &gid=' + jQuery("#galleryselect").val() + '">Open Gallery</a>').appendTo('#pl-message'); }); jQuery("#gmUpload").on('click', '.ui-button-disabled', function(){ if(files_remaining){ alert("Choose gallery, please.") } }); jQuery("#galleryselect").change(function(){ if(jQuery(this).val() == 0){ jQuery("#pluploadUploader_start").addClass('ui-button-disabled ui-state-disabled'); } else{ if(files_remaining){ jQuery("#pluploadUploader_start").removeClass('ui-button-disabled ui-state-disabled'); } } }); }); </script> <?php } else { ?> <!-- MultiFile script --> <script type="text/javascript"> /* <![CDATA[ */ jQuery(document).ready(function(){ jQuery('#imagefiles').MultiFile({ STRING: { remove: '<?php _e('remove', 'flag'); ?> ' } }); if(jQuery("#galleryselect").val() == 0){ jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600); jQuery("#choosegalfirst .disabledbut").show(); } jQuery("#choosegalfirst .disabledbut").click(function(){ alert("Choose gallery, please.") }); jQuery("#galleryselect").change(function(){ if(jQuery(this).val() == 0){ jQuery("#choosegalfirst .disabledbut").show(); jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600); } else{ jQuery("#choosegalfirst .disabledbut").hide(); jQuery("#choosegalfirst").animate({opacity: "1"}, 600); } }); }); /* ]]> */ </script> <?php } ?> </div> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <!-- import folder --> <div id="importfolder" class="cptab"> <h2><?php _e('Import image folder', 'flag'); ?> </h2> <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?> " accept-charset="utf-8"> <?php wp_nonce_field('flag_addgallery'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Import from Server path:', 'flag'); ?> </th> <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> <div id="file_browser"></div> <div><?php echo $maxsize; ?> <?php if (SAFE_MODE) { ?> <br/><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag'); } ?> </div> </td> </tr> </table> <div class="submit"> <input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?> "/> </div> </form> </div> <?php } ?> <script type="text/javascript"> var cptabs = new ddtabcontent("tabs"); cptabs.setpersist(true); cptabs.setselectedClassTarget("linkparent"); cptabs.init(); </script> </div> <?php }
function flag_admin_add_gallery() { global $wpdb, $flagdb, $flag; // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0 $filepath = admin_url() . 'admin.php?page=' . urlencode($_GET['page']); // check for the max image size $maxsize = flagGallery::check_memory_limit(); $defaultpath = $flag->options['galleryPath']; if ($_POST['addgallery']) { check_admin_referer('flag_addgallery'); $newgallery = trim($_POST['galleryname']); if (!empty($newgallery)) { flagAdmin::create_gallery($newgallery, $defaultpath); } } if ($_POST['uploadimage']) { check_admin_referer('flag_upload'); if ($_FILES['MF__F_0_0']['error'] == 0) { flagAdmin::upload_images(); } else { flagGallery::show_error(__('Upload failed!', 'flag')); } } if ($_POST['importfolder']) { check_admin_referer('flag_addgallery'); $galleryfolder = $_POST['galleryfolder']; if (!empty($galleryfolder) and $defaultpath != $galleryfolder and false === strpos($galleryfolder, '..')) { flagAdmin::import_gallery($galleryfolder); } } if (isset($_POST['disable_flash'])) { check_admin_referer('flag_upload'); $flag->options['swfUpload'] = false; update_option('flag_options', $flag->options); } if (isset($_POST['enable_flash'])) { check_admin_referer('flag_upload'); $flag->options['swfUpload'] = true; update_option('flag_options', $flag->options); } //get all galleries (after we added new ones) $gallerylist = $flagdb->find_all_galleries($flag->options['albSort'], $flag->options['albSortDir']); ?> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <link rel="stylesheet" type="text/css" href="<?php echo FLAG_URLPATH; ?> admin/js/jqueryFileTree/jqueryFileTree.css" /> <script type="text/javascript" src="<?php echo FLAG_URLPATH; ?> admin/js/jqueryFileTree/jqueryFileTree.js"></script> <script type="text/javascript"> /* <![CDATA[ */ jQuery(function() { jQuery("span.browsefiles").show().click(function(){ jQuery("#file_browser").fileTree({ script: "admin-ajax.php?action=flag_file_browser&nonce=<?php echo wp_create_nonce('flag-ajax'); ?> ", root: jQuery("#galleryfolder").val() }, function(file) { //var path = file.replace("<?php echo WINABSPATH; ?> ", ""); jQuery("#galleryfolder").val(file); }); jQuery("#file_browser").show("slide"); }); }); /* ]]> */ </script> <?php } ?> <div id="slider" class="wrap"> <ul id="tabs" class="tabs"> <li class="selected"><a href="#" rel="addgallery"><?php _e('Add new gallery', 'flag'); ?> </a></li> <li><a href="#" rel="uploadimage"><?php _e('Upload Images', 'flag'); ?> </a></li> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <li><a href="#" rel="importfolder"><?php _e('Import image folder', 'flag'); ?> </a></li> <?php } ?> </ul> <!-- create gallery --> <div id="addgallery" class="cptab"> <h2><?php _e('Create a new gallery', 'flag'); ?> </h2> <form name="addgallery" id="addgallery_form" method="POST" action="<?php echo $filepath; ?> " accept-charset="utf-8" > <?php wp_nonce_field('flag_addgallery'); ?> <table class="form-table" style="width: auto;"> <tr> <th scope="col" colspan="2" style="padding-bottom: 0;"><strong><?php _e('New Gallery', 'flag'); ?> </strong></th> </tr> <tr valign="top"> <td><input type="text" size="65" name="galleryname" value="" /><br /> <?php if (!IS_WPMU) { ?> <?php _e('Create a new , empty gallery below the folder', 'flag'); ?> <strong><?php echo $defaultpath; ?> </strong><br /> <?php } ?> <i>( <?php _e('Allowed characters for file and folder names are', 'flag'); ?> : a-z, A-Z, 0-9, -, _ )</i></td> <?php do_action('flag_add_new_gallery_form'); ?> <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> </tr> </table> <p> </p> </form> </div> <!-- upload images --> <div id="uploadimage" class="cptab"> <h2><?php _e('Upload images', 'flag'); ?> </h2> <form name="uploadimage" id="gmUpload" method="POST" enctype="multipart/form-data" action="<?php echo $filepath; ?> " accept-charset="utf-8" > <?php wp_nonce_field('flag_upload'); ?> <table class="form-table"> <tr valign="top"> <td style="width: 216px;"><label for="galleryselect"><?php _e('in to', 'flag'); ?> </label> <select name="galleryselect" id="galleryselect" style="width: 200px"> <option value="0" ><?php _e('Choose gallery', 'flag'); ?> </option> <?php $ingallery = isset($_GET['gid']) ? (int) $_GET['gid'] : ''; foreach ($gallerylist as $gallery) { if (!flagAdmin::can_manage_this_gallery($gallery->author)) { continue; } $name = empty($gallery->title) ? $gallery->name : esc_html(stripslashes($gallery->title)); if ($flag->options['albSort'] == 'gid') { $name = $gallery->gid . ' - ' . $name; } if ($flag->options['albSort'] == 'title') { $name = $name . ' (' . $gallery->gid . ')'; } $sel = $ingallery == $gallery->gid ? 'selected="selected" ' : ''; echo '<option ' . $sel . 'value="' . $gallery->gid . '" >' . $name . '</option>' . "\n"; } ?> </select> <?php echo $maxsize; ?> <br /><?php if (IS_WPMU && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) { display_space_usage(); } ?> <div class="submit"> <span class="useflashupload"> <?php if ($flag->options['swfUpload']) { ?> <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload via Plupload, disable it if you have problems', 'flag'); ?> " value="<?php _e('Switch to Browser Upload', 'flag'); ?> " /> <?php } else { ?> <input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'flag'); ?> " value="<?php _e('Switch to Plupload based Upload', 'flag'); ?> " /> <?php } ?> </span> <div class="clear"></div> </div> </td> <td><div id="pluploadUploader"> <?php if (!$flag->options['swfUpload']) { ?> <strong><?php _e('Upload image(s):', 'flag'); ?> </strong><br> <input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></div> <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> <?php } ?> </td> </tr> </table> <div id="pl-message"></div> </form> <?php if ($flag->options['swfUpload']) { ?> <script type="text/javascript"> // Convert divs to queue widgets when the DOM is ready jQuery(function () { var files_remaining = 0; jQuery("#pluploadUploader").pluploadQueue({ // General settings runtimes : 'flash,html5,html4', url : '<?php echo str_replace('&', '&', wp_nonce_url(plugins_url(FLAGFOLDER . '/admin/upload.php'), 'flag_upload')); ?> ', multipart : true, multipart_params : { postData: ''}, max_file_size : '<?php echo min(floor(wp_max_upload_size() * 0.99 / 1024 / 1024) - 1, 8); ?> Mb', unique_names : false, rename : true, urlstream_upload : true, // Resize images on clientside if we can //resize : {width : 150, height : 150, quality : 90}, // Specify what files to browse for filters : [{title: "Images", extensions: "jpg,gif,png"}], // Flash settings flash_swf_url : '<?php echo plugins_url(FLAGFOLDER . '/admin/js/plupload/plupload.flash.swf'); ?> ', // PreInit events, bound before any internal events preinit : { Init: function(up, info) { console.log('[Init]', 'Info:', info, 'Features:', up.features); }, UploadFile: function(up, file) { console.log('[UploadFile]', file); up.settings.multipart_params = { galleryselect: jQuery('#galleryselect').val(), last: files_remaining }; files_remaining--; // You can override settings before the file is uploaded // up.settings.url = 'upload.php?id=' + file.id; // up.settings.multipart_params = {param1 : 'value1', param2 : 'value2'}; } }, // Post init events, bound after the internal events init : { Refresh: function(up) { // Called when upload shim is moved console.log('[Refresh]'); files_remaining = up.files.length; if(jQuery("#galleryselect").val() == 0) { jQuery(".plupload_start").addClass("plupload_disabled"); } }, StateChanged: function(up) { // Called when the state of the queue is changed console.log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED"); }, QueueChanged: function(up) { // Called when the files in queue are changed by adding/removing files console.log('[QueueChanged]'); }, UploadProgress: function(up, file) { // Called while a file is being uploaded console.log('[UploadProgress]', 'File:', file, "Total:", up.total); }, FileUploaded: function(up, file, info) { // Called when a file has finished uploading console.log('[FileUploaded] File:', file, "Info:", info); if (info.response){ file.status = plupload.FAILED; jQuery('<div/>').addClass('error').html('<span><u><em>'+file.name+':</em></u> '+info.response+'</span>').appendTo('#pl-message'); } }, Error: function(up, args) { // Called when a error has occured jQuery('<div/>').addClass('error').html('<span><u><em>'+args.file.name+':</em></u> '+args.message+' '+args.status+'</span>').appendTo('#pl-message'); console.log('[error] ', args); }, UploadComplete: function(up, file) { console.log('[UploadComplete]'); jQuery(".plupload_buttons").css("display", "inline"); jQuery(".plupload_upload_status").css("display", "inline"); jQuery(".plupload_start").addClass("plupload_disabled"); jQuery("#gmUpload").one("mousedown", ".plupload_add", function () { up.splice(); up.trigger('Refresh'); //up.refresh(); }); jQuery('<div/>').addClass('success').html('<?php _e('Done!', 'flag'); ?> <a href="<?php echo wp_nonce_url($flag->manage_page->base_page . "&mode=edit", 'flag_editgallery'); ?> &gid=' + jQuery("#galleryselect").val() + '">Open Gallery</a>').appendTo('#pl-message'); } } }); jQuery("#gmUpload").on('click','.plupload_disabled',function(){ if(files_remaining){ alert("Choose gallery, please.") } }); jQuery("#galleryselect").change(function () { if(jQuery(this).val() == 0) { jQuery(".plupload_start").addClass('plupload_disabled'); } else { if(files_remaining){ jQuery(".plupload_start").removeClass('plupload_disabled'); } } }); }); </script> <?php } else { ?> <!-- MultiFile script --> <script type="text/javascript"> /* <![CDATA[ */ jQuery(document).ready(function(){ jQuery('#imagefiles').MultiFile({ STRING: { remove:'<?php _e('remove', 'flag'); ?> ' } }); if(jQuery("#galleryselect").val() == 0) { jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600); jQuery("#choosegalfirst .disabledbut").show(); } jQuery("#choosegalfirst .disabledbut").click(function () { alert("Choose gallery, please.") }); jQuery("#galleryselect").change(function () { if(jQuery(this).val() == 0) { jQuery("#choosegalfirst .disabledbut").show(); jQuery("#choosegalfirst").animate({opacity: "0.5"}, 600); } else { jQuery("#choosegalfirst .disabledbut").hide(); jQuery("#choosegalfirst").animate({opacity: "1"}, 600); } }); }); /* ]]> */ </script> <?php } ?> </div> <?php if (!IS_WPMU || current_user_can('FlAG Import folder')) { ?> <!-- import folder --> <div id="importfolder" class="cptab"> <h2><?php _e('Import image folder', 'flag'); ?> </h2> <form name="importfolder" id="importfolder_form" method="POST" action="<?php echo $filepath; ?> " accept-charset="utf-8" > <?php wp_nonce_field('flag_addgallery'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Import from Server path:', 'flag'); ?> </th> <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> <div id="file_browser"></div> <div><?php echo $maxsize; ?> <?php if (SAFE_MODE) { ?> <br /><?php _e(' Please note : For safe-mode = ON you need to add the subfolder thumbs manually', 'flag'); } ?> </div></td> </tr> </table> <div class="submit"><input class="button-primary" type="submit" name="importfolder" value="<?php _e('Import folder', 'flag'); ?> "/></div> </form> </div> <?php } ?> <script type="text/javascript"> var cptabs=new ddtabcontent("tabs"); cptabs.setpersist(true); cptabs.setselectedClassTarget("linkparent"); cptabs.init(); </script> </div> <?php }
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); } // check for correct capability if (!is_user_logged_in()) { die('-1'); } // check for correct FlAG capability if (!current_user_can('FlAG Facebook page')) { die('-1'); } if (isset($_POST['copy_file'])) { if (copy(FLAG_ABSPATH . 'facebook.php', ABSPATH . 'facebook.php')) { flagGallery::show_message(__('Success', 'flag')); } else { flagGallery::show_error(__('Failure', 'flag')); } } global $flag, $flagdb; require_once dirname(__FILE__) . '/get_skin.php'; require_once dirname(__FILE__) . '/playlist.functions.php'; require_once dirname(__FILE__) . '/video.functions.php'; require_once dirname(__FILE__) . '/banner.functions.php'; $i_skins = get_skins(); $all_m_playlists = get_playlists(); $all_v_playlists = get_v_playlists(); $all_b_playlists = get_b_playlists(); $fb_url = FLAG_URLPATH . 'facebook.php'; if (file_exists(ABSPATH . 'facebook.php')) { $fb_url = home_url() . '/facebook.php'; }