Skip to:
Content

bbPress.org

Changeset 2348


Ignore:
Timestamp:
08/12/2009 05:03:05 AM (15 years ago)
Author:
sambauers
Message:

branches 0.9: Maintain registry of valid plugin page callbacks. See #1172.

Location:
branches/0.9/bb-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9/bb-admin/admin-functions.php

    r2053 r2348  
    7777{
    7878    global $bb_menu;
     79    global $bb_registered_plugin_callbacks;
     80    if ( empty( $bb_registered_plugin_callbacks ) ) {
     81        $bb_registered_plugin_callbacks = array();
     82    }
     83
    7984    if ($display_name && $capability && $file_name) {
     85        if ( strpos( $file_name, '.php' ) === false ) {
     86            $bb_registered_plugin_callbacks[] = $file_name;
     87        }
    8088        $bb_menu[] = array($display_name, $capability, $file_name);
    8189    }
     
    8593{
    8694    global $bb_submenu;
     95    global $bb_registered_plugin_callbacks;
     96    if ( empty( $bb_registered_plugin_callbacks ) ) {
     97        $bb_registered_plugin_callbacks = array();
     98    }
     99
    87100    if ($display_name && $capability && $file_name) {
     101        if ( strpos( $file_name, '.php' ) === false ) {
     102            $bb_registered_plugin_callbacks[] = $file_name;
     103        }
    88104        $bb_submenu[$parent][] = array($display_name, $capability, $file_name);
    89105    }
  • branches/0.9/bb-admin/admin.php

    r1188 r2348  
    1313require('admin-functions.php');
    1414
    15 if ( isset($_GET['plugin']) )
    16     $bb_admin_page = $_GET['plugin'];
    17 else    $bb_admin_page = bb_find_filename($_SERVER['PHP_SELF']);
     15$bb_admin_page = bb_find_filename( $_SERVER['PHP_SELF'] );
     16
     17$_check_callback = false;
     18if ( $bb_admin_page == 'admin-base.php' ) {
     19    $bb_admin_page = (string) @$_GET['plugin'];
     20    $_check_callback = true;
     21}
    1822
    1923bb_admin_menu_generator();
    2024bb_get_current_admin_menu();
     25
     26if ( $_check_callback ) {
     27    if ( empty( $bb_registered_plugin_callbacks ) || empty( $bb_admin_page ) || !in_array( $bb_admin_page, $bb_registered_plugin_callbacks ) ) {
     28        unset( $bb_admin_page );
     29    }
     30}
    2131?>
Note: See TracChangeset for help on using the changeset viewer.