Skip to:
Content

bbPress.org

Changeset 1125


Ignore:
Timestamp:
02/28/2008 12:40:56 AM (18 years ago)
Author:
sambauers
Message:

Better glob validity testing. Fixes #787. Props _ck_

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/plugins.php

    r1089 r1125  
    44$plugins = bb_get_plugins();
    55$_plugins = array();
    6 if ( function_exists( 'glob' ) && is_callable( 'glob' ) ) {
    7     foreach ( glob(BBPLUGINDIR . '_*.php') as $_plugin ) {
     6if ( function_exists( 'glob' ) && is_callable( 'glob' ) && $_plugins_glob = glob(BBPLUGINDIR . '_*.php') ) {
     7    foreach ( $_plugins_glob as $_plugin ) {
    88        $_data = bb_get_plugin_data( $_plugin );
    99        $_plugins[$_plugin] = $_data ? $_data : true;
    1010    }
    1111}
     12unset($_plugins_glob, $_plugin);
    1213
    1314$current = (array) bb_get_option( 'active_plugins' );
  • trunk/bb-settings.php

    r1110 r1125  
    11<?php
    22
    3 function bb_sanitize_version($version) {
    4     $versions = array();
    5     foreach (explode('.', $version) as $part) {
    6         $part = preg_replace('@^([0-9]+)[^0-9]*$@', '$1', $part);
    7         $versions[] = (integer) $part;
    8     }
    9     $version = join('.', $versions);
    10     return (float) $version;
    11 }
    12 
    13 $phpversion = bb_sanitize_version( phpversion() );
    14 
    15 if ( $phpversion < 4.3 )
    16     die(sprintf('Your server is running PHP version %s but bbPress requires at least 4.3', $phpversion) );
     3if ( version_compare(PHP_VERSION, '4.3', '<') )
     4    die(sprintf('Your server is running PHP version %s but bbPress requires at least 4.3', PHP_VERSION) );
    175
    186if ( !$bb_table_prefix )
     
    381369
    382370// Load Plugins
    383 if ( function_exists( 'glob' ) && is_callable( 'glob' ) )
    384     foreach ( glob(BBPLUGINDIR . '_*.php') as $_plugin )
     371if ( function_exists( 'glob' ) && is_callable( 'glob' ) && $_plugins_glob = glob(BBPLUGINDIR . '_*.php') )
     372    foreach ( $_plugins_glob as $_plugin )
    385373        require($_plugin);
    386 unset($_plugin);
     374unset($_plugins_glob, $_plugin);
    387375do_action( 'bb_underscore_plugins_loaded' );
    388376
Note: See TracChangeset for help on using the changeset viewer.