Пример #1
0
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'];
    ?>
" /> % &nbsp;&nbsp;<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>&nbsp;</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 
}
Пример #2
0
 function post_processor_images()
 {
     global $wpdb, $flag, $flagdb;
     do_action('flag_manage_post_processor_images');
     // bulk update in a single gallery
     if (isset($_POST['bulkaction']) && isset($_POST['doaction'])) {
         check_admin_referer('flag_updategallery');
         switch ($_POST['bulkaction']) {
             case 'no_action':
                 break;
             case 'delete_images':
                 if (is_array($_POST['doaction'])) {
                     $delete_pic = false;
                     foreach ($_POST['doaction'] as $imageID) {
                         $image = $flagdb->find_image($imageID);
                         if ($image) {
                             if ($flag->options['deleteImg']) {
                                 @unlink($image->imagePath);
                                 @unlink($image->webimagePath);
                                 @unlink($image->thumbPath);
                             }
                             $delete_pic = flagdb::delete_image($image->pid);
                         }
                     }
                     if ($delete_pic) {
                         flagGallery::show_message(__('Pictures deleted successfully ', 'flash-album-gallery'));
                     }
                 }
                 break;
             case 'import_meta':
                 flagAdmin::do_ajax_operation('import_metadata', $_POST['doaction'], __('Import metadata', 'flash-album-gallery'));
                 break;
             case 'copy_meta':
                 flagAdmin::do_ajax_operation('copy_metadata', $_POST['doaction'], __('Copy metadata to image Description', 'flash-album-gallery'));
                 break;
             case 'webview_images':
                 flagAdmin::do_ajax_operation('webview_image', $_POST['doaction'], __('Creating images optimized for web', 'flash-album-gallery'));
                 break;
             case 'reset_counters':
                 if (is_array($_POST['doaction'])) {
                     $images = $flagdb->find_images_in_list($_POST['doaction']);
                     foreach ($images as $image) {
                         $img_id = $image->pid;
                         $wpdb->query("UPDATE {$wpdb->flagpictures} SET hitcounter = '0', total_votes = '0' WHERE pid = {$img_id}");
                     }
                 }
                 break;
         }
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_ResizeImages'])) {
         check_admin_referer('flag_thickbox_form');
         //save the new values for the next operation
         $flag->options['imgWidth'] = (int) $_POST['imgWidth'];
         $flag->options['imgHeight'] = (int) $_POST['imgHeight'];
         update_option('flag_options', $flag->options);
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         flagAdmin::do_ajax_operation('resize_image', $pic_ids, __('Resize images', 'flash-album-gallery'));
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_NewThumbnail'])) {
         check_admin_referer('flag_thickbox_form');
         //save the new values for the next operation
         $flag->options['thumbWidth'] = (int) $_POST['thumbWidth'];
         $flag->options['thumbHeight'] = (int) $_POST['thumbHeight'];
         $flag->options['thumbFix'] = (bool) $_POST['thumbFix'];
         update_option('flag_options', $flag->options);
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         flagAdmin::do_ajax_operation('create_thumbnail', $pic_ids, __('Create new thumbnails', 'flash-album-gallery'));
     }
     if (isset($_POST['TB_bulkaction']) && isset($_POST['TB_SelectGallery'])) {
         check_admin_referer('flag_thickbox_form');
         $pic_ids = explode(',', $_POST['TB_imagelist']);
         $pic_ids = array_filter($pic_ids, 'intval');
         $dest_gid = (int) $_POST['dest_gid'];
         switch ($_POST['TB_bulkaction']) {
             case 'copy_to':
                 // Copy images
                 flagAdmin::copy_images($pic_ids, $dest_gid);
                 break;
             case 'move_to':
                 // Move images
                 flagAdmin::move_images($pic_ids, $dest_gid);
                 break;
         }
     }
     if (isset($_POST['updatepictures'])) {
         // Update pictures
         check_admin_referer('flag_updategallery');
         $gallery_title = esc_html($_POST['title']);
         $gallery_path = esc_attr(str_replace('..', '', $_POST['path']));
         $gallery_desc = esc_html($_POST['gallerydesc']);
         $gallery_preview = (int) $_POST['previewpic'];
         $wpdb->query("UPDATE {$wpdb->flaggallery} SET title= '{$gallery_title}', path= '{$gallery_path}', galdesc = '{$gallery_desc}', previewpic = '{$gallery_preview}' WHERE gid = '{$this->gid}'");
         if (isset($_POST['author'])) {
             $gallery_author = (int) $_POST['author'];
             $wpdb->query("UPDATE {$wpdb->flaggallery} SET author = '{$gallery_author}' WHERE gid = '{$this->gid}'");
         }
         $this->update_pictures();
         //hook for other plugin to update the fields
         do_action('flag_update_gallery', $this->gid, $_POST);
         flagGallery::show_message(__('Update successful', "flash-album-gallery"));
     }
     if (isset($_POST['scanfolder'])) {
         // Rescan folder
         check_admin_referer('flag_updategallery');
         $gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->flaggallery} WHERE gid = '{$this->gid}' ");
         flagAdmin::import_gallery($gallerypath);
     }
 }
Пример #3
0
/**
 * Show the Setup Box and some info for Flash Album Gallery
 * 
 * @return void
 */
function flag_overview_setup()
{
    global $flag;
    if (isset($_POST['resetdefault'])) {
        check_admin_referer('flag_uninstall');
        include_once dirname(__FILE__) . '/flag_install.php';
        include_once dirname(__FILE__) . '/tuning.php';
        flag_default_options();
        flag_tune(true, true);
        $flag->define_constant();
        $flag->load_options();
        flagGallery::show_message(__('Reset all settings to default parameter', 'flag'));
    }
    if (isset($_POST['uninstall'])) {
        check_admin_referer('flag_uninstall');
        include_once dirname(__FILE__) . '/flag_install.php';
        flag_uninstall();
        flagGallery::show_message(__('Uninstall sucessful ! Now delete the plugin and enjoy your life ! Good luck !', 'flag'));
    }
    ?>
		<div class="submitbox" id="submitpost">
			<div id="minor-publishing">
				<div id="misc-publishing-actions">
					<div class="misc-pub-section">
						<span id="plugin-home" class="icon">
							<strong><a href="http://codeasily.com/wordpress-plugins/flag/" style="text-decoration: none;"><?php 
    _e('Plugin Home', 'flag');
    ?>
</a></strong>
						</span>
					</div>
					<div class="misc-pub-section">
						<span id="plugin-comments" class="icon">
							<a href="http://codeasily.com/community/forum/flagallery-wordpress-plugin/" style="text-decoration: none;"><?php 
    _e('Plugin Forum', 'flag');
    ?>
</a>
						</span>
					</div>
					<div class="misc-pub-section">
						<span id="rate-plugin" class="icon">
							<a href="http://wordpress.org/extend/plugins/flash-album-gallery/" style="text-decoration: none;"><?php 
    _e('Rate Plugin', 'flag');
    ?>
</a>
						</span>
					</div>
					<div class="misc-pub-section curtime misc-pub-section-last">
						<span id="contact-me" class="icon">
							<a href="http://codeasily.com/support/contact/" style="text-decoration: none;"><?php 
    _e('Contact Me', 'flag');
    ?>
</a>
						</span>
					</div>
				</div>
			</div>
		</div>
	<?php 
    if (!IS_WPMU || flag_wpmu_site_admin()) {
        ?>
	<div id="major-publishing-actions">
	<form id="resetsettings" name="resetsettings" method="post">
		<?php 
        wp_nonce_field('flag_uninstall');
        ?>
			<div id="save-action" class="alignleft">
				<input class="button" id="save-post" type="submit" name="resetdefault" value="<?php 
        _e('Reset settings', 'flag');
        ?>
" onclick="javascript:check=confirm('<?php 
        _e('Reset all options to default settings ?\\n\\nChoose [Cancel] to Stop, [OK] to proceed.\\n', 'flag');
        ?>
');if(check==false) return false;" />
			</div>
			<div id="preview-action" class="alignright">
				<input type="submit" name="uninstall" class="button delete" value="<?php 
        _e('Uninstall plugin', 'flag');
        ?>
" onclick="javascript:check=confirm('<?php 
        _e('You are about to Uninstall this plugin from WordPress.\\nThis action is not reversible.\\n\\nChoose [Cancel] to Stop, [OK] to Uninstall.\\n', 'flag');
        ?>
');if(check==false) return false;" />
			</div>
			<br class="clear" />
	</form>
	</div>
	<?php 
    }
    ?>

<?php 
}
Пример #4
0
function flag_banner_controler()
{
    $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'main';
    if (isset($_POST['importfolder']) && $_POST['importfolder']) {
        check_admin_referer('flag_addbanner');
        $bannerfolder = $_POST['bannerfolder'];
        if (!empty($bannerfolder) and false === strpos($bannerfolder, '..')) {
            $crunch_list = flagAdmin::import_banner($bannerfolder);
            $mode = 'import';
        }
    }
    $action = isset($_REQUEST['bulkaction']) ? $_REQUEST['bulkaction'] : false;
    if ($action == 'no_action') {
        $action = false;
    }
    switch ($mode) {
        case 'sort':
            check_admin_referer('flag_sort');
            include_once dirname(__FILE__) . '/banner-sort.php';
            flag_b_playlist_order();
            break;
        case 'edit':
            $file = sanitize_flagname($_GET['playlist']);
            if (isset($_POST['updatePlaylist'])) {
                check_admin_referer('flag_update');
                $title = esc_html($_POST['playlist_title']);
                $descr = esc_html($_POST['playlist_descr']);
                $data = array();
                foreach ($_POST['item_a'] as $item_id => $item) {
                    if ($action == 'delete_items' && in_array($item_id, $_POST['doaction'])) {
                        continue;
                    }
                    $data[] = $item_id;
                }
                flagGallery::flagSaveWpMedia();
                flagSave_bPlaylist($title, $descr, $data, $file);
            }
            if (isset($_POST['updatePlaylistSkin'])) {
                check_admin_referer('flag_update');
                flagSave_bPlaylistSkin($file);
            }
            include_once dirname(__FILE__) . '/manage-banner.php';
            flag_b_playlist_edit($file);
            break;
        case 'save':
            if (isset($_POST['items_array'])) {
                check_admin_referer('flag_update');
                $title = esc_html($_POST['playlist_title']);
                $descr = esc_html($_POST['playlist_descr']);
                $data = $_POST['items_array'];
                $file = isset($_REQUEST['playlist']) ? sanitize_flagname($_REQUEST['playlist']) : false;
                flagGallery::flagSaveWpMedia();
                flagSave_bPlaylist($title, $descr, $data, $file);
            }
            if (isset($_GET['playlist'])) {
                include_once dirname(__FILE__) . '/manage-banner.php';
                flag_b_playlist_edit();
            } else {
                flag_created_b_playlists();
                flag_banner_wp_media_lib();
            }
            break;
        case 'add':
            check_admin_referer('flag_add');
            if (isset($_POST['items']) && isset($_GET['playlist'])) {
                $added = $_POST['items'];
            } elseif (isset($_GET['playlist'])) {
                $added = $_COOKIE['bannerboxplaylist_' . sanitize_flagname($_GET['playlist'])];
            } else {
                $added = false;
            }
            flag_banner_wp_media_lib($added);
            break;
        case 'delete':
            check_admin_referer('flag_delete');
            flag_b_playlist_delete(sanitize_flagname($_GET['playlist']));
        case 'import':
            flag_crunch($crunch_list);
        case 'main':
            if (isset($_POST['updateMedia'])) {
                check_admin_referer('flag_update');
                flagGallery::flagSaveWpMedia();
                flagGallery::show_message(__('Media updated', 'flag'));
            }
        default:
            flag_created_b_playlists();
            flag_banner_wp_media_lib();
            break;
    }
}
Пример #5
0
 /**
  * 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) &raquo; 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;
 }
Пример #6
0
function flag_playlist_delete($playlist)
{
    $playlist = sanitize_flagname($playlist);
    $flag_options = get_option('flag_options');
    $playlistXML = ABSPATH . $flag_options['galleryPath'] . 'playlists/' . $playlist . '.xml';
    if (file_exists($playlistXML)) {
        if (unlink($playlistXML)) {
            flagGallery::show_message("'" . $playlist . ".xml' " . __('deleted', 'flag'));
        }
    }
}
Пример #7
0
/**
 * @author Sergey Pasyuk
 * @copyright 2009
 */
function flag_sortorder($galleryID = 0)
{
    global $wpdb;
    if ($galleryID == 0) {
        return;
    }
    $galleryID = (int) $galleryID;
    if (isset($_POST['updateSortorder'])) {
        check_admin_referer('flag_updatesortorder');
        // get variable new sortorder
        $neworder = array();
        foreach ($_POST as $id) {
            $neworder[] = (int) $id;
        }
        $sortindex = 1;
        foreach ($neworder as $pic_id) {
            $wpdb->query("UPDATE {$wpdb->flagpictures} SET sortorder = '{$sortindex}' WHERE pid = {$pic_id}");
            $sortindex++;
        }
        $firstImage = $wpdb->get_var("SELECT pid FROM {$wpdb->flagpictures} WHERE galleryid = '{$galleryID}' ORDER by pid DESC limit 0,1");
        if ($firstImage) {
            $wpdb->query("UPDATE {$wpdb->flaggallery} SET previewpic = '{$firstImage}' WHERE gid = '{$galleryID}'");
        }
        flagGallery::show_message(__('Sort order changed', 'flag'));
    }
    // get gallery values
    $act_gallery = $wpdb->get_row("SELECT * FROM {$wpdb->flaggallery} WHERE gid = '{$galleryID}' ");
    // set gallery url
    $act_gallery_url = get_option('siteurl') . "/" . $act_gallery->path . "/";
    $act_thumbnail_url = get_option('siteurl') . "/" . $act_gallery->path . flagGallery::create_thumbnail_folder($act_gallery->path, FALSE);
    // look for presort args
    $picturelist = $wpdb->get_results("SELECT * FROM {$wpdb->flagpictures} WHERE galleryid = '{$galleryID}' ORDER BY sortorder");
    //this is the url without any presort variable
    $base_url = admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=sort&amp;gid=' . $galleryID;
    ?>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablednd_0_5.js"></script>
<script type="text/javascript" src="<?php 
    echo FLAG_URLPATH;
    ?>
admin/js/jquery.tablesorter.js"></script>
<div class="flag-wrap">
			<h2><?php 
    _e('Sort Gallery', 'flag');
    ?>
</h2>

	<form class="alignright" method="POST" action="<?php 
    echo admin_url() . 'admin.php?page=flag-manage-gallery&amp;mode=edit&amp;gid=' . $galleryID;
    ?>
" accept-charset="utf-8">
		<div class="alignright tablenav" style="margin-bottom: -36px;">
			<input class="button-secondary action" type="submit" name="backToGallery" value="<?php 
    _e('Back to gallery', 'flag');
    ?>
" />
		</div>
	</form>
	<form id="sortGallery" method="POST" action="<?php 
    echo $base_url;
    ?>
" accept-charset="utf-8">
		<div class="alignleft tablenav">
			<?php 
    wp_nonce_field('flag_updatesortorder');
    ?>
			<input class="button-primary action" type="submit" name="updateSortorder" value="<?php 
    _e('Update Sort Order', 'flag');
    ?>
" />
		</div>
		<br clear="all" />
<script type="text/javascript">
/*<![CDATA[*/
jQuery(document).ready(function($) {
    // Initialise the table
    jQuery("#listimages").tableDnD({
      onDragClass: "myDragClass",
	  	onDrop: function() {
				jQuery("#listimages tr:even").addClass('alternate');
				jQuery("#listimages tr:odd").removeClass('alternate');
      }
    });
		$("#flag-listitems").tablesorter({ 
        // pass the headers argument and assing a object 
        headers: { 
            // assign the secound column (we start counting zero) 
            1: { 
                // disable it by setting the property sorter to false 
                sorter: false 
            }
        } 
    });
		$("#flag-listitems").bind("sortEnd",function() { 
				jQuery("#listimages tr:even").addClass('alternate');
				jQuery("#listimages tr:odd").removeClass('alternate');
    }); 

});
/*]]>*/
</script>
<table id="flag-listitems" class="widefat fixed flag-table" cellspacing="0" >

	<thead>
	<tr>
		<th class="header" width="30px"><p style="margin-right:-10px;"><?php 
    _e('ID', 'flag');
    ?>
</p></th>
		<th width="120"><p><?php 
    _e('Thumb', 'flag');
    ?>
</p></th>
		<th class="header"><p><?php 
    _e('Filename', 'flag');
    ?>
</p></th>
		<th class="header" width="130"><p><?php 
    _e('Date', 'flag');
    ?>
</p></th>
		<th class="header"><p><?php 
    _e('Alt &amp; Title Text', 'flag');
    ?>
</p></th>
	</tr>
	</thead>
	<tfoot>
	<tr>
		<th><p><?php 
    _e('ID', 'flag');
    ?>
</p></th>
		<th><p><?php 
    _e('Thumb', 'flag');
    ?>
</p></th>
		<th><p><?php 
    _e('Filename', 'flag');
    ?>
</p></th>
		<th><p><?php 
    _e('Date', 'flag');
    ?>
</p></th>
		<th><p><?php 
    _e('Alt &amp; Title Text', 'flag');
    ?>
</p></th>
	</tr>
	</tfoot>
	<tbody id="listimages">
<?php 
    if ($picturelist) {
        $alternate = '';
        foreach ($picturelist as $picture) {
            $pid = (int) $picture->pid;
            $alternate = $alternate == 'alternate' ? '' : 'alternate';
            $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">
				<td><strong><?php 
            echo $pid;
            ?>
</strong><input type="hidden" name="sortpid-<?php 
            echo $pid;
            ?>
" value="<?php 
            echo $pid;
            ?>
" /></td>
				<td><a href="<?php 
            echo $act_gallery_url . $picture->filename;
            ?>
" class="thickbox" title="<?php 
            echo $picture->filename;
            ?>
">
					<img class="thumb" src="<?php 
            echo $act_thumbnail_url . "thumbs_" . $picture->filename;
            ?>
" style="width:80px; height:auto;" id="thumb-<?php 
            echo $pid;
            ?>
" />
				</a></td>
				<td><?php 
            echo $picture->filename;
            ?>
</td>
				<td><?php 
            echo $date;
            ?>
</td>
				<td><?php 
            echo esc_html(stripslashes($picture->alttext));
            ?>
</td>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="5" align="center"><strong>' . __('No entries found', 'flag') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="actions"><input type="submit" class="button-primary action"  name="updateSortorder" onclick="saveImageOrder()" value="<?php 
    _e('Update Sort Order', 'flag');
    ?>
" /></p>
</form>	
<br class="clear"/>
</div><!-- /#wrap -->

<?php 
}
Пример #8
0
    case 'w':
        $stype = 'widget';
        $new_skins = __('New Widget Skins', 'flash-album-gallery');
        break;
    default:
        $stype = 'gallery';
        $new_skins = __('New Photo Skins', 'flash-album-gallery');
        break;
}
if (isset($_GET['skins_refresh'])) {
    check_admin_referer('skins_refresh');
    // upgrade plugin
    require_once FLAG_ABSPATH . 'admin/tuning.php';
    $ok = flag_tune();
    if ($ok) {
        flagGallery::show_message(__('Skins refreshed successfully', 'flash-album-gallery'));
    }
}
?>
<div id="slider" class="flag-wrap">
	<ul id="tabs" class="tabs">
<?php 
if (current_user_can('FlAG Add skins')) {
    ?>
		<li class="selected"><a href="#" rel="addskin"><?php 
    _e('Add new skin', 'flash-album-gallery');
    ?>
</a></li>
<?php 
}
?>
Пример #9
0
    case 'w':
        $stype = 'widget';
        $new_skins = __('New Widget Skins', 'flag');
        break;
    default:
        $stype = 'gallery';
        $new_skins = __('New Photo Skins', 'flag');
        break;
}
if (isset($_GET['skins_refresh'])) {
    check_admin_referer('skins_refresh');
    // upgrade plugin
    require_once FLAG_ABSPATH . 'admin/tuning.php';
    $ok = flag_tune();
    if ($ok) {
        flagGallery::show_message(__('Skins refreshed successfully', 'flag'));
    }
}
?>

<div id="slider" class="wrap">
	<ul id="tabs" class="tabs">
<?php 
if (current_user_can('FlAG Add skins')) {
    ?>

		<li class="selected"><a href="#" rel="addskin"><?php 
    _e('Add new skin', 'flag');
    ?>
</a></li>
<?php 
Пример #10
0
<?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 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')) {
Пример #11
0
<?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')) {