/wp-content/plugins/nextgen-gallery/admin/wpmu.php

https://bitbucket.org/antonyravel/cape-resorts · PHP · 117 lines · 98 code · 12 blank · 7 comment · 10 complexity · 7dff83c3cd1f03809a7802773cc3a9a3 MD5 · raw file

  1. <?php
  2. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
  3. function nggallery_wpmu_setup() {
  4. //to be sure
  5. if ( !is_super_admin() )
  6. die('You are not allowed to call this page.');
  7. $messagetext = '';
  8. // get the options
  9. $ngg_options = get_site_option('ngg_options');
  10. if ( isset($_POST['updateoption']) ) {
  11. check_admin_referer('ngg_wpmu_settings');
  12. // get the hidden option fields, taken from WP core
  13. if ( $_POST['page_options'] )
  14. $options = explode(',', stripslashes($_POST['page_options']));
  15. if ($options) {
  16. foreach ($options as $option) {
  17. $option = trim($option);
  18. $value = isset($_POST[$option]) ? trim($_POST[$option]) : false;
  19. // $value = sanitize_option($option, $value); // This does strip slashes on those that need it
  20. $ngg_options[$option] = $value;
  21. }
  22. }
  23. // the path should always end with a slash
  24. $ngg_options['gallerypath'] = trailingslashit($ngg_options['gallerypath']);
  25. update_site_option('ngg_options', $ngg_options);
  26. $messagetext = __('Update successfully','nggallery');
  27. }
  28. // Show donation message only one time.
  29. if (isset ( $_GET['hideSupportInfo']) ) {
  30. $ngg_options['hideSupportInfo'] = true;
  31. update_site_option('ngg_options', $ngg_options);
  32. }
  33. // message windows
  34. if( !empty($messagetext) ) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
  35. ?>
  36. <div class="wrap">
  37. <h2><?php _e('Network Options','nggallery'); ?></h2>
  38. <form name="generaloptions" method="post">
  39. <?php wp_nonce_field('ngg_wpmu_settings') ?>
  40. <input type="hidden" name="page_options" value="gallerypath,wpmuQuotaCheck,wpmuZipUpload,wpmuImportFolder,wpmuStyle,wpmuRoles,wpmuCSSfile" />
  41. <table class="form-table">
  42. <tr valign="top">
  43. <th align="left"><?php _e('Gallery path','nggallery') ?></th>
  44. <td><input type="text" size="50" name="gallerypath" value="<?php echo $ngg_options['gallerypath']; ?>" /><br />
  45. <?php _e('This is the default path for all blogs. With the placeholder %BLOG_ID% you can organize the folder structure better.','nggallery') ?>
  46. <?php echo str_replace('%s', '<code>wp-content/blogs.dir/%BLOG_ID%/files/</code>', __('The default setting should be %s', 'nggallery')); ?>
  47. </td>
  48. </tr>
  49. <tr>
  50. <th valign="top"><?php _e('Enable upload quota check','nggallery') ?>:</th>
  51. <td><input name="wpmuQuotaCheck" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuQuotaCheck']); ?> />
  52. <?php _e('Should work if the gallery is bellow the blog.dir','nggallery') ?>
  53. </td>
  54. </tr>
  55. <tr>
  56. <th valign="top"><?php _e('Enable zip upload option','nggallery') ?>:</th>
  57. <td><input name="wpmuZipUpload" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuZipUpload']); ?> />
  58. <?php _e('Allow users to upload zip folders.','nggallery') ?>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th valign="top"><?php _e('Enable import function','nggallery') ?>:</th>
  63. <td><input name="wpmuImportFolder" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuImportFolder']); ?> />
  64. <?php _e('Allow users to import images folders from the server.','nggallery') ?>
  65. </td>
  66. </tr>
  67. <tr>
  68. <th valign="top"><?php _e('Enable style selection','nggallery') ?>:</th>
  69. <td><input name="wpmuStyle" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuStyle']); ?> />
  70. <?php _e('Allow users to choose a style for the gallery.','nggallery') ?>
  71. </td>
  72. </tr>
  73. <tr>
  74. <th valign="top"><?php _e('Enable roles/capabilities','nggallery') ?>:</th>
  75. <td><input name="wpmuRoles" type="checkbox" value="1" <?php checked('1', $ngg_options['wpmuRoles']); ?> />
  76. <?php _e('Allow users to change the roles for other blog authors.','nggallery') ?>
  77. </td>
  78. </tr>
  79. <tr>
  80. <th valign="top"><?php _e('Default style','nggallery') ?>:</th>
  81. <td>
  82. <select name="wpmuCSSfile">
  83. <?php
  84. $csslist = ngg_get_cssfiles();
  85. foreach ($csslist as $key =>$a_cssfile) {
  86. $css_name = $a_cssfile['Name'];
  87. if ($key == $ngg_options['wpmuCSSfile']) {
  88. $file_show = $key;
  89. $selected = " selected='selected'";
  90. }
  91. else $selected = '';
  92. $css_name = esc_attr($css_name);
  93. echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
  94. }
  95. ?>
  96. </select><br />
  97. <?php _e('Choose the default style for the galleries.','nggallery') ?>
  98. </td>
  99. </tr>
  100. </table>
  101. <div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?>"/></div>
  102. </form>
  103. </div>
  104. <?php
  105. }