PluginProbe
Adminimize / 1.7.16
Adminimize v1.7.16
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
adminimize / adminimize.php

adminimize.php in Adminimize 1.7.16, at adminimize.php

1,637 lines 57.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Adminimize
4 * @author Frank B&uuml;ltge
5 */
6
7 /*
8 Plugin Name: Adminimize
9 Plugin URI: http://bueltge.de/wordpress-admin-theme-adminimize/674/
10 Text Domain: adminimize
11 Domain Path: /languages
12 Description: Visually compresses the administratrive meta-boxes so that more admin page content can be initially seen. The plugin that lets you hide 'unnecessary' items from the WordPress administration menu, for alle roles of your install. You can also hide post meta controls on the edit-area to simplify the interface. It is possible to simplify the admin in different for all roles.
13 Author: Frank B&uuml;ltge
14 Author URI: http://bueltge.de/
15 Version: 1.7.16
16 License: GPL
17 */
18
19 /**
20 * The stylesheet and the initial idea is from Eric A. Meyer, http://meyerweb.com/
21 * and i have written a plugin with many options on the basis
22 * of differently user-right and a user-friendly range in admin-area.
23 */
24
25
26 global $wp_version;
27 if ( !function_exists ('add_action') || version_compare($wp_version, "2.5alpha", "<") ) {
28 if ( function_exists ('add_action') )
29 $exit_msg = 'The plugin <em><a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/">Adminimize</a></em> requires WordPress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update WordPress</a> or delete the plugin.';
30 else
31 $exit_msg = '';
32
33 header('Status: 403 Forbidden');
34 header('HTTP/1.1 403 Forbidden');
35 exit($exit_msg);
36 }
37
38 if ( function_exists('add_action') ) {
39
40 // Pre-2.6 compatibility
41 if ( !defined( 'WP_CONTENT_URL' ) )
42 define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
43 if ( !defined( 'WP_CONTENT_DIR' ) )
44 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
45 if ( !defined( 'WP_PLUGIN_URL' ) )
46 define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
47 if ( !defined( 'WP_PLUGIN_DIR' ) )
48 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
49
50 // plugin definitions
51 define( 'FB_ADMINIMIZE_BASENAME', plugin_basename( __FILE__ ) );
52 define( 'FB_ADMINIMIZE_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
53 define( 'FB_ADMINIMIZE_TEXTDOMAIN', 'adminimize' );
54 }
55
56 function _mw_adminimize_textdomain() {
57
58 load_plugin_textdomain( FB_ADMINIMIZE_TEXTDOMAIN, FALSE, dirname( FB_ADMINIMIZE_BASENAME ) . '/languages');
59 }
60
61
62 function _mw_adminimize_register_styles() {
63
64 wp_register_style( 'adminimize-style', plugins_url( 'css/style.css', __FILE__ ) );
65 }
66
67
68 function recursive_in_array($needle, $haystack) {
69
70 if ( '' != $haystack ) {
71 foreach ($haystack as $stalk) {
72 if ( $needle == $stalk || ( is_array($stalk) && recursive_in_array($needle, $stalk) ) ) {
73 return TRUE;
74 }
75 }
76 return FALSE;
77 }
78 }
79
80
81 /**
82 * some basics for message
83 */
84 class _mw_adminimize_message_class {
85
86 /**
87 * constructor
88 */
89 function _mw_adminimize_message_class() {
90 $this->localizionName = FB_ADMINIMIZE_TEXTDOMAIN;
91 $this->errors = new WP_Error();
92 $this->initialize_errors();
93 }
94
95 /**
96 * get_error - Returns an error message based on the passed code
97 * Parameters - $code (the error code as a string)
98 * @return Returns an error message
99 */
100 function get_error($code = '') {
101 $errorMessage = $this->errors->get_error_message($code);
102 if ($errorMessage == NULL) {
103 return __("Unknown error.", $this->localizionName);
104 }
105 return $errorMessage;
106 }
107
108 /**
109 * Initializes all the error messages
110 */
111 function initialize_errors() {
112 $this->errors->add('_mw_adminimize_update', __('The updates were saved.', $this->localizionName));
113 $this->errors->add('_mw_adminimize_access_denied', __('You have not enough rights to edit entries in the database.', $this->localizionName));
114 $this->errors->add('_mw_adminimize_import', __('All entries in the database were imported.', $this->localizionName));
115 $this->errors->add('_mw_adminimize_deinstall', __('All entries in the database were deleted.', $this->localizionName));
116 $this->errors->add('_mw_adminimize_deinstall_yes', __('Set the checkbox on deinstall-button.', $this->localizionName));
117 $this->errors->add('_mw_adminimize_get_option', __('Can\'t load menu and submenu.', $this->localizionName));
118 $this->errors->add('_mw_adminimize_set_theme', __('Backend-Theme was activated!', $this->localizionName));
119 $this->errors->add('_mw_adminimize_load_theme', __('Load user data to themes was successful.', $this->localizionName));
120 }
121 }
122
123
124 function _mw_adminimize_exclude_super_admin() {
125 // exclude super admin
126 if ( function_exists('is_super_admin')
127 && is_super_admin()
128 && 1 == _mw_adminimize_getOptionValue('_mw_adminimize_exclude_super_admin')
129 )
130 return TRUE;
131
132 return FALSE;
133 }
134
135
136 /**
137 * get_all_user_roles() - Returns an array with all user roles(names) in it.
138 * Inclusive self defined roles (for example with the 'Role Manager' plugin).
139 * code by Vincent Weber, www.webRtistik.nl
140 * @uses $wp_roles
141 * @return $user_roles
142 */
143 function get_all_user_roles() {
144 global $wp_roles;
145
146 $user_roles = array();
147
148 if ( isset($wp_roles->roles) && is_array($wp_roles->roles) ) {
149 foreach ($wp_roles->roles as $role => $data) {
150 array_push($user_roles, $role);
151 //$data contains caps, maybe for later use..
152 }
153 }
154
155 return $user_roles;
156 }
157
158
159 /**
160 * get_all_user_roles_names() - Returns an array with all user roles_names in it.
161 * Inclusive self defined roles (for example with the 'Role Manager' plugin).
162 * @uses $wp_roles
163 * @return $user_roles_names
164 */
165 function get_all_user_roles_names() {
166 global $wp_roles;
167
168 $user_roles_names = array();
169
170 foreach ($wp_roles->role_names as $role_name => $data) {
171 if ( function_exists('translate_user_role') )
172 $data = translate_user_role( $data );
173 else
174 $data = translate_with_context( $data );
175
176 array_push($user_roles_names, $data );
177 }
178
179 return $user_roles_names;
180 }
181
182 /**
183 * Control Flash Uploader
184 *
185 * @return boolean
186 */
187 function _mw_adminimize_control_flashloader() {
188
189 $_mw_adminimize_control_flashloader = _mw_adminimize_getOptionValue('_mw_adminimize_control_flashloader');
190
191 if ($_mw_adminimize_control_flashloader == '1') {
192 return FALSE;
193 } else {
194 return TRUE;
195 }
196 }
197
198
199 /**
200 * check user-option and add new style
201 * @uses $pagenow
202 */
203 function _mw_adminimize_admin_init() {
204 global $pagenow, $menu, $submenu, $adminimizeoptions, $wp_version;
205
206 if ( function_exists('get_post_type_object') ) {
207 if ( isset($_GET['post']) )
208 $post_id = (int) $_GET['post'];
209 elseif ( isset($_POST['post_ID']) )
210 $post_id = (int) $_POST['post_ID'];
211 else
212 $post_id = 0;
213 $post_ID = $post_id;
214 $post = NULL;
215 $post_type_object = NULL;
216 $post_type = NULL;
217 if ( $post_id ) {
218 $post = get_post($post_id);
219 if ( $post ) {
220 $post_type_object = get_post_type_object($post->post_type);
221 if ( $post_type_object ) {
222 $post_type = $post->post_type;
223 $current_screen->post_type = $post->post_type;
224 $current_screen->id = $current_screen->post_type;
225 }
226 }
227 } elseif ( isset($_POST['post_type']) ) {
228 $post_type_object = get_post_type_object($_POST['post_type']);
229 if ( $post_type_object ) {
230 $post_type = $post_type_object->name;
231 $current_screen->post_type = $post_type;
232 $current_screen->id = $current_screen->post_type;
233 }
234 }
235 } else {
236 $post_type = '';
237 }
238
239 $user_roles = get_all_user_roles();
240
241 $adminimizeoptions = get_option('mw_adminimize');
242
243 foreach ($user_roles as $role) {
244 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
245 $disabled_metaboxes_post_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_post_'. $role .'_items');
246 $disabled_metaboxes_page_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_page_'. $role .'_items');
247 $disabled_link_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_link_option_'. $role .'_items');
248 $disabled_nav_menu_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_nav_menu_option_'. $role .'_items');
249 }
250
251 $disabled_metaboxes_post_all = array();
252 $disabled_metaboxes_page_all = array();
253
254 foreach ($user_roles as $role) {
255 array_push($disabled_metaboxes_post_all, $disabled_metaboxes_post_[$role]);
256 array_push($disabled_metaboxes_page_all, $disabled_metaboxes_page_[$role]);
257 }
258
259 $_mw_admin_color = get_user_option('admin_color');
260
261 //global options
262 // exclude super admin
263 if ( ! _mw_adminimize_exclude_super_admin() ) {
264 $_mw_adminimize_footer = _mw_adminimize_getOptionValue('_mw_adminimize_footer');
265 switch ($_mw_adminimize_footer) {
266 case 1:
267 wp_enqueue_script( '_mw_adminimize_remove_footer', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/remove_footer.js', array('jquery') );
268 break;
269 }
270
271 $_mw_adminimize_header = _mw_adminimize_getOptionValue('_mw_adminimize_header');
272 switch ($_mw_adminimize_header) {
273 case 1:
274 wp_enqueue_script( '_mw_adminimize_remove_header', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/remove_header.js', array('jquery') );
275 break;
276 }
277
278 //post-page options
279 $post_page_pages = array('post-new.php', 'post.php', 'page-new.php', 'page.php');
280 if ( in_array( $pagenow, $post_page_pages ) ) {
281
282 $_mw_adminimize_writescroll = _mw_adminimize_getOptionValue('_mw_adminimize_writescroll');
283 switch ($_mw_adminimize_writescroll) {
284 case 1:
285 wp_enqueue_script( '_mw_adminimize_writescroll', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/writescroll.js', array('jquery') );
286 break;
287 }
288 $_mw_adminimize_tb_window = _mw_adminimize_getOptionValue('_mw_adminimize_tb_window');
289 switch ($_mw_adminimize_tb_window) {
290 case 1:
291 wp_deregister_script('media-upload');
292 wp_enqueue_script('media-upload', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/tb_window.js', array('thickbox'));
293 break;
294 }
295 $_mw_adminimize_timestamp = _mw_adminimize_getOptionValue('_mw_adminimize_timestamp');
296 switch ($_mw_adminimize_timestamp) {
297 case 1:
298 wp_enqueue_script( '_mw_adminimize_timestamp', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/js/timestamp.js', array('jquery') );
299 break;
300 }
301
302 //category options
303 $_mw_adminimize_cat_full = _mw_adminimize_getOptionValue('_mw_adminimize_cat_full');
304 switch ($_mw_adminimize_cat_full) {
305 case 1:
306 wp_enqueue_style( 'adminimize-ful-category', WP_PLUGIN_URL . '/' . FB_ADMINIMIZE_BASEFOLDER . '/css/mw_cat_full.css' );
307 break;
308 }
309
310 // set default editor tinymce
311 if ( recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags', $disabled_metaboxes_page_all)
312 || recursive_in_array('#editor-toolbar #edButtonHTML, #quicktags', $disabled_metaboxes_post_all) )
313 add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
314
315 // remove media bottons
316 if ( recursive_in_array('media_buttons', $disabled_metaboxes_page_all)
317 || recursive_in_array('media_buttons', $disabled_metaboxes_post_all) )
318 remove_action('media_buttons', 'media_buttons');
319
320 //add_filter('image_downsize', '_mw_adminimize_image_downsize', 1, 3);
321 }
322
323 $_mw_adminimize_control_flashloader = _mw_adminimize_getOptionValue('_mw_adminimize_control_flashloader');
324 switch ($_mw_adminimize_control_flashloader) {
325 case 1:
326 add_filter( 'flash_uploader', '_mw_adminimize_control_flashloader', 1 );
327 break;
328 }
329 }
330
331 if ( ($_mw_admin_color == 'mw_fresh') ||
332 ($_mw_admin_color == 'mw_classic') ||
333 ($_mw_admin_color == 'mw_colorblind') ||
334 ($_mw_admin_color == 'mw_grey') ||
335 ($_mw_admin_color == 'mw_fresh_ozh_am') ||
336 ($_mw_admin_color == 'mw_classic_ozh_am') ||
337 ($_mw_admin_color == 'mw_fresh_lm') ||
338 ($_mw_admin_color == 'mw_classic_lm') ||
339 ($_mw_admin_color == 'mw_wp23')
340 ) {
341
342 // only posts
343 if (
344 ( 'post-new.php' == $pagenow ) ||
345 ( 'post.php' == $pagenow ) ||
346 ( 'post' == $post_type )
347 ) {
348 if ( version_compare( substr($wp_version, 0, 3), '2.7', '<' ) )
349 add_action('admin_head', '_mw_adminimize_remove_box', 99);
350
351 // check for array empty
352 if ( !isset($disabled_metaboxes_post_['editor']['0']) )
353 $disabled_metaboxes_post_['editor']['0'] = '';
354 if ( isset($disabled_metaboxes_post_['administrator']['0']) )
355 $disabled_metaboxes_post_['administrator']['0'] = '';
356 if ( version_compare(substr($wp_version, 0, 3), '2.7', '<') ) {
357 if ( !recursive_in_array('#categorydivsb', $disabled_metaboxes_post_all) )
358 add_action('submitpost_box', '_mw_adminimize_sidecat_list_category_box');
359 if ( !recursive_in_array('#tagsdivsb', $disabled_metaboxes_post_all) )
360 add_action('submitpost_box', '_mw_adminimize_sidecat_list_tag_box');
361 }
362 }
363
364 // only pages
365 if (
366 ( 'page-new.php' == $pagenow ) ||
367 ( 'page.php' == $pagenow ) ||
368 ( 'post_type=page' == esc_attr($_SERVER['QUERY_STRING']) ) ||
369 ( 'page' == $post_type )
370 ) {
371
372 // check for array empty
373 if ( !isset($disabled_metaboxes_page_['editor']['0']) )
374 $disabled_metaboxes_page_['editor']['0'] = '';
375 if ( isset($disabled_metaboxes_page_['administrator']['0']) )
376 $disabled_metaboxes_page_['administrator']['0'] = '';
377 }
378
379 }
380
381 // set menu option
382 add_action('admin_head', '_mw_adminimize_set_menu_option', 1);
383
384 // global_options
385 add_action('admin_head', '_mw_adminimize_set_global_option', 1);
386
387 // set metabox post option
388 $post_pages = array('post-new.php', 'post.php', 'post');
389 if ( in_array( $pagenow, $post_pages ) || in_array($post_type, $post_pages) ) {
390 if ( ( esc_attr($_SERVER['QUERY_STRING']) != 'post_type=page' ) && ($post_type != 'page') )
391 add_action('admin_head', '_mw_adminimize_set_metabox_post_option', 1);
392 }
393
394 // set metabox page option
395 $page_pages = array( 'page-new.php', 'page.php', 'post_type=page', 'page' );
396 if ( in_array( $pagenow, $page_pages ) || in_array($post_type, $page_pages) || in_array( esc_attr($_SERVER['QUERY_STRING']), $page_pages) )
397 add_action('admin_head', '_mw_adminimize_set_metabox_page_option', 1);
398
399 // set link option
400 $link_pages = array('link-manager.php', 'link-add.php', 'edit-link-categories.php');
401 if ( in_array( $pagenow, $link_pages ) )
402 add_action('admin_head', '_mw_adminimize_set_link_option', 1);
403
404 // set wp nav menu options
405 $nav_menu_pages = array('nav-menus.php');
406 if ( in_array( $pagenow, $nav_menu_pages ) )
407 add_action('admin_head', '_mw_adminimize_set_nav_menu_option', 1);
408
409 add_action('in_admin_footer', '_mw_adminimize_admin_footer');
410
411 $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
412 $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
413 }
414
415 // on init of WordPress
416 add_action( 'init', '_mw_adminimize_textdomain' );
417 add_action( 'init', '_mw_adminimize_register_styles' );
418 add_action( 'init', '_mw_adminimize_remove_admin_bar' );
419
420 // on admin init
421 add_action( 'admin_init', '_mw_adminimize_admin_init', 1 );
422 add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
423 add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
424 add_action( 'admin_init', '_mw_adminimize_admin_styles', 1 );
425
426 register_activation_hook( __FILE__, '_mw_adminimize_install' );
427 register_uninstall_hook( __FILE__, '_mw_adminimize_deinstall' );
428 //register_deactivation_hook(__FILE__, '_mw_adminimize_deinstall');
429
430
431 /**
432 * Uses WordPress filter for image_downsize, kill wp-image-dimension
433 * code by Andrew Rickmann
434 * http://www.wp-fun.co.uk/
435 * @param $value, $id, $size
436 */
437 function _mw_adminimize_image_downsize($value = FALSE, $id = 0, $size = "medium") {
438
439 if ( !wp_attachment_is_image($id) )
440 return FALSE;
441
442 $img_url = wp_get_attachment_url($id);
443
444 // Mimic functionality in image_downsize function in wp-includes/media.php
445 if ( $intermediate = image_get_intermediate_size($id, $size) ) {
446 $img_url = str_replace( basename($img_url), $intermediate['file'], $img_url );
447 } elseif ( $size == 'thumbnail' ) {
448 // fall back to the old thumbnail
449 if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) {
450 $img_url = str_replace( basename($img_url), basename($thumb_file), $img_url );
451 }
452 }
453
454 if ( $img_url)
455 return array($img_url, 0, 0);
456
457 return FALSE;
458 }
459
460
461 /**
462 * list category-box in sidebar
463 * @uses $post_ID
464 */
465 function _mw_adminimize_sidecat_list_category_box() {
466 global $post_ID;
467 ?>
468
469 <div class="inside" id="categorydivsb">
470 <p><strong><?php _e("Categories"); ?></strong></p>
471 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
472 <?php wp_category_checklist($post_ID); ?>
473 </ul>
474 <?php if ( !defined('WP_PLUGIN_DIR') ) { // for wp <2.6 ?>
475 <div id="category-adder" class="wp-hidden-children">
476 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
477 <p id="category-add" class="wp-hidden-child">
478 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
479 <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
480 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
481 <?php wp_nonce_field( 'add-category', '_ajax_nonce', FALSE ); ?>
482 <span id="category-ajax-response"></span>
483 </p>
484 </div>
485 <?php } else { ?>
486 <div id="category-adder" class="wp-hidden-children">
487 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
488 <p id="category-add" class="wp-hidden-child">
489 <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="TRUE"/>
490 <br />
491 <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
492 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
493 <?php wp_nonce_field( 'add-category', '_ajax_nonce', FALSE ); ?>
494 <span id="category-ajax-response"></span>
495 </p>
496 </div>
497 <?php } ?>
498 </div>
499 <?php
500 }
501
502
503 /**
504 * list tag-box in sidebar
505 * @uses $post_ID
506 */
507 function _mw_adminimize_sidecat_list_tag_box() {
508 global $post_ID;
509
510 if ( !class_exists('SimpleTagsAdmin') ) {
511 ?>
512 <div class="inside" id="tagsdivsb">
513 <p><strong><?php _e('Tags'); ?></strong></p>
514 <p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit($post_ID); ?>" /></p>
515 <div id="tagchecklist"></div>
516 </div>
517 <?php
518 }
519 }
520
521
522 /**
523 * remove default categorydiv
524 * @echo script
525 */
526 function _mw_adminimize_remove_box() {
527
528 if ( function_exists('remove_meta_box') ) {
529 if ( !class_exists('SimpleTagsAdmin') )
530 remove_meta_box('tagsdiv', 'post', 'normal');
531
532 remove_meta_box('categorydiv', 'post', 'normal');
533 } else {
534 $_mw_adminimize_sidecat_admin_head = "\n" . '<script type="text/javascript">' . "\n";
535 $_mw_adminimize_sidecat_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#categorydiv\').remove(); });' . "\n";
536 $_mw_adminimize_sidecat_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#tagsdiv\').remove(); });' . "\n";
537 $_mw_adminimize_sidecat_admin_head .= '</script>' . "\n";
538
539 echo $_mw_adminimize_sidecat_admin_head;
540 }
541 }
542
543
544 /**
545 * add new adminstyle to usersettings
546 * @param $file
547 */
548 function _mw_adminimize_admin_styles($file) {
549 global $wp_version;
550
551 $_mw_adminimize_path = WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/';
552
553 if ( version_compare( $wp_version, '2.7alpha', '>=' ) ) {
554 // MW Adminimize Classic
555 $styleName = 'Adminimize:' . ' ' . __('Blue');
556 wp_admin_css_color (
557 'mw_classic', $styleName, $_mw_adminimize_path . 'mw_classic27.css',
558 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
559 );
560
561 // MW Adminimize Fresh
562 $styleName = 'Adminimize:' . ' ' . __('Gray');
563 wp_admin_css_color (
564 'mw_fresh', $styleName, $_mw_adminimize_path . 'mw_fresh27.css',
565 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
566 );
567
568 // MW Adminimize Classic Fixed
569 $styleName = 'Adminimize:' . ' Fixed ' . __('Blue');
570 wp_admin_css_color (
571 'mw_classic_fixed', $styleName, $_mw_adminimize_path . 'mw_classic28_fixed.css',
572 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
573 );
574
575 // MW Adminimize Fresh Fixed
576 $styleName = 'Adminimize:' . ' Fixed ' . __('Gray');
577 wp_admin_css_color (
578 'mw_fresh_fixed', $styleName, $_mw_adminimize_path . 'mw_fresh28_fixed.css',
579 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
580 );
581
582 // MW Adminimize Classic Tweak
583 $styleName = 'Adminimize:' . ' Tweak ' . __('Blue');
584 wp_admin_css_color (
585 'mw_classic_tweak', $styleName, $_mw_adminimize_path . 'mw_classic28_tweak.css',
586 array('#073447', '#21759b', '#eaf3fa', '#bbd8e7')
587 );
588
589 // MW Adminimize Fresh Tweak
590 $styleName = 'Adminimize:' . ' Tweak ' . __('Gray');
591 wp_admin_css_color (
592 'mw_fresh_tweak', $styleName, $_mw_adminimize_path . 'mw_fresh28_tweak.css',
593 array('#464646', '#6d6d6d', '#f1f1f1', '#dfdfdf')
594 );
595
596 } else {
597 // MW Adminimize Classic
598 $styleName = 'MW Adminimize:' . ' ' . __('Classic');
599 wp_admin_css_color (
600 'mw_classic', $styleName, $_mw_adminimize_path . 'mw_classic.css',
601 array('#07273E', '#14568A', '#D54E21', '#2683AE')
602 );
603
604 // MW Adminimize Fresh
605 $styleName = 'MW Adminimize:' . ' ' . __('Fresh');
606 wp_admin_css_color (
607 'mw_fresh', $styleName, $_mw_adminimize_path . 'mw_fresh.css',
608 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
609 );
610
611 // MW Adminimize WordPress 2.3
612 $styleName = 'MW Adminimize:' . ' ' . __('WordPress 2.3');
613 wp_admin_css_color (
614 'mw_wp23', $styleName, $_mw_adminimize_path . 'mw_wp23.css',
615 array('#000000', '#14568A', '#448ABD', '#83B4D8')
616 );
617
618 // MW Adminimize Colorblind
619 $styleName = 'MW Adminimize:' . ' ' . __('Maybe i\'m colorblind');
620 wp_admin_css_color (
621 'mw_colorblind', $styleName, $_mw_adminimize_path . 'mw_colorblind.css',
622 array('#FF9419', '#F0720C', '#710001', '#550007', '#CF4529')
623 );
624
625 // MW Adminimize Grey
626 $styleName = 'MW Adminimize:' . ' ' . __('Grey');
627 wp_admin_css_color (
628 'mw_grey', $styleName, $_mw_adminimize_path . 'mw_grey.css',
629 array('#000000', '#787878', '#F0F0F0', '#D8D8D8', '#909090')
630 );
631 }
632 /**
633 * style and changes for plugin Admin Drop Down Menu
634 * by Ozh
635 * http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/
636 */
637 if ( function_exists('wp_ozh_adminmenu') ) {
638
639 // MW Adminimize Classic include ozh adminmenu
640 $styleName = 'MW Adminimize inc. Admin Drop Down Menu' . ' ' . __('Classic');
641 wp_admin_css_color (
642 'mw_classic_ozh_am', $styleName, $_mw_adminimize_path . 'mw_classic_ozh_am.css',
643 array('#07273E', '#14568A', '#D54E21', '#2683AE')
644 );
645
646 // MW Adminimize Fresh include ozh adminmenu
647 $styleName = 'MW Adminimize inc. Admin Drop Down Menu' . ' ' . __('Fresh');
648 wp_admin_css_color (
649 'mw_fresh_ozh_am', $styleName, $_mw_adminimize_path . 'mw_fresh_ozh_am.css',
650 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
651 );
652
653 }
654
655 /**
656 * style and changes for plugin Lighter Menus
657 * by corpodibacco
658 * http://www.italyisfalling.com/lighter-menus
659 */
660 if ( function_exists('lm_build') ) {
661
662 // MW Adminimize Classic include Lighter Menus
663 $styleName = 'MW Adminimize inc. Lighter Menus' . ' ' . __('Classic');
664 wp_admin_css_color (
665 'mw_classic_lm', $styleName, $_mw_adminimize_path . 'mw_classic_lm.css',
666 array('#07273E', '#14568A', '#D54E21', '#2683AE')
667 );
668
669 // MW Adminimize Fresh include Lighter Menus
670 $styleName = 'MW Adminimize inc. Lighter Menus' . ' ' . __('Fresh');
671 wp_admin_css_color (
672 'mw_fresh_lm', $styleName, $_mw_adminimize_path . 'mw_fresh_lm.css',
673 array('#464646', '#CEE1EF', '#D54E21', '#2683AE')
674 );
675
676 }
677 }
678
679
680 /**
681 * remove the dashbord
682 * @author of basic Austin Matzko
683 * http://www.ilfilosofo.com/blog/2006/05/24/plugin-remove-the-wordpress-dashboard/
684 */
685 function _mw_adminimize_remove_dashboard() {
686 global $menu, $submenu, $user_ID, $wp_version;
687
688 $user_roles = get_all_user_roles();
689
690 foreach ($user_roles as $role) {
691 $disabled_menu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_menu_'. $role .'_items');
692 $disabled_submenu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_submenu_'. $role .'_items');
693 }
694
695 $disabled_menu_all = array();
696 $disabled_submenu_all = array();
697
698 foreach ($user_roles as $role) {
699 array_push($disabled_menu_all, $disabled_menu_[$role]);
700 array_push($disabled_submenu_all, $disabled_submenu_[$role]);
701 }
702
703 // remove dashboard
704 if ( $disabled_menu_all != '' || $disabled_submenu_all != '' ) {
705
706 foreach ($user_roles as $role) {
707
708 if ( current_user_can($role) ) {
709 if ( recursive_in_array('index.php', $disabled_menu_[$role]) || recursive_in_array('index.php', $disabled_submenu_[$role]) )
710 $redirect = TRUE;
711 else
712 $redirect = FALSE;
713 }
714 }
715
716 if ( $redirect ) {
717 $_mw_adminimize_db_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_db_redirect');
718 $_mw_adminimize_db_redirect_admin_url = get_option('siteurl') . '/wp-admin/';
719 switch ($_mw_adminimize_db_redirect) {
720 case 0:
721 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'profile.php';
722 break;
723 case 1:
724 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit.php';
725 break;
726 case 2:
727 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit.php?post_type=page';
728 break;
729 case 3:
730 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'post-new.php';
731 break;
732 case 4:
733 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'page-new.php';
734 break;
735 case 5:
736 $_mw_adminimize_db_redirect = $_mw_adminimize_db_redirect_admin_url . 'edit-comments.php';
737 break;
738 case 6:
739 $_mw_adminimize_db_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_db_redirect_txt');
740 break;
741 }
742
743 // fallback for WP smaller 3.0
744 if ( version_compare($wp_version, "3.0alpha", "<") && 'edit.php?post_type=page' == $_mw_adminimize_db_redirect )
745 $_mw_adminimize_db_redirect = 'edit-pages.php';
746
747 $the_user = new WP_User($user_ID);
748 reset($menu);
749 $page = key($menu);
750
751 while ( (__('Dashboard') != $menu[$page][0]) && next($menu) || (__('Dashboard') != $menu[$page][1]) && next($menu) )
752 $page = key($menu);
753
754 if (__('Dashboard') == $menu[$page][0] || __('Dashboard') == $menu[$page][1])
755 unset($menu[$page]);
756 reset($menu); $page = key($menu);
757
758 while ( !$the_user->has_cap($menu[$page][1]) && next($menu) )
759 $page = key($menu);
760
761 if ( preg_match('#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI']) ) {
762 wp_redirect( $_mw_adminimize_db_redirect );
763 }
764 }
765 }
766 }
767
768
769 /**
770 * remove the flash_uploader
771 */
772 function _mw_adminimize_disable_flash_uploader() {
773
774 return FALSE;
775 }
776
777
778 /**
779 * set menu options from database
780 */
781 function _mw_adminimize_set_menu_option() {
782 global $pagenow, $menu, $submenu, $user_identity, $wp_version;
783
784 // exclude super admin
785 if ( _mw_adminimize_exclude_super_admin() )
786 return NULL;
787
788 $user_roles = get_all_user_roles();
789
790 foreach ($user_roles as $role) {
791 $disabled_menu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_menu_'. $role .'_items');
792 $disabled_submenu_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_submenu_'. $role .'_items');
793 }
794
795 $_mw_adminimize_admin_head = "\n";
796 $_mw_adminimize_user_info = _mw_adminimize_getOptionValue('_mw_adminimize_user_info');
797 $_mw_adminimize_ui_redirect = _mw_adminimize_getOptionValue('_mw_adminimize_ui_redirect');
798
799 switch ($_mw_adminimize_user_info) {
800 case 1:
801 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
802 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove(); });' . "\n";
803 $_mw_adminimize_admin_head .= '</script>' . "\n";
804 break;
805 case 2:
806 if ( version_compare($wp_version, "3.0alpha", ">=") ) {
807 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
808 } elseif ( version_compare(substr($wp_version, 0, 3), '2.7', '>=') ) {
809 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
810 } else {
811 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
812 }
813 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
814 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove();';
815 if ($_mw_adminimize_ui_redirect == '1') {
816 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout&amp;redirect_to=') . get_option('siteurl') , 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
817 } else {
818 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout') , 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
819 }
820 $_mw_adminimize_admin_head .= '</script>' . "\n";
821 break;
822 case 3:
823 if ( version_compare($wp_version, "3.0alpha", ">=") ) {
824 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info30.css" type="text/css" />' . "\n";
825 } elseif ( version_compare(substr($wp_version, 0, 3), '2.7', '>=') ) {
826 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info27.css" type="text/css" />' . "\n";
827 } else {
828 $_mw_adminimize_admin_head .= '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/css/mw_small_user_info.css" type="text/css" />' . "\n";
829 }
830 $_mw_adminimize_admin_head .= '<script type="text/javascript">' . "\n";
831 $_mw_adminimize_admin_head .= "\t" . 'jQuery(document).ready(function() { jQuery(\'#user_info\').remove();';
832 if ($_mw_adminimize_ui_redirect == '1') {
833 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . ('/wp-admin/profile.php') . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout&amp;redirect_to=') . get_option('siteurl'), 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
834 } else {
835 $_mw_adminimize_admin_head .= 'jQuery(\'div#wpcontent\').after(\'<div id="small_user_info"><p><a href="' . get_option('siteurl') . ('/wp-admin/profile.php') . '">' . $user_identity . '</a> | <a href="' . get_option('siteurl') . wp_nonce_url( ('/wp-login.php?action=logout'), 'log-out' ) . '" title="' . __('Log Out') . '">' . __('Log Out') . '</a></p></div>\') });' . "\n";
836 }
837 $_mw_adminimize_admin_head .= '</script>' . "\n";
838 break;
839 }
840
841 // set menu
842 if ( '' != $disabled_menu_['editor'] ) {
843
844 // set admin-menu
845 foreach ($user_roles as $role) {
846 $user = wp_get_current_user();
847 if ( in_array($role, $user->roles) ) {
848 if ( current_user_can($role) ) {
849 $mw_adminimize_menu = $disabled_menu_[$role];
850 $mw_adminimize_submenu = $disabled_submenu_[$role];
851 }
852 }
853 }
854
855 // fallback on users.php on all userroles smaller admin
856 if ( is_array($mw_adminimize_menu) && in_array('users.php', $mw_adminimize_menu) )
857 $mw_adminimize_menu[] = 'profile.php';
858
859 if ( isset($menu) && !empty($menu) ) {
860 foreach ($menu as $index => $item) {
861 if ( 'index.php' === $item )
862 continue;
863
864 if ( isset($mw_adminimize_menu) && in_array($item[2], $mw_adminimize_menu) ) {
865 unset($menu[$index]);
866 }
867
868 if ( isset($submenu) && !empty($submenu[$item[2]]) ) {
869 foreach ($submenu[$item[2]] as $subindex => $subitem) {
870 if ( isset($mw_adminimize_submenu) && in_array($subitem[2], $mw_adminimize_submenu))
871 //if ('profile.php' === $subitem[2])
872 // unset($menu[70]);
873 unset($submenu[$item[2]][$subindex]);
874 }
875 }
876 }
877 }
878
879 }
880
881 echo $_mw_adminimize_admin_head;
882 }
883
884
885 /**
886 * set global options in backend in all areas
887 */
888 function _mw_adminimize_set_global_option() {
889 global $_wp_admin_css_colors;
890
891 // exclude super admin
892 if ( _mw_adminimize_exclude_super_admin() )
893 return NULL;
894
895 $user_roles = get_all_user_roles();
896
897 $_mw_adminimize_admin_head = '';
898
899 remove_action('admin_head', 'index_js');
900
901 foreach ($user_roles as $role) {
902 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
903 }
904
905 foreach ($user_roles as $role) {
906 if ( !isset($disabled_global_option_[$role]['0']) )
907 $disabled_global_option_[$role]['0'] = '';
908 }
909
910 $remove_adminbar = FALSE;
911 // new 1.7.8
912 foreach ($user_roles as $role) {
913 $user = wp_get_current_user();
914 if ( in_array($role, $user->roles) ) {
915 if ( current_user_can($role) && is_array($disabled_global_option_[$role]) ) {
916 $global_options = implode(', ', $disabled_global_option_[$role]);
917 if ( recursive_in_array('.show-admin-bar', $disabled_global_option_[$role]) )
918 $remove_adminbar = TRUE;
919 }
920 }
921 }
922 if ( 0 != strpos($global_options, '#your-profile .form-table fieldset') )
923 $_wp_admin_css_colors = 0;
924 $_mw_adminimize_admin_head .= '<!-- global options -->' . "\n";
925 $_mw_adminimize_admin_head .= '<style type="text/css">' . $global_options . ' {display: none !important;}</style>' . "\n";
926
927 if ($global_options)
928 echo $_mw_adminimize_admin_head;
929 }
930
931
932 function _mw_adminimize_remove_admin_bar() {
933
934 // exclude super admin
935 if ( _mw_adminimize_exclude_super_admin() )
936 return NULL;
937
938 $user_roles = get_all_user_roles();
939
940 foreach ($user_roles as $role) {
941 $disabled_global_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_global_option_'. $role .'_items');
942 }
943
944 foreach ($user_roles as $role) {
945 if ( !isset($disabled_global_option_[$role]['0']) )
946 $disabled_global_option_[$role]['0'] = '';
947 }
948
949 $remove_adminbar = FALSE;
950 // new 1.7.8
951 foreach ($user_roles as $role) {
952 $user = wp_get_current_user();
953 if ( in_array($role, $user->roles) ) {
954 if ( current_user_can($role) && is_array($disabled_global_option_[$role]) ) {
955 $global_options = implode(', ', $disabled_global_option_[$role]);
956 if ( recursive_in_array('.show-admin-bar', $disabled_global_option_[$role]) )
957 $remove_adminbar = TRUE;
958 }
959 }
960 }
961
962 // for deactivate admin bar
963 if ( $remove_adminbar ) {
964 add_filter( 'show_admin_bar', '__return_false' );
965 wp_deregister_script( 'admin-bar' );
966 wp_deregister_style( 'admin-bar' );
967 remove_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
968 remove_action( 'wp_head', '_admin_bar_bump_cb' );
969 }
970 }
971
972
973 /**
974 * set metabox options from database an area post
975 */
976 function _mw_adminimize_set_metabox_post_option() {
977
978 // exclude super admin
979 if ( _mw_adminimize_exclude_super_admin() )
980 return NULL;
981
982 $user_roles = get_all_user_roles();
983
984 $_mw_adminimize_admin_head = '';
985
986 remove_action('admin_head', 'index_js');
987
988 foreach ($user_roles as $role) {
989 $disabled_metaboxes_post_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_post_'. $role .'_items');
990
991 if ( !isset($disabled_metaboxes_post_[$role]['0']) )
992 $disabled_metaboxes_post_[$role]['0'] = '';
993
994 // new 1.7.8
995 foreach ($user_roles as $role) {
996 $user = wp_get_current_user();
997 if ( in_array($role, $user->roles) ) {
998 if ( current_user_can($role) && isset($disabled_metaboxes_post_[$role]) && is_array($disabled_metaboxes_post_[$role]) ) {
999 $metaboxes = implode(',', $disabled_metaboxes_post_[$role]);
1000 }
1001 }
1002 }
1003 }
1004
1005 $_mw_adminimize_admin_head .= '<style type="text/css">' . $metaboxes . ' {display: none !important;}</style>' . "\n";
1006
1007 if ($metaboxes)
1008 echo $_mw_adminimize_admin_head;
1009 }
1010
1011
1012 /**
1013 * set metabox options from database an area page
1014 */
1015 function _mw_adminimize_set_metabox_page_option() {
1016
1017 // exclude super admin
1018 if ( _mw_adminimize_exclude_super_admin() )
1019 return NULL;
1020
1021 $user_roles = get_all_user_roles();
1022
1023 $_mw_adminimize_admin_head = '';
1024
1025 remove_action('admin_head', 'index_js');
1026
1027 foreach ($user_roles as $role) {
1028 $disabled_metaboxes_page_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_metaboxes_page_'. $role .'_items');
1029
1030 if ( !isset($disabled_metaboxes_page_[$role]['0']) )
1031 $disabled_metaboxes_page_[$role]['0'] = '';
1032
1033 // new 1.7.8
1034 foreach ($user_roles as $role) {
1035 $user = wp_get_current_user();
1036 if ( in_array($role, $user->roles) ) {
1037 if ( current_user_can($role) && is_array($disabled_metaboxes_page_[$role]) ) {
1038 $metaboxes = implode(',', $disabled_metaboxes_page_[$role]);
1039 }
1040 }
1041 }
1042 }
1043
1044 $_mw_adminimize_admin_head .= '<style type="text/css">' . $metaboxes . ' {display: none !important;}</style>' . "\n";
1045
1046 if ($metaboxes)
1047 echo $_mw_adminimize_admin_head;
1048 }
1049
1050
1051 /**
1052 * set link options in area Links of Backend
1053 */
1054 function _mw_adminimize_set_link_option() {
1055
1056 // exclude super admin
1057 if ( _mw_adminimize_exclude_super_admin() )
1058 return NULL;
1059
1060 $user_roles = get_all_user_roles();
1061
1062 $_mw_adminimize_admin_head = '';
1063
1064 remove_action('admin_head', 'index_js');
1065
1066 foreach ($user_roles as $role) {
1067 $disabled_link_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_link_option_'. $role .'_items');
1068 }
1069
1070 foreach ($user_roles as $role) {
1071 if ( !isset($disabled_link_option_[$role]['0']) )
1072 $disabled_link_option_[$role]['0'] = '';
1073 }
1074
1075 // new 1.7.8
1076 foreach ($user_roles as $role) {
1077 $user = wp_get_current_user();
1078 if ( in_array($role, $user->roles) ) {
1079 if ( current_user_can($role) && is_array($disabled_link_option_[$role]) ) {
1080 $link_options = implode(',', $disabled_link_option_[$role]);
1081 }
1082 }
1083 }
1084 $_mw_adminimize_admin_head .= '<style type="text/css">' . $link_options . ' {display: none !important;}</style>' . "\n";
1085
1086 if ($link_options)
1087 echo $_mw_adminimize_admin_head;
1088 }
1089
1090 /**
1091 * remove objects on wp nav menu
1092 */
1093 function _mw_adminimize_set_nav_menu_option() {
1094
1095 // exclude super admin
1096 if ( _mw_adminimize_exclude_super_admin() )
1097 return NULL;
1098
1099 $user_roles = get_all_user_roles();
1100
1101 $_mw_adminimize_admin_head = '';
1102
1103 remove_action('admin_head', 'index_js');
1104
1105 foreach ($user_roles as $role) {
1106 $disabled_nav_menu_option_[$role] = _mw_adminimize_getOptionValue('mw_adminimize_disabled_nav_menu_option_'. $role .'_items');
1107 }
1108
1109 foreach ($user_roles as $role) {
1110 if ( !isset($disabled_nav_menu_option_[$role]['0']) )
1111 $disabled_nav_menu_option_[$role]['0'] = '';
1112 }
1113
1114 // new 1.7.8
1115 foreach ($user_roles as $role) {
1116 $user = wp_get_current_user();
1117 if ( in_array($role, $user->roles) ) {
1118 if ( current_user_can($role) && is_array($disabled_nav_menu_option_[$role]) ) {
1119 $nav_menu_options = implode(',', $disabled_nav_menu_option_[$role]);
1120 }
1121 }
1122 }
1123 //remove_meta_box($id, 'nav-menus', 'side');
1124 $_mw_adminimize_admin_head .= '<style type="text/css">' . $nav_menu_options . ' {display: none !important;}</style>' . "\n";
1125
1126 if ($nav_menu_options)
1127 echo $_mw_adminimize_admin_head;
1128 }
1129
1130
1131 /**
1132 * small user-info
1133 * @uses $post_ID
1134 */
1135 function _mw_adminimize_small_user_info() {
1136 ?>
1137 <div id="small_user_info">
1138 <p><a href="<?php echo wp_nonce_url( site_url('wp-login.php?action=logout'), 'log-out' ) ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
1139 </div>
1140 <?php
1141 }
1142
1143
1144 /**
1145 * include options-page in wp-admin
1146 */
1147 require_once('adminimize_page.php');
1148
1149
1150 /**
1151 * credit in wp-footer
1152 */
1153 function _mw_adminimize_admin_footer() {
1154
1155 $plugin_data = get_plugin_data( __FILE__ );
1156 $plugin_data['Title'] = $plugin_data['Name'];
1157
1158 if ( !empty($plugin_data['PluginURI']) && !empty($plugin_data['Name']) )
1159 $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="'.__( 'Visit plugin homepage' ).'">' . $plugin_data['Name'] . '</a>';
1160
1161 if ( basename($_SERVER['REQUEST_URI']) == 'adminimize.php') {
1162 printf('%1$s ' . __('plugin') . ' | ' . __('Version') . ' <a href="http://wordpress.org/extend/plugins/adminimize/changelog/" title="' . __('History', FB_ADMINIMIZE_TEXTDOMAIN ) . '">%2$s</a> | ' . __('Author') . ' %3$s<br />', $plugin_data['Title'], $plugin_data['Version'], $plugin_data['Author']);
1163 }
1164
1165 if ( _mw_adminimize_getOptionValue('_mw_adminimize_advice') == 1 && basename($_SERVER['REQUEST_URI']) != 'adminimize.php' ) {
1166 printf('%1$s ' . __('plugin activate', FB_ADMINIMIZE_TEXTDOMAIN ) . ' | ' . stripslashes( _mw_adminimize_getOptionValue('_mw_adminimize_advice_txt') ) . '<br />', $plugin_data['Title']);
1167 }
1168
1169 }
1170
1171
1172 /**
1173 * @version WP 2.8
1174 * Add action link(s) to plugins page
1175 *
1176 * @package Secure WordPress
1177 *
1178 * @param $links, $file
1179 * @return $links
1180 */
1181 function _mw_adminimize_filter_plugin_meta($links, $file) {
1182
1183 /* create link */
1184 if ( FB_ADMINIMIZE_BASENAME == $file ) {
1185 array_unshift(
1186 $links,
1187 sprintf( '<a href="options-general.php?page=%s">%s</a>', FB_ADMINIMIZE_BASENAME, __('Settings') )
1188 );
1189 }
1190
1191 return $links;
1192 }
1193
1194
1195 /**
1196 * Images/ Icons in base64-encoding
1197 * @use function _mw_adminimize_get_resource_url() for display
1198 */
1199 if ( isset($_GET['resource']) && !empty($_GET['resource']) ) {
1200
1201 # base64 encoding performed by base64img.php from http://php.holtsmark.no
1202 $resources = array(
1203 'adminimize.gif' =>
1204 'R0lGODlhCwALAKIEAPb29tTU1Kurq5SUlP///wAAAAAAAAAAAC'.
1205 'H5BAEAAAQALAAAAAALAAsAAAMlSErTuw1Ix4a8s4mYgxZbE4wf'.
1206 'OIzkAJqop64nWm7tULHu0+xLAgA7'.
1207 '');
1208
1209 if (array_key_exists($_GET['resource'], $resources)) {
1210
1211 $content = base64_decode($resources[ $_GET['resource'] ]);
1212
1213 $lastMod = filemtime(__FILE__);
1214 $client = ( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : FALSE );
1215 // Checking if the client is validating his cache and if it is current.
1216 if (isset($client) && (strtotime($client) == $lastMod)) {
1217 // Client's cache IS current, so we just respond '304 Not Modified'.
1218 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastMod).' GMT', TRUE, 304);
1219 exit;
1220 } else {
1221 // Image not cached or cache outdated, we respond '200 OK' and output the image.
1222 header('Last-Modified: '.gmdate('D, d M Y H:i:s', $lastMod).' GMT', TRUE, 200);
1223 header('Content-Length: '.strlen($content));
1224 header('Content-Type: image/' . substr(strrchr($_GET['resource'], '.'), 1) );
1225 echo $content;
1226 exit;
1227 }
1228 }
1229
1230 }
1231
1232
1233 /**
1234 * Display Images/ Icons in base64-encoding
1235 * @return $resourceID
1236 */
1237 function _mw_adminimize_get_resource_url($resourceID) {
1238
1239 return trailingslashit( get_bloginfo('url') ) . '?resource=' . $resourceID;
1240 }
1241
1242
1243 /**
1244 * content of help
1245 *
1246 * @package Secure WordPress
1247 */
1248 function _mw_adminimize_contextual_help() {
1249
1250 $content = __('<a href="http://wordpress.org/extend/plugins/adminimize/">Documentation</a>', FB_ADMINIMIZE_TEXTDOMAIN );
1251
1252 return $content;
1253 }
1254
1255
1256 /**
1257 * settings in plugin-admin-page
1258 */
1259 function _mw_adminimize_add_settings_page() {
1260 global $wp_version;
1261
1262 if ( current_user_can('switch_themes') && function_exists('add_submenu_page') ) {
1263
1264 $menutitle = '';
1265 if ( version_compare( $wp_version, '2.7alpha', '>' ) ) {
1266 $menutitle = '<img src="' . _mw_adminimize_get_resource_url('adminimize.gif') . '" alt="" />';
1267 }
1268 $menutitle .= ' ' . __('Adminimize', FB_ADMINIMIZE_TEXTDOMAIN );
1269
1270 $pagehook = add_submenu_page('options-general.php', __('Adminimize Options', FB_ADMINIMIZE_TEXTDOMAIN ), $menutitle, 'unfiltered_html', __FILE__, '_mw_adminimize_options');
1271 add_action( 'load-' . $pagehook, '_mw_adminimize_on_load_page' );
1272 add_filter( 'plugin_action_links', '_mw_adminimize_filter_plugin_meta', 10, 2 );
1273 }
1274
1275 }
1276
1277
1278 function _mw_adminimize_on_load_page() {
1279
1280 add_filter( 'contextual_help', '_mw_adminimize_contextual_help' );
1281
1282 wp_enqueue_style( 'adminimize-style' );
1283 }
1284
1285
1286 /**
1287 * Set theme for users
1288 */
1289 function _mw_adminimize_set_theme() {
1290
1291 if ( !current_user_can('edit_users') )
1292 wp_die(__('Cheatin&#8217; uh?'));
1293
1294 $user_ids = $_POST[mw_adminimize_theme_items];
1295 $admin_color = htmlspecialchars( stripslashes( $_POST[_mw_adminimize_set_theme] ) );
1296
1297 if ( !$user_ids )
1298 return FALSE;
1299
1300 foreach( $user_ids as $user_id) {
1301 update_usermeta($user_id, 'admin_color', $admin_color);
1302 }
1303
1304 }
1305
1306
1307 /**
1308 * read otpions
1309 */
1310 function _mw_adminimize_getOptionValue($key) {
1311
1312 $adminimizeoptions = get_option('mw_adminimize');
1313
1314 if ( isset($adminimizeoptions[$key]) )
1315 return ($adminimizeoptions[$key]);
1316 }
1317
1318
1319 /**
1320 * Update options in database
1321 */
1322 function _mw_adminimize_update() {
1323 global $menu, $submenu, $adminimizeoptions;
1324
1325 $user_roles = get_all_user_roles();
1326
1327 if (isset($_POST['_mw_adminimize_user_info'])) {
1328 $adminimizeoptions['_mw_adminimize_user_info'] = strip_tags(stripslashes($_POST['_mw_adminimize_user_info']));
1329 } else {
1330 $adminimizeoptions['_mw_adminimize_user_info'] = 0;
1331 }
1332
1333 if (isset($_POST['_mw_adminimize_dashmenu'])) {
1334 $adminimizeoptions['_mw_adminimize_dashmenu'] = strip_tags(stripslashes($_POST['_mw_adminimize_dashmenu']));
1335 } else {
1336 $adminimizeoptions['_mw_adminimize_dashmenu'] = 0;
1337 }
1338
1339 if (isset($_POST['_mw_adminimize_footer'])) {
1340 $adminimizeoptions['_mw_adminimize_footer'] = strip_tags(stripslashes($_POST['_mw_adminimize_footer']));
1341 } else {
1342 $adminimizeoptions['_mw_adminimize_footer'] = 0;
1343 }
1344
1345 if (isset($_POST['_mw_adminimize_header'])) {
1346 $adminimizeoptions['_mw_adminimize_header'] = strip_tags(stripslashes($_POST['_mw_adminimize_header']));
1347 } else {
1348 $adminimizeoptions['_mw_adminimize_header'] = 0;
1349 }
1350
1351 if (isset($_POST['_mw_adminimize_exclude_super_admin'])) {
1352 $adminimizeoptions['_mw_adminimize_exclude_super_admin'] = strip_tags(stripslashes($_POST['_mw_adminimize_exclude_super_admin']));
1353 } else {
1354 $adminimizeoptions['_mw_adminimize_exclude_super_admin'] = 0;
1355 }
1356
1357 if (isset($_POST['_mw_adminimize_writescroll'])) {
1358 $adminimizeoptions['_mw_adminimize_writescroll'] = strip_tags(stripslashes($_POST['_mw_adminimize_writescroll']));
1359 } else {
1360 $adminimizeoptions['_mw_adminimize_writescroll'] = 0;
1361 }
1362
1363 if (isset($_POST['_mw_adminimize_tb_window'])) {
1364 $adminimizeoptions['_mw_adminimize_tb_window'] = strip_tags(stripslashes($_POST['_mw_adminimize_tb_window']));
1365 } else {
1366 $adminimizeoptions['_mw_adminimize_tb_window'] = 0;
1367 }
1368
1369 if (isset($_POST['_mw_adminimize_cat_full'])) {
1370 $adminimizeoptions['_mw_adminimize_cat_full'] = strip_tags(stripslashes($_POST['_mw_adminimize_cat_full']));
1371 } else {
1372 $adminimizeoptions['_mw_adminimize_cat_full'] = 0;
1373 }
1374
1375 if (isset($_POST['_mw_adminimize_db_redirect'])) {
1376 $adminimizeoptions['_mw_adminimize_db_redirect'] = strip_tags(stripslashes($_POST['_mw_adminimize_db_redirect']));
1377 } else {
1378 $adminimizeoptions['_mw_adminimize_db_redirect'] = 0;
1379 }
1380
1381 if (isset($_POST['_mw_adminimize_ui_redirect'])) {
1382 $adminimizeoptions['_mw_adminimize_ui_redirect'] = strip_tags(stripslashes($_POST['_mw_adminimize_ui_redirect']));
1383 } else {
1384 $adminimizeoptions['_mw_adminimize_ui_redirect'] = 0;
1385 }
1386
1387 if (isset($_POST['_mw_adminimize_advice'])) {
1388 $adminimizeoptions['_mw_adminimize_advice'] = strip_tags(stripslashes($_POST['_mw_adminimize_advice']));
1389 } else {
1390 $adminimizeoptions['_mw_adminimize_advice'] = 0;
1391 }
1392
1393 if (isset($_POST['_mw_adminimize_advice_txt'])) {
1394 $adminimizeoptions['_mw_adminimize_advice_txt'] = stripslashes($_POST['_mw_adminimize_advice_txt']);
1395 } else {
1396 $adminimizeoptions['_mw_adminimize_advice_txt'] = 0;
1397 }
1398
1399 if (isset($_POST['_mw_adminimize_timestamp'])) {
1400 $adminimizeoptions['_mw_adminimize_timestamp'] = strip_tags(stripslashes($_POST['_mw_adminimize_timestamp']));
1401 } else {
1402 $adminimizeoptions['_mw_adminimize_timestamp'] = 0;
1403 }
1404
1405 if (isset($_POST['_mw_adminimize_control_flashloader'])) {
1406 $adminimizeoptions['_mw_adminimize_control_flashloader'] = strip_tags(stripslashes($_POST['_mw_adminimize_control_flashloader']));
1407 } else {
1408 $adminimizeoptions['_mw_adminimize_control_flashloader'] = 0;
1409 }
1410
1411 if (isset($_POST['_mw_adminimize_db_redirect_txt'])) {
1412 $adminimizeoptions['_mw_adminimize_db_redirect_txt'] = stripslashes($_POST['_mw_adminimize_db_redirect_txt']);
1413 } else {
1414 $adminimizeoptions['_mw_adminimize_db_redirect_txt'] = 0;
1415 }
1416
1417 // menu update
1418 foreach ($user_roles as $role) {
1419 if (isset($_POST['mw_adminimize_disabled_menu_'. $role .'_items'])) {
1420 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = $_POST['mw_adminimize_disabled_menu_'. $role .'_items'];
1421 } else {
1422 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = array();
1423 }
1424
1425 if (isset($_POST['mw_adminimize_disabled_submenu_'. $role .'_items'])) {
1426 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = $_POST['mw_adminimize_disabled_submenu_'. $role .'_items'];
1427 } else {
1428 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = array();
1429 }
1430 }
1431
1432 // global_options, metaboxes update
1433 foreach ($user_roles as $role) {
1434 if (isset($_POST['mw_adminimize_disabled_global_option_'. $role . '_items'])) {
1435 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_global_option_'. $role . '_items'];
1436 } else {
1437 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role . '_items'] = array();
1438 }
1439
1440 if (isset($_POST['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'])) {
1441 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'] = $_POST['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'];
1442 } else {
1443 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role . '_items'] = array();
1444 }
1445
1446 if (isset($_POST['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'])) {
1447 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'] = $_POST['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'];
1448 } else {
1449 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role . '_items'] = array();
1450 }
1451
1452 if (isset($_POST['mw_adminimize_disabled_link_option_'. $role . '_items'])) {
1453 $adminimizeoptions['mw_adminimize_disabled_link_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_link_option_'. $role . '_items'];
1454 } else {
1455 $adminimizeoptions['mw_adminimize_disabled_link_option_'. $role . '_items'] = array();
1456 }
1457
1458 // wp nav menu options
1459 if (isset($_POST['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'])) {
1460 $adminimizeoptions['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'] = $_POST['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'];
1461 } else {
1462 $adminimizeoptions['mw_adminimize_disabled_nav_menu_option_'. $role . '_items'] = array();
1463 }
1464 }
1465
1466 // own options
1467 if (isset($_POST['_mw_adminimize_own_values'])) {
1468 $adminimizeoptions['_mw_adminimize_own_values'] = stripslashes($_POST['_mw_adminimize_own_values']);
1469 } else {
1470 $adminimizeoptions['_mw_adminimize_own_values'] = 0;
1471 }
1472
1473 if (isset($_POST['_mw_adminimize_own_options'])) {
1474 $adminimizeoptions['_mw_adminimize_own_options'] = stripslashes($_POST['_mw_adminimize_own_options']);
1475 } else {
1476 $adminimizeoptions['_mw_adminimize_own_options'] = 0;
1477 }
1478
1479 // own post options
1480 if (isset($_POST['_mw_adminimize_own_post_values'])) {
1481 $adminimizeoptions['_mw_adminimize_own_post_values'] = stripslashes($_POST['_mw_adminimize_own_post_values']);
1482 } else {
1483 $adminimizeoptions['_mw_adminimize_own_post_values'] = 0;
1484 }
1485
1486 if (isset($_POST['_mw_adminimize_own_post_options'])) {
1487 $adminimizeoptions['_mw_adminimize_own_post_options'] = stripslashes($_POST['_mw_adminimize_own_post_options']);
1488 } else {
1489 $adminimizeoptions['_mw_adminimize_own_post_options'] = 0;
1490 }
1491
1492 // own page options
1493 if (isset($_POST['_mw_adminimize_own_page_values'])) {
1494 $adminimizeoptions['_mw_adminimize_own_page_values'] = stripslashes($_POST['_mw_adminimize_own_page_values']);
1495 } else {
1496 $adminimizeoptions['_mw_adminimize_own_page_values'] = 0;
1497 }
1498
1499 if (isset($_POST['_mw_adminimize_own_page_options'])) {
1500 $adminimizeoptions['_mw_adminimize_own_page_options'] = stripslashes($_POST['_mw_adminimize_own_page_options']);
1501 } else {
1502 $adminimizeoptions['_mw_adminimize_own_page_options'] = 0;
1503 }
1504
1505 // own link options
1506 if (isset($_POST['_mw_adminimize_own_link_values'])) {
1507 $adminimizeoptions['_mw_adminimize_own_link_values'] = stripslashes($_POST['_mw_adminimize_own_link_values']);
1508 } else {
1509 $adminimizeoptions['_mw_adminimize_own_link_values'] = 0;
1510 }
1511
1512 if (isset($_POST['_mw_adminimize_own_link_options'])) {
1513 $adminimizeoptions['_mw_adminimize_own_link_options'] = stripslashes($_POST['_mw_adminimize_own_link_options']);
1514 } else {
1515 $adminimizeoptions['_mw_adminimize_own_link_options'] = 0;
1516 }
1517
1518 // wp nav menu options
1519 if (isset($_POST['_mw_adminimize_own_nav_menu_values'])) {
1520 $adminimizeoptions['_mw_adminimize_own_nav_menu_values'] = stripslashes($_POST['_mw_adminimize_own_nav_menu_values']);
1521 } else {
1522 $adminimizeoptions['_mw_adminimize_own_nav_menu_values'] = 0;
1523 }
1524
1525 if (isset($_POST['_mw_adminimize_own_nav_menu_options'])) {
1526 $adminimizeoptions['_mw_adminimize_own_nav_menu_options'] = stripslashes($_POST['_mw_adminimize_own_nav_menu_options']);
1527 } else {
1528 $adminimizeoptions['_mw_adminimize_own_nav_menu_options'] = 0;
1529 }
1530
1531 // update
1532 update_option('mw_adminimize', $adminimizeoptions);
1533 $adminimizeoptions = get_option('mw_adminimize');
1534
1535 $myErrors = new _mw_adminimize_message_class();
1536 $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_update') . '</p></div>';
1537 echo $myErrors;
1538 }
1539
1540
1541 /**
1542 * Delete options in database
1543 */
1544 function _mw_adminimize_deinstall() {
1545
1546 delete_option('mw_adminimize');
1547 }
1548
1549
1550 /**
1551 * Install options in database
1552 */
1553 function _mw_adminimize_install() {
1554 global $menu, $submenu;
1555
1556 $user_roles = get_all_user_roles();
1557 $adminimizeoptions = array();
1558
1559 foreach ($user_roles as $role) {
1560 $adminimizeoptions['mw_adminimize_disabled_menu_'. $role .'_items'] = array();
1561 $adminimizeoptions['mw_adminimize_disabled_submenu_'. $role .'_items'] = array();
1562 $adminimizeoptions['mw_adminimize_disabled_global_option_'. $role .'_items'] = array();
1563 $adminimizeoptions['mw_adminimize_disabled_metaboxes_post_'. $role .'_items'] = array();
1564 $adminimizeoptions['mw_adminimize_disabled_metaboxes_page_'. $role .'_items'] = array();
1565 }
1566
1567 $adminimizeoptions['mw_adminimize_default_menu'] = $menu;
1568 $adminimizeoptions['mw_adminimize_default_submenu'] = $submenu;
1569
1570 add_option('mw_adminimize', $adminimizeoptions);
1571 }
1572
1573 /**
1574 * export options in file
1575 */
1576 function _mw_adminimize_export() {
1577 global $wpdb;
1578
1579 $filename = 'adminimize_export-' . date('Y-m-d_G-i-s') . '.seq';
1580
1581 header("Content-Description: File Transfer");
1582 header("Content-Disposition: attachment; filename=" . urlencode($filename));
1583 header("Content-Type: application/force-download");
1584 header("Content-Type: application/octet-stream");
1585 header("Content-Type: application/download");
1586 header('Content-Type: text/seq; charset=' . get_option('blog_charset'), TRUE);
1587 flush();
1588
1589 $export_data = mysql_query("SELECT option_value FROM $wpdb->options WHERE option_name = 'mw_adminimize'");
1590 $export_data = mysql_result($export_data, 0);
1591 echo $export_data;
1592 flush();
1593 }
1594
1595 /**
1596 * import options in table _options
1597 */
1598 function _mw_adminimize_import() {
1599
1600 // check file extension
1601 $str_file_name = $_FILES['datei']['name'];
1602 $str_file_ext = explode(".", $str_file_name);
1603
1604 if ($str_file_ext[1] != 'seq') {
1605 $addreferer = 'notexist';
1606 } elseif (file_exists($_FILES['datei']['name'])) {
1607 $addreferer = 'exist';
1608 } else {
1609 // path for file
1610 $str_ziel = WP_CONTENT_DIR . '/' . $_FILES['datei']['name'];
1611 // transfer
1612 move_uploaded_file($_FILES['datei']['tmp_name'], $str_ziel);
1613 // access authorisation
1614 chmod($str_ziel, 0644);
1615 // SQL import
1616 ini_set('default_socket_timeout', 120);
1617 $import_file = file_get_contents($str_ziel);
1618
1619 _mw_adminimize_deinstall();
1620 $import_file = unserialize($import_file);
1621
1622 if ( file_exists($str_ziel) )
1623 unlink($str_ziel);
1624 update_option('mw_adminimize', $import_file);
1625 if ( file_exists($str_ziel) )
1626 unlink($str_ziel);
1627
1628 $addreferer = 'true';
1629 }
1630
1631 $myErrors = new _mw_adminimize_message_class();
1632 $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error('_mw_adminimize_import') . '</p></div>';
1633 echo $myErrors;
1634 }
1635
1636 ?>
1637