Ticket #42323: 42323.patch
File 42323.patch, 3.6 KB (added by , 7 years ago) |
---|
-
wp-admin/includes/plugin.php
1721 1721 global $pagenow, $menu, $submenu, $_wp_menu_nopriv, $_wp_submenu_nopriv, 1722 1722 $plugin_page, $_registered_pages; 1723 1723 1724 $parent = get_admin_page_parent(); 1724 $parent = get_admin_page_parent(); 1725 $pagenow_this = $pagenow; 1725 1726 1726 if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) ) 1727 if ( isset( $_GET['post_type'] ) ) { 1728 $pagenow_this .= '?post_type=' . $_GET['post_type']; 1729 } 1730 1731 if ( ! isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $parent ][ $pagenow_this ] ) ) { 1727 1732 return false; 1733 } 1728 1734 1729 1735 if ( isset( $plugin_page ) ) { 1730 if ( isset( $_wp_submenu_nopriv[ $parent][$plugin_page] ) )1736 if ( isset( $_wp_submenu_nopriv[ $parent ][ $plugin_page ] ) ) { 1731 1737 return false; 1738 } 1732 1739 1733 $hookname = get_plugin_page_hookname( $plugin_page, $parent);1740 $hookname = get_plugin_page_hookname( $plugin_page, $parent ); 1734 1741 1735 if ( ! isset($_registered_pages[$hookname]) )1742 if ( ! isset( $_registered_pages[ $hookname ] ) ) { 1736 1743 return false; 1744 } 1737 1745 } 1738 1746 1739 if ( empty( $parent ) ) {1740 if ( isset( $_wp_menu_nopriv[ $pagenow] ) )1747 if ( empty( $parent ) ) { 1748 if ( isset( $_wp_menu_nopriv[ $pagenow_this ] ) ) { 1741 1749 return false; 1742 if ( isset( $_wp_submenu_nopriv[$pagenow][$pagenow] ) ) 1750 } 1751 1752 if ( isset( $_wp_submenu_nopriv[ $pagenow_this ][ $pagenow_this ] ) ) { 1743 1753 return false; 1744 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$pagenow][$plugin_page] ) ) 1754 } 1755 1756 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $pagenow_this ][ $plugin_page ] ) ) { 1745 1757 return false; 1746 if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[$plugin_page] ) ) 1758 } 1759 1760 if ( isset( $plugin_page ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { 1747 1761 return false; 1748 foreach (array_keys( $_wp_submenu_nopriv ) as $key ) { 1749 if ( isset( $_wp_submenu_nopriv[$key][$pagenow] ) ) 1762 } 1763 1764 foreach ( array_keys( $_wp_submenu_nopriv ) as $key ) { 1765 if ( isset( $_wp_submenu_nopriv[ $key ][ $pagenow_this ] ) ) { 1750 1766 return false; 1751 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$key][$plugin_page] ) ) 1752 return false; 1767 } 1768 1769 if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[ $key ][ $plugin_page ] ) ) { 1770 return false; 1771 } 1753 1772 } 1773 1754 1774 return true; 1755 1775 } 1756 1776 1757 if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[ $plugin_page] ) )1777 if ( isset( $plugin_page ) && ( $plugin_page == $parent ) && isset( $_wp_menu_nopriv[ $plugin_page ] ) ) { 1758 1778 return false; 1779 } 1759 1780 1760 if ( isset( $submenu[ $parent] ) ) {1761 foreach ( $submenu[ $parent] as $submenu_array ) {1781 if ( isset( $submenu[ $parent ] ) ) { 1782 foreach ( $submenu[ $parent ] as $submenu_array ) { 1762 1783 if ( isset( $plugin_page ) && ( $submenu_array[2] == $plugin_page ) ) { 1763 if ( current_user_can( $submenu_array[1] ) )1784 if ( current_user_can( $submenu_array[1] ) ) { 1764 1785 return true; 1765 else1786 } else { 1766 1787 return false; 1767 } elseif ( $submenu_array[2] == $pagenow ) { 1768 if ( current_user_can( $submenu_array[1] )) 1788 } 1789 } elseif ( $submenu_array[2] == $pagenow_this ) { 1790 if ( current_user_can( $submenu_array[1] ) ) { 1769 1791 return true; 1770 else1792 } else { 1771 1793 return false; 1794 } 1772 1795 } 1773 1796 } 1774 1797 } 1775 1798 1776 1799 foreach ( $menu as $menu_array ) { 1777 if ( $menu_array[2] == $parent ) {1778 if ( current_user_can( $menu_array[1] ) )1800 if ( $menu_array[2] == $parent ) { 1801 if ( current_user_can( $menu_array[1] ) ) { 1779 1802 return true; 1780 else1803 } else { 1781 1804 return false; 1805 } 1782 1806 } 1783 1807 } 1784 1808