/** * Show the server settings * * @return void */ function flag_overview_server() { ?> <div id="dashboard_server_settings" class="dashboard-widget-holder wp_dashboard_empty"> <div class="flag-dashboard-widget"> <?php if (IS_WPMU) { if (flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) { flag_SpaceManager::details(); } else { //TODO:WPMU message in WP2.5 style flag_SpaceManager::details(); } } else { ?> <div class="dashboard-widget-content"> <ul class="settings"> <?php get_serverinfo(); ?> </ul> </div> <?php } ?> </div> </div> <?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 }
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 }
/** * Check the Quota under WPMU. Only needed for this case * * @class flagAdmin * @return bool $result */ function check_quota() { if (IS_WPMU && flagGallery::flag_wpmu_enable_function('wpmuQuotaCheck')) { if ($error = upload_is_user_over_quota(false)) { flagGallery::show_error(__('Sorry, you have used your space allocation. Please delete some files to upload more files.', 'flag')); return true; } } return false; }
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 }