Changeset 392 for trunk/bp-core/bp-core-catchuri.php
- Timestamp:
- 10/12/2008 11:58:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r388 r392 17 17 * - VHOST: http:// andy.domain.com / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 18 18 * - NO VHOST: http:// domain.com / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 19 * - OUTSIDE ROOT: http:// domain.com / sites / buddypress / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 19 20 * 20 * 21 * Example: 21 22 * - http://andy.domain.com/profile/edit/group/5/ 22 23 * - $current_component: string 'profile' … … 28 29 function bp_core_set_uri_globals() { 29 30 global $current_component, $current_action, $action_variables; 30 31 31 32 /* Fetch the current URI and explode each part seperated by '/' into an array */ 32 33 $bp_uri = explode( "/", $_SERVER['REQUEST_URI'] ); 33 34 /* This is used to determine where the component and action indexes should start */35 $root_components = explode( ',', BP_CORE_ROOT_COMPONENTS );36 $is_root_component = in_array( $bp_uri[1], $root_components );37 34 38 35 /* Set the indexes, these are incresed by one if we are not on a VHOST install */ 39 36 $component_index = 0; 40 $action_index = 1; 37 $action_index = $component_index + 1; 38 39 /* Get site path items */ 40 $paths = explode( '/', bp_core_get_site_path() ); 41 41 42 if ( VHOST == 'no' && !$is_root_component ) { 43 $component_index++; 44 $action_index++; 45 } 42 /* Take empties off the end */ 43 if ( $paths[count($paths) - 1] == "" ) 44 array_pop( $paths ); 46 45 46 /* Take empties off the start */ 47 if ( $paths[0] == "" ) 48 array_shift( $paths ); 49 47 50 /* Take empties off the end */ 48 51 if ( $bp_uri[count($bp_uri) - 1] == "" ) … … 52 55 if ( $bp_uri[0] == "" ) 53 56 array_shift( $bp_uri ); 54 57 55 58 /* Get total URI segment count */ 56 59 $bp_uri_count = count( $bp_uri ) - 1; 60 61 for ( $i = 0; $i < $bp_uri_count; $i++ ) { 62 if ( in_array( $bp_uri[$i], $paths )) { 63 unset( $bp_uri[$i] ); 64 } 65 } 57 66 67 /* Reset the keys by merging with an empty array */ 68 $bp_uri = array_merge( array(), $bp_uri ); 69 70 /* This is used to determine where the component and action indexes should start */ 71 $root_components = explode( ',', BP_CORE_ROOT_COMPONENTS ); 72 $is_root_component = in_array( $bp_uri[0], $root_components ); 73 74 if ( VHOST == 'no' && !$is_root_component ) { 75 $component_index++; 76 $action_index++; 77 } 78 58 79 /* Set the current component */ 59 80 $current_component = $bp_uri[$component_index]; … … 65 86 $action_variables = $bp_uri; 66 87 67 /* Remove the username from action variables if this is not a VHOST install */68 if ( VHOST == 'no' )69 unset($action_variables[0]);70 71 88 /* Unset the current_component and action from action_variables */ 72 89 unset($action_variables[$component_index]); 73 90 unset($action_variables[$action_index]); 91 92 /* Remove the username from action variables if this is not a VHOST install */ 93 if ( VHOST == 'no' && !$is_root_component ) 94 array_shift($action_variables); 74 95 75 96 /* Reset the keys by merging with an empty array */
Note: See TracChangeset
for help on using the changeset viewer.