示例#1
0
function nggallery_wpmu_setup()
{
    //to be sure
    if (!is_super_admin()) {
        die('You are not allowed to call this page.');
    }
    $messagetext = '';
    // get the options
    $ngg_options = get_site_option('ngg_options');
    if (isset($_POST['updateoption'])) {
        check_admin_referer('ngg_wpmu_settings');
        // get the hidden option fields, taken from WP core
        if ($_POST['page_options']) {
            $options = explode(',', stripslashes($_POST['page_options']));
        }
        if ($options) {
            foreach ($options as $option) {
                $option = trim($option);
                $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
                //		$value = sanitize_option($option, $value); // This does strip slashes on those that need it
                $ngg_options[$option] = $value;
            }
        }
        // the path should always end with a slash
        $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']);
        update_site_option('ngg_options', $ngg_options);
        $messagetext = __('Update successfully', 'nggallery');
    }
    // Show donation message only one time.
    if (isset($_GET['hideSupportInfo'])) {
        $ngg_options['hideSupportInfo'] = true;
        update_site_option('ngg_options', $ngg_options);
    }
    // message windows
    if (!empty($messagetext)) {
        echo '<!-- Last Action --><div id="message" class="updated fade"><p>' . $messagetext . '</p></div>';
    }
    ?>

	<div class="wrap">
		<h2><?php 
    _e('Network Options', 'nggallery');
    ?>
</h2>
		<form name="generaloptions" method="post">
		<?php 
    wp_nonce_field('ngg_wpmu_settings');
    ?>
		<input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuImportFolder,wpmuStyle,wpmuRoles,wpmuCSSfile" />
			<table class="form-table">
				<tr valign="top">
					<th align="left"><?php 
    _e('Gallery path', 'nggallery');
    ?>
</th>
					<td><input type="text" size="50" name="gallerypath" value="<?php 
    echo $ngg_options['gallerypath'];
    ?>
" /><br />
					<?php 
    _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.', 'nggallery');
    ?>
                    <?php 
    echo str_replace('%s', '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>', __('The default setting should be %s', 'nggallery'));
    ?>
                    </td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable upload quota check', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuQuotaCheck']);
    ?>
 />
					<?php 
    _e('Should work if the gallery is bellow the blog.dir', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable zip upload option', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuZipUpload" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuZipUpload']);
    ?>
 />
					<?php 
    _e('Allow users to upload zip folders.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable import function', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuImportFolder" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuImportFolder']);
    ?>
 />
					<?php 
    _e('Allow users to import images folders from the server.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable style selection', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuStyle" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuStyle']);
    ?>
 />
					<?php 
    _e('Allow users to choose a style for the gallery.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable roles/capabilities', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuRoles" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuRoles']);
    ?>
 />
					<?php 
    _e('Allow users to change the roles for other blog authors.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Default style', 'nggallery');
    ?>
:</th>
					<td>
					<select name="wpmuCSSfile">
					<?php 
    $csslist = ngg_get_cssfiles();
    foreach ($csslist as $key => $a_cssfile) {
        $css_name = $a_cssfile['Name'];
        if ($key == $ngg_options['wpmuCSSfile']) {
            $file_show = $key;
            $selected = " selected='selected'";
        } else {
            $selected = '';
        }
        $css_name = esc_attr($css_name);
        echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>";
    }
    ?>
					</select><br />
					<?php 
    _e('Choose the default style for the galleries.', 'nggallery');
    ?>
					</td>
				</tr>
			</table> 				
			<div class="submit"><input type="submit" name="updateoption" value="<?php 
    _e('Update');
    ?>
"/></div>
		</form>	
	</div>	

	<?php 
}
示例#2
0
文件: wpmu.php 项目: popovdenis/kmst
function nggallery_wpmu_setup()
{
    //to be sure
    if (!is_super_admin()) {
        die('You are not allowed to call this page.');
    }
    $messagetext = '';
    // get the options
    $ngg_options = get_site_option('ngg_options');
    if (isset($_POST['updateoption'])) {
        check_admin_referer('ngg_wpmu_settings');
        // get the hidden option fields, taken from WP core
        if ($_POST['page_options']) {
            $options = explode(',', stripslashes($_POST['page_options']));
        }
        if ($options) {
            foreach ($options as $option) {
                $option = trim($option);
                $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
                //		$value = sanitize_option($option, $value); // This does strip slashes on those that need it
                $ngg_options[$option] = $value;
            }
        }
        // the path should always end with a slash
        $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']);
        update_site_option('ngg_options', $ngg_options);
        $messagetext = __('Update successfully', 'nggallery');
    }
    // Show donation message only one time.
    if (isset($_GET['hideSupportInfo'])) {
        $ngg_options['hideSupportInfo'] = true;
        update_site_option('ngg_options', $ngg_options);
    }
    if (!isset($ngg_options['hideSupportInfo']) || $ngg_options['hideSupportInfo'] !== true) {
        ?>
	
    		<div id="donator_message">
    			<p><?php 
        echo str_replace('%s', 'http://alexrabe.de/donation', __('Thanks for using this plugin, NextGEN Gallery is initially developed for self hosted blogs. A multisite setup is possible, but cannot currently fully supported, as it can have several special condition ( i.e. Domain mapping).<br /> If you would like to support the further development, please consider a <strong><a href="%s">donation</a></strong>! If you still need some help, please post your questions <a href="http://wordpress.org/tags/nextgen-gallery?forum_id=10">here</a> .', 'nggallery'));
        ?>
    				<span>
    					<a href="<?php 
        echo add_query_arg(array('hideSupportInfo' => 'true'));
        ?>
" >
    						<small><?php 
        _e('OK, hide this message now !', 'nggallery');
        ?>
</small>
    					</a>
    				<span>
    			</p>
    		</div>
    	<?php 
    }
    // message windows
    if (!empty($messagetext)) {
        echo '<!-- Last Action --><div id="message" class="updated fade"><p>' . $messagetext . '</p></div>';
    }
    ?>

	<div class="wrap">
		<h2><?php 
    _e('Network Options', 'nggallery');
    ?>
</h2>
		<form name="generaloptions" method="post">
		<?php 
    wp_nonce_field('ngg_wpmu_settings');
    ?>
		<input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuImportFolder,wpmuStyle,wpmuRoles,wpmuCSSfile" />
			<table class="form-table">
				<tr valign="top">
					<th align="left"><?php 
    _e('Gallery path', 'nggallery');
    ?>
</th>
					<td><input type="text" size="50" name="gallerypath" value="<?php 
    echo $ngg_options['gallerypath'];
    ?>
" /><br />
					<?php 
    _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.', 'nggallery');
    ?>
                    <?php 
    echo str_replace('%s', '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>', __('The default setting should be %s', 'nggallery'));
    ?>
                    </td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable upload quota check', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuQuotaCheck']);
    ?>
 />
					<?php 
    _e('Should work if the gallery is bellow the blog.dir', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable zip upload option', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuZipUpload" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuZipUpload']);
    ?>
 />
					<?php 
    _e('Allow users to upload zip folders.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable import function', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuImportFolder" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuImportFolder']);
    ?>
 />
					<?php 
    _e('Allow users to import images folders from the server.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable style selection', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuStyle" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuStyle']);
    ?>
 />
					<?php 
    _e('Allow users to choose a style for the gallery.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable roles/capabilities', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuRoles" type="checkbox" value="1" <?php 
    checked('1', $ngg_options['wpmuRoles']);
    ?>
 />
					<?php 
    _e('Allow users to change the roles for other blog authors.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Default style', 'nggallery');
    ?>
:</th>
					<td>
					<select name="wpmuCSSfile">
					<?php 
    $csslist = ngg_get_cssfiles();
    foreach ($csslist as $key => $a_cssfile) {
        $css_name = $a_cssfile['Name'];
        if ($key == $ngg_options['wpmuCSSfile']) {
            $file_show = $key;
            $selected = " selected='selected'";
        } else {
            $selected = '';
        }
        $css_name = esc_attr($css_name);
        echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>";
    }
    ?>
					</select><br />
					<?php 
    _e('Choose the default style for the galleries.', 'nggallery');
    ?>
					</td>
				</tr>
			</table> 				
			<div class="submit"><input type="submit" name="updateoption" value="<?php 
    _e('Update');
    ?>
"/></div>
		</form>	
	</div>	

	<?php 
}
示例#3
0
文件: wpmu.php 项目: alx/SimplePress
function nggallery_wpmu_setup()
{
    global $wpdb;
    //to be sure
    if (!is_site_admin()) {
        die('You are not allowed to call this page.');
    }
    // get the options
    $ngg_options = get_site_option('ngg_options');
    // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
    $filepath = site_url('wp-admin/wpmu-admin.php?page=' . $_GET['page'], 'admin');
    if (isset($_POST['updateoption'])) {
        check_admin_referer('ngg_wpmu_settings');
        // get the hidden option fields, taken from WP core
        if ($_POST['page_options']) {
            $options = explode(',', stripslashes($_POST['page_options']));
        }
        if ($options) {
            foreach ($options as $option) {
                $option = trim($option);
                $value = trim($_POST[$option]);
                //		$value = sanitize_option($option, $value); // This does strip slashes on those that need it
                $ngg_options[$option] = $value;
            }
        }
        update_site_option('ngg_options', $ngg_options);
        $messagetext = __('Update successfully', 'nggallery');
    }
    // message windows
    if (!empty($messagetext)) {
        echo '<!-- Last Action --><div id="message" class="updated fade"><p>' . $messagetext . '</p></div>';
    }
    ?>

	<div class="wrap">
		<h2><?php 
    _e('General WordPress MU Settings', 'nggallery');
    ?>
</h2>
		<form name="generaloptions" method="post">
		<?php 
    wp_nonce_field('ngg_wpmu_settings');
    ?>
		<input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuStyle,wpmuRoles,wpmuCSSfile" />
			<table class="form-table">
				<tr valign="top">
					<th align="left"><?php 
    _e('Gallery path', 'nggallery');
    ?>
</th>
					<td><input type="text" size="50" name="gallerypath" value="<?php 
    echo $ngg_options[gallerypath];
    ?>
" title="TEST" /><br />
					<?php 
    _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better. The path must end with a /.', 'nggallery');
    ?>
</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable upload quota check', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php 
    checked('1', $ngg_options[wpmuQuotaCheck]);
    ?>
 />
					<?php 
    _e('Should work if the gallery is bellow the blog.dir', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable zip upload option', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuZipUpload" type="checkbox" value="1" <?php 
    checked('1', $ngg_options[wpmuZipUpload]);
    ?>
 />
					<?php 
    _e('Allow users to upload zip folders.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable style selection', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuStyle" type="checkbox" value="1" <?php 
    checked('1', $ngg_options[wpmuStyle]);
    ?>
 />
					<?php 
    _e('Allow users to choose a style for the gallery.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Enable roles/capabilities', 'nggallery');
    ?>
:</th>
					<td><input name="wpmuRoles" type="checkbox" value="1" <?php 
    checked('1', $ngg_options[wpmuRoles]);
    ?>
 />
					<?php 
    _e('Allow users to change the roles for other blog authors.', 'nggallery');
    ?>
					</td>
				</tr>
				<tr>
					<th valign="top"><?php 
    _e('Default style', 'nggallery');
    ?>
:</th>
					<td>
					<select name="wpmuCSSfile">
					<?php 
    $csslist = ngg_get_cssfiles();
    foreach ($csslist as $key => $a_cssfile) {
        $css_name = $a_cssfile['Name'];
        if ($key == $ngg_options[wpmuCSSfile]) {
            $file_show = $key;
            $selected = " selected='selected'";
        } else {
            $selected = '';
        }
        $css_name = esc_attr($css_name);
        echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>";
    }
    ?>
					</select><br />
					<?php 
    _e('Choose the default style for the galleries.', 'nggallery');
    ?>
					</td>
				</tr>
			</table> 				
			<div class="submit"><input type="submit" name="updateoption" value="<?php 
    _e('Update');
    ?>
 &raquo;"/></div>
		</form>	
	</div>	

	<?php 
}
示例#4
0
function nggallery_admin_style()
{
    global $ngg;
    if ($theme_css_exists = file_exists(TEMPLATEPATH . "/nggallery.css")) {
        $real_file = TEMPLATEPATH . "/nggallery.css";
        $file_show = 'nggallery.css ' . __('(From the theme folder)', 'nggallery');
    } else {
        if (isset($_POST['css'])) {
            check_admin_referer('ngg_style');
            $act_cssfile = $_POST['css'];
            if (isset($_POST['activate'])) {
                // save option now
                $ngg->options['activateCSS'] = $_POST['activateCSS'];
                $ngg->options['CSSfile'] = $act_cssfile;
                update_option('ngg_options', $ngg->options);
                nggGallery::show_message(__('Update Successfully', 'nggallery'));
            }
        } else {
            // get the options
            if (isset($_POST['file'])) {
                $act_cssfile = $_POST['file'];
            } else {
                $act_cssfile = $ngg->options['CSSfile'];
            }
        }
        // set the path
        $real_file = NGGALLERY_ABSPATH . "css/" . $act_cssfile;
    }
    if (isset($_POST['updatecss'])) {
        check_admin_referer('ngg_style');
        if (!current_user_can('edit_themes')) {
            wp_die('<p>' . __('You do not have sufficient permissions to edit templates for this blog.') . '</p>');
        }
        $newcontent = stripslashes($_POST['newcontent']);
        if (is_writeable($real_file)) {
            $f = fopen($real_file, 'w+');
            fwrite($f, $newcontent);
            fclose($f);
            nggGallery::show_message(__('CSS file successfully updated', 'nggallery'));
        }
    }
    // get the content of the file
    //TODO: BUG : Read failed after write a file, maybe a Cache problem
    $error = !is_file($real_file);
    if (!$error && filesize($real_file) > 0) {
        $f = fopen($real_file, 'r');
        $content = fread($f, filesize($real_file));
        $content = htmlspecialchars($content);
    }
    ?>
<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery('#colorSelector').ColorPicker({
			color: '#0000ff',
			onShow: function (colpkr) {
				jQuery(colpkr).fadeIn(500);
				return false;
			},
			onHide: function (colpkr) {
				jQuery(colpkr).fadeOut(500);
				return false;
			},
			onChange: function (hsb, hex, rgb) {
				jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
			}
		});
	});
</script>
<div class="wrap">

	<div class="bordertitle">
        <?php 
    screen_icon('nextgen-gallery');
    ?>
		<h2><?php 
    _e('Style Editor', 'nggallery');
    ?>
</h2>
		<?php 
    if (!$theme_css_exists) {
        ?>
		<form id="themeselector" name="cssfiles" method="post">
		<?php 
        wp_nonce_field('ngg_style');
        ?>
		<strong><?php 
        _e('Activate and use style sheet:', 'nggallery');
        ?>
</strong>
		<input type="checkbox" name="activateCSS" value="1" <?php 
        checked('1', $ngg->options['activateCSS']);
        ?>
 /> 
			<select name="css" id="theme" style="margin: 0pt; padding: 0pt;" onchange="this.form.submit();">
			<?php 
        $csslist = ngg_get_cssfiles();
        foreach ($csslist as $key => $a_cssfile) {
            $css_name = $a_cssfile['Name'];
            if ($key == $act_cssfile) {
                $file_show = $key;
                $selected = " selected='selected'";
                $act_css_description = $a_cssfile['Description'];
                $act_css_author = $a_cssfile['Author'];
                $act_css_version = $a_cssfile['Version'];
            } else {
                $selected = '';
            }
            $css_name = esc_attr($css_name);
            echo "\n\t<option value=\"{$key}\" {$selected}>{$css_name}</option>";
        }
        ?>
			</select>
			<input class="button" type="submit" name="activate" value="<?php 
        _e('Activate', 'nggallery');
        ?>
 &raquo;" class="button" />
		</form>
		<?php 
    }
    ?>
	</div>
	<br style="clear: both;"/>
	
<?php 
    if (!is_multisite() || wpmu_site_admin()) {
        ?>
	<div class="tablenav"> 
	  <?php 
        if (is_writeable($real_file)) {
            echo '<big>' . sprintf(__('Editing <strong>%s</strong>', 'nggallery'), $file_show) . '</big>';
        } else {
            echo '<big>' . sprintf(__('Browsing <strong>%s</strong>', 'nggallery'), $file_show) . '</big>';
        }
        ?>
	</div>
	<br style="clear: both;"/>
	
	<div id="templateside">
	<?php 
        if (!$theme_css_exists) {
            ?>
		<ul>
			<li><strong><?php 
            _e('Author', 'nggallery');
            ?>
 :</strong> <?php 
            echo $act_css_author;
            ?>
</li>
			<li><strong><?php 
            _e('Version', 'nggallery');
            ?>
 :</strong> <?php 
            echo $act_css_version;
            ?>
</li>
			<li><strong><?php 
            _e('Description', 'nggallery');
            ?>
 :<br /></strong> <?php 
            echo $act_css_description;
            ?>
</li>
		</ul>
		<p><?php 
            _e('Tip : Copy your stylesheet (nggallery.css) to your theme folder, so it will be not lost during a upgrade', 'nggallery');
            ?>
</p>
	<?php 
        } else {
            ?>
		<p><?php 
            _e('Your theme contain a NextGEN Gallery stylesheet (nggallery.css), this file will be used', 'nggallery');
            ?>
</p>
	<?php 
        }
        ?>
    	<p><?php 
        _e('Tip No. 2: Use the color picker below to help you find the right color scheme for your gallery!', 'nggallery');
        ?>
</p>
    	<div id="colorSelector">
        	<div></div>
        </div>
	</div>
		<?php 
        if (!$error) {
            ?>
		<form name="template" id="template" method="post">
			 <?php 
            wp_nonce_field('ngg_style');
            ?>
			 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"  class="codepress css"><?php 
            echo $content;
            ?>
</textarea>
			 <input type="hidden" name="updatecss" value="updatecss" />
			 <input type="hidden" name="file" value="<?php 
            echo $file_show;
            ?>
" />
			 </div>
	<?php 
            if (is_writeable($real_file)) {
                ?>
		<p class="submit">
			<input class="button-primary action" type="submit" name="submit" value="<?php 
                _e('Update File', 'nggallery');
                ?>
" tabindex="2" />
		</p>
	<?php 
            } else {
                ?>
	<p><em><?php 
                _e('If this file were writable you could edit it.', 'nggallery');
                ?>
</em></p>
	<?php 
            }
            ?>
		</form>
		<?php 
        } else {
            echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.', 'nggallery') . '</p></div>';
        }
        ?>
	<div class="clear"> &nbsp; </div>
</div> <!-- wrap-->
	
<?php 
    }
}