web/wp-content/plugins/exec-php/includes/admin.php
changeset 136 bde1974c263b
equal deleted inserted replaced
135:53cff4b4a802 136:bde1974c263b
       
     1 <?php
       
     2 
       
     3 require_once(dirname(__FILE__).'/cache.php');
       
     4 require_once(dirname(__FILE__).'/const.php');
       
     5 require_once(dirname(__FILE__).'/config_ui.php');
       
     6 require_once(dirname(__FILE__).'/l10n.php');
       
     7 require_once(dirname(__FILE__).'/script.php');
       
     8 require_once(dirname(__FILE__).'/style.php');
       
     9 require_once(dirname(__FILE__).'/user_ui.php');
       
    10 require_once(dirname(__FILE__).'/write_ui.php');
       
    11 
       
    12 // -----------------------------------------------------------------------------
       
    13 // the ExecPhp_Admin class provides functionality common to all displayed
       
    14 // admin menus
       
    15 // -----------------------------------------------------------------------------
       
    16 
       
    17 // use this guard to avoid error messages in WP admin panel if plugin
       
    18 // is disabled because of a version conflict but you still try to reload
       
    19 // the plugins config interface
       
    20 if (!class_exists('ExecPhp_Admin')) :
       
    21 class ExecPhp_Admin
       
    22 {
       
    23 	var $m_cache = NULL;
       
    24 	var $m_common_script = NULL;
       
    25 	var $m_common_l10n = NULL;
       
    26 	var $m_style = NULL;
       
    27 	var $m_write_ui = NULL;
       
    28 	var $m_user_ui = NULL;
       
    29 	var $m_admin_script = NULL;
       
    30 	var $m_admin_l10n = NULL;
       
    31 	var $m_config_ui = NULL;
       
    32 
       
    33 	// ---------------------------------------------------------------------------
       
    34 	// init
       
    35 	// ---------------------------------------------------------------------------
       
    36 
       
    37 	function ExecPhp_Admin(&$cache)
       
    38 	{
       
    39 
       
    40 		$this->m_cache =& $cache;
       
    41 
       
    42 		if (!is_admin())
       
    43 			return;
       
    44 
       
    45 		global $wp_version;
       
    46 		if (version_compare($wp_version, '2.6.dev') >= 0)
       
    47 			load_plugin_textdomain(ExecPhp_PLUGIN_ID, false, ExecPhp_HOMEDIR. '/languages');
       
    48 		else
       
    49 			load_plugin_textdomain(ExecPhp_PLUGIN_ID, ExecPhp_PLUGINDIR. '/'. ExecPhp_HOMEDIR. '/languages');
       
    50 
       
    51 		$this->m_common_l10n = array(
       
    52 			'messageContainer' => ExecPhp_ID_MESSAGE);
       
    53 		$this->m_common_script =& new ExecPhp_Script(ExecPhp_ID_SCRIPT_COMMON,
       
    54 			ExecPhp_ID_L10N_COMMON, $this->m_common_l10n, '/js/common.js', array());
       
    55 
       
    56 		$this->m_write_ui =& new ExecPhp_WriteUi($this->m_cache, $this->m_common_script);
       
    57 		$this->m_user_ui =& new ExecPhp_UserUi($this->m_cache);
       
    58 		add_action('admin_notices', array(&$this, 'action_admin_notices'), 5);
       
    59 
       
    60 		if (version_compare($wp_version, '2.1.dev') < 0)
       
    61 			return;
       
    62 
       
    63 		$this->m_style =& new ExecPhp_Style();
       
    64 		$this->m_config_ui =& new ExecPhp_ConfigUi($this->m_cache, $this->m_common_script);
       
    65 
       
    66 		if (current_user_can(ExecPhp_CAPABILITY_EDIT_PLUGINS)
       
    67 			|| current_user_can(ExecPhp_CAPABILITY_EDIT_USERS))
       
    68 		{
       
    69 			$this->m_admin_l10n = array(
       
    70 				'noUserFound' => escape_dquote(__s('No user matching the query.', ExecPhp_PLUGIN_ID)),
       
    71 				'securityAlertHeading' => escape_dquote(__s('Exec-PHP Security Alert.', ExecPhp_PLUGIN_ID)),
       
    72 				'securityAlertText' => escape_dquote(__s('The Exec-PHP plugin found a security hole with the configured user rights of this blog. For further information consult the plugin configuration menu or contact your blog administrator.', ExecPhp_PLUGIN_ID)),
       
    73 				'requestFile' => get_option('siteurl'). '/wp-admin/admin-ajax.php',
       
    74 				'ajaxError' => escape_dquote(__s("Exec-PHP AJAX HTTP error when receiving data: ", ExecPhp_PLUGIN_ID)),
       
    75 				'action' => ExecPhp_ACTION_REQUEST_USERS,
       
    76 				'executeArticlesContainer' => ExecPhp_ID_INFO_EXECUTE_ARTICLES,
       
    77 				'widgetsContainer' => ExecPhp_ID_INFO_WIDGETS,
       
    78 				'securityHoleContainer' => ExecPhp_ID_INFO_SECURITY_HOLE);
       
    79 			$this->m_admin_script =& new ExecPhp_Script(ExecPhp_ID_SCRIPT_ADMIN,
       
    80 				ExecPhp_ID_L10N_ADMIN, $this->m_admin_l10n, '/js/admin.js', array('sack'));
       
    81 
       
    82 			add_action('admin_footer', array(&$this, 'action_admin_footer'));
       
    83 		}
       
    84 	}
       
    85 
       
    86 	// ---------------------------------------------------------------------------
       
    87 	// hooks
       
    88 	// ---------------------------------------------------------------------------
       
    89 
       
    90 	function action_admin_notices()
       
    91 	{
       
    92 ?>
       
    93 <div id="<?php echo ExecPhp_ID_MESSAGE; ?>"></div>
       
    94 <?php
       
    95 	}
       
    96 
       
    97 	function action_admin_footer()
       
    98 	{
       
    99 ?>
       
   100 	<script type="text/javascript">
       
   101 		//<![CDATA[
       
   102 		ExecPhp_subscribeForFeature("<?php echo ExecPhp_REQUEST_FEATURE_SECURITY_HOLE; ?>");
       
   103 		ExecPhp_requestUser();
       
   104 		//]]>
       
   105 	</script>
       
   106 <?php
       
   107 	}
       
   108 }
       
   109 endif;
       
   110 
       
   111 ?>