web/wp-content/plugins/exec-php/includes/config_ui.php
author hurons@caf4f556-3d62-0410-8435-a86758001935
Mon, 01 Feb 2010 09:51:57 +0000
branchwordpress
changeset 123 561aa6d282f6
permissions -rw-r--r--
pre production version : ****************************** Template evolution : - css ( so much things) - js ( new navigation tools ...) - lib for php ZIp - function.php (for download LDT and other litle function) - page (header, home, footer, single, search, searchform, post ...) ****************************** New plug in : - wp touch - wp explorer - TextCutter - ultimate-google-analytics - nice titles ****************************** Plug in customization : - related-posts-by-category - posts-of-current-category - order-categories - event-calendar - translation wp explorer - exec-php ****************************** Road map for next version : - cleaning php code put template function to new plugin - cleaning Css code - re organize Js code - all new correction ask
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
123
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     1
<?php
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     2
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     3
require_once(dirname(__FILE__).'/cache.php');
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     4
require_once(dirname(__FILE__).'/const.php');
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     5
require_once(dirname(__FILE__).'/l10n.php');
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     6
require_once(dirname(__FILE__).'/script.php');
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     7
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     8
// -----------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
     9
// the ExecPhp_ConfigUi class displays the config interface in the
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    10
// admin menu
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    11
// -----------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    12
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    13
// use this guard to avoid error messages in WP admin panel if plugin
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    14
// is disabled because of a version conflict but you still try to reload
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    15
// the plugins config interface
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    16
if (!class_exists('ExecPhp_ConfigUi')) :
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    17
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    18
define('ExecPhp_ACTION_UPDATE_OPTIONS', 'execphp_update_options');
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    19
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    20
class ExecPhp_ConfigUi
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    21
{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    22
	var $m_cache = NULL;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    23
	var $m_script = NULL;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    24
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    25
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    26
	// init
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    27
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    28
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    29
	// Sets up the Exec-Php config menu
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    30
	function ExecPhp_ConfigUi(&$cache, &$script)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    31
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    32
		$this->m_cache =& $cache;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    33
		$this->m_script =& $script;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    34
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    35
		$option =& $this->m_cache->get_option();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    36
		$this->toggle_action($option->get_status());
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    37
		add_action('admin_menu', array(&$this, 'action_admin_menu'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    38
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    39
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    40
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    41
	// hooks
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    42
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    43
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    44
	function action_admin_menu()
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    45
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    46
		if (current_user_can(ExecPhp_CAPABILITY_EDIT_PLUGINS))
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    47
		{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    48
			add_submenu_page('options-general.php',
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    49
				__s('Exec-PHP Settings', ExecPhp_PLUGIN_ID),
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    50
				__s('Exec-PHP', ExecPhp_PLUGIN_ID),
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    51
				ExecPhp_CAPABILITY_EDIT_PLUGINS, __FILE__,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    52
				array(&$this, 'submenu_page_option_general'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    53
			add_filter('plugin_action_links', array(&$this, 'filter_plugin_actions_links'), 10, 2);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    54
		}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    55
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    56
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    57
	function filter_plugin_actions_links($links, $file)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    58
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    59
		if ($file == ExecPhp_HOMEDIR. '/exec-php.php')
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    60
		{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    61
			$settings_link = $settings_link = '<a href="options-general.php?page='. ExecPhp_HOMEDIR. '/includes/config_ui.php">' . __('Settings') . '</a>';
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    62
			array_unshift($links, $settings_link);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    63
		}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    64
		return $links;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    65
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    66
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    67
	function action_admin_footer_plugin_version()
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    68
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    69
		$option =& $this->m_cache->get_option();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    70
		$heading = __s('Exec-PHP Error.', ExecPhp_PLUGIN_ID);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    71
		$text = __s('No necessary upgrade of the the Exec-PHP plugin could be performed. PHP code in your articles or widgets may be viewable to your blog readers. This is plugin version %1$s, previously there was version %2$s installed. Downgrading from a newer version to an older version of the plugin is not supported.', ExecPhp_PLUGIN_ID
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    72
			, ExecPhp_VERSION, $option->get_version());
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    73
		$this->m_script->print_message($heading, $text);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    74
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    75
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    76
	function action_admin_footer_unknown()
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    77
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    78
		$option =& $this->m_cache->get_option();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    79
		$heading = __s('Exec-PHP Error.', ExecPhp_PLUGIN_ID);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    80
		$text = __s('An unknown error (%s) occured during execution of the Exec-PHP plugin. PHP code in your articles or widgets may be viewable to your blog readers. This error should never happen if you use the plugin with a compatible WordPress version and installed it as described in the documentation.', ExecPhp_PLUGIN_ID
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    81
			, $option->get_status());
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    82
		$this->m_script->print_message($heading, $text);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    83
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    84
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    85
	function toggle_action($status)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    86
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    87
		if ($status == ExecPhp_STATUS_PLUGIN_VERSION_MISMATCH)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    88
			add_action('admin_footer', array(&$this, 'action_admin_footer_plugin_version'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    89
		else
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    90
			remove_action('admin_footer', array(&$this, 'action_admin_footer_plugin_version'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    91
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    92
		if ($status != ExecPhp_STATUS_OKAY
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    93
			&& $status != ExecPhp_STATUS_PLUGIN_VERSION_MISMATCH)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    94
			add_action('admin_footer', array(&$this, 'action_admin_footer_unknown'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    95
		else
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    96
			remove_action('admin_footer', array(&$this, 'action_admin_footer_unknown'));
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    97
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    98
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
    99
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   100
	// interface
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   101
	// ---------------------------------------------------------------------------
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   102
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   103
	function print_request_users($display_id, $feature, $title, $introduction)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   104
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   105
		global $wp_version;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   106
		if (version_compare($wp_version, '2.6.dev') >= 0)
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   107
			// since WP 2.6 it comes with its own progress animation
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   108
			$image_url = get_option('siteurl'). '/wp-admin/images/loading.gif';
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   109
		else
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   110
			$image_url = ExecPhp_HOME_URL. '/images/progress.gif';
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   111
?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   112
			<fieldset class="options">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   113
				<table class="editform optiontable form-table">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   114
					<tr valign="top" id="<?php echo $display_id; ?>-container" >
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   115
						<th scope="row"><?php echo $title; ?></th>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   116
						<td>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   117
							<label for="<?php echo ExecPhp_POST_WIDGET_SUPPORT; ?>">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   118
								<?php echo $introduction; ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   119
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   120
								<div class="execphp-user-list" id="<?php echo $display_id; ?>">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   121
									<?php _es('The list can not be displayed because you may have disabled Javascript or your browser does not support Javascript.', ExecPhp_PLUGIN_ID); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   122
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   123
								</div>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   124
								<script type="text/javascript">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   125
									//<![CDATA[
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   126
									document.getElementById("<?php echo $display_id; ?>").innerHTML =
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   127
										"<p><img src=\"<?php echo $image_url; ?>\" alt=\"<?php escape_dquote(_es('An animated icon signaling that this information is still be loaded.', ExecPhp_PLUGIN_ID)); ?>\" /> <?php escape_dquote(_es('Loading user information...', ExecPhp_PLUGIN_ID)); ?></p>";
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   128
									ExecPhp_subscribeForFeature("<?php echo $feature; ?>");
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   129
									//]]>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   130
								</script>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   131
							</label>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   132
						</td>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   133
					</tr>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   134
				</table>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   135
			</fieldset>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   136
<?php
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   137
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   138
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   139
	function submenu_page_option_general()
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   140
	{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   141
		global $wpdb;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   142
		global $wp_version;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   143
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   144
		// executing form actions
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   145
		$option =& $this->m_cache->get_option();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   146
		if (isset($_POST[ExecPhp_ACTION_UPDATE_OPTIONS]))
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   147
		{
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   148
			check_admin_referer(ExecPhp_ACTION_UPDATE_OPTIONS);
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   149
			$option->set_from_POST();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   150
			$option->save();
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   151
			echo '<div id="message" class="updated fade"><p><strong>'.
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   152
				__s('Settings saved.', ExecPhp_PLUGIN_ID) . "</strong></p></div>\n";
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   153
		}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   154
		$this->toggle_action($option->get_status());
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   155
?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   156
	<div class="wrap">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   157
<?php if (version_compare($wp_version, '2.7.dev') >= 0) : ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   158
		<div id="icon-options-general" class="icon32"><br /></div>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   159
<?php endif; ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   160
		<h2><?php _es('Exec-PHP Plugin', ExecPhp_PLUGIN_ID); ?></h2>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   161
		<p><?php echo __s('Exec-PHP executes <code>&lt;?php ?&gt;</code> code in your posts, pages and text widgets. See the <a href="%s">local documentation</a> for further information. The latest version of the plugin, documentation and information can be found on the <a href="http://bluesome.net/post/2005/08/18/50/">official plugin homepage</a>.', ExecPhp_PLUGIN_ID, ExecPhp_HOME_URL. '/docs/'. __s('readme.html', ExecPhp_PLUGIN_ID)); ?></p>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   162
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   163
<?php if (version_compare($wp_version, '2.2.dev') >= 0) : ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   164
		<h3><?php _es('Settings', ExecPhp_PLUGIN_ID); ?></h3>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   165
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   166
		<form action="" method="post" id="<?php echo ExecPhp_ID_CONFIG_FORM; ?>"<?php if (version_compare($wp_version, '2.5.dev') >= 0 && version_compare($wp_version, '2.6.dev') < 0) : ?> class="wp-2-5"<?php endif; ?>>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   167
			<?php wp_nonce_field(ExecPhp_ACTION_UPDATE_OPTIONS); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   168
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   169
			<fieldset class="options">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   170
				<table class="editform optiontable form-table">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   171
					<tr valign="top">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   172
						<th scope="row"><?php _es('Execute PHP code in text widgets', ExecPhp_PLUGIN_ID); ?></th>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   173
						<td>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   174
							<label for="<?php echo ExecPhp_POST_WIDGET_SUPPORT; ?>">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   175
								<input type="checkbox" name="<?php echo ExecPhp_POST_WIDGET_SUPPORT; ?>" id="<?php echo ExecPhp_POST_WIDGET_SUPPORT; ?>" value="true" <?php if ($option->get_widget_support()) : ?>checked="checked" <?php endif; ?>/>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   176
								<?php _es('Executing PHP code in text widgets is not restricted to any user. By default users who can modify text widgets will also be able to execute PHP code in text widgets. Unselect this option to generally turn off execution of PHP code in text widgets.', ExecPhp_PLUGIN_ID); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   177
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   178
							</label>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   179
						</td>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   180
					</tr>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   181
				</table>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   182
			</fieldset>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   183
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   184
			<p class="submit">
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   185
				<input type="submit" name="<?php echo ExecPhp_ACTION_UPDATE_OPTIONS; ?>" class="button-primary" value="<?php _es('Save Changes', ExecPhp_PLUGIN_ID) ?>" />
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   186
			</p>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   187
		</form>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   188
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   189
<?php endif; ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   190
		<h3><?php _es('Security Information', ExecPhp_PLUGIN_ID); ?></h3>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   191
		<p><?php _es('The following lists show which users are allowed to write or execute PHP code in different cases. Allowing to write or execute PHP code can be adjusted by assigning the necessary capabilities to individual users or roles by using a role manager plugin.', ExecPhp_PLUGIN_ID); ?></p>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   192
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   193
		<form action="" id="<?php echo ExecPhp_ID_INFO_FORM; ?>"<?php if (version_compare($wp_version, '2.5.dev') >= 0 && version_compare($wp_version, '2.6.dev') < 0) : ?> class="wp-2-5"<?php endif; ?>>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   194
<?php $this->print_request_users(ExecPhp_ID_INFO_SECURITY_HOLE,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   195
	ExecPhp_REQUEST_FEATURE_SECURITY_HOLE,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   196
	__s('Security Hole', ExecPhp_PLUGIN_ID),
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   197
	__s('The following list shows which users have either or both of the &quot;%1$s&quot; or &quot;%2$s&quot; capability and are allowed to change others PHP code by having the &quot;%3$s&quot; capability but do not have the &quot;%4$s&quot; capability for themself. This is a security hole, because the listed users can write and execute PHP code in articles of other users although they are not supposed to execute PHP code at all.', ExecPhp_PLUGIN_ID, ExecPhp_CAPABILITY_EDIT_OTHERS_POSTS, ExecPhp_CAPABILITY_EDIT_OTHERS_PAGES, ExecPhp_CAPABILITY_EDIT_OTHERS_PHP, ExecPhp_CAPABILITY_EXECUTE_ARTICLES)); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   198
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   199
<?php if (version_compare($wp_version, '2.2.dev') >= 0) : ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   200
<?php $this->print_request_users(ExecPhp_ID_INFO_WIDGETS,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   201
	ExecPhp_REQUEST_FEATURE_WIDGETS,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   202
	__s('Executing PHP Code in Text Widgets', ExecPhp_PLUGIN_ID),
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   203
	__s('The following list shows which users have the &quot;%s&quot; capability and therefore are allowed to write and execute PHP code in text widgets. In case you have deselected the option &quot;Execute PHP code in text widgets&quot; from above, this list will appear empty.', ExecPhp_PLUGIN_ID, ExecPhp_CAPABILITY_EXECUTE_WIDGETS)); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   204
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   205
<?php endif; ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   206
<?php $this->print_request_users(ExecPhp_ID_INFO_EXECUTE_ARTICLES,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   207
	ExecPhp_REQUEST_FEATURE_EXECUTE_ARTICLES,
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   208
	__s('Executing PHP Code in Articles', ExecPhp_PLUGIN_ID),
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   209
	__s('The following list shows which users have the &quot;%s&quot; capability and therefore are allowed to execute PHP code in articles.', ExecPhp_PLUGIN_ID, ExecPhp_CAPABILITY_EXECUTE_ARTICLES)); ?>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   210
		</form>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   211
	</div>
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   212
<?php
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   213
	}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   214
}
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   215
endif;
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   216
561aa6d282f6 pre production version :
hurons@caf4f556-3d62-0410-8435-a86758001935
parents:
diff changeset
   217
?>