Skip to content

Commit

Permalink
Bug Fix Issue #57
Browse files Browse the repository at this point in the history
In PHP 5.3.6 and older, DirectoryIterator::getExtension() is broken. Replaced with pathinfo()
  • Loading branch information
WildcardSearch committed Feb 17, 2013
1 parent bffbd36 commit f95ea95
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions Upload/inc/plugins/adv_sidebox/adv_sidebox_classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public function build_script_list()
$base_name = substr($script, 0, strlen($script) - 4);
$language_name = 'adv_sidebox_' . $base_name;
$setting_name = 'adv_sidebox_on_' . $base_name;

if($script = 'portal')
{
$setting_name = 'adv_sidebox_portal_replace';
Expand Down Expand Up @@ -1792,15 +1792,26 @@ private function get_all_addons($acp = false)
// otherwise load all detected modules
foreach(new DirectoryIterator(ADV_SIDEBOX_MODULES_DIR) as $file)
{
// skip directories, '.' '..' and non PHP files
if($file->isDot() || $file->isDir() || $file->getExtension() != 'php') continue;
if($file->isFile())
{
// skip directories, '.' '..' and non PHP files
if($file->isDot() || $file->isDir())
{
continue;
}

// extract the base_name from the module filename
$filename = $file->getFilename();
$module = substr($filename, 0, strlen($filename) - 4);
$extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);

// atempt to load the module
$this->addons[$module] = new Addon_type($module);
if($extension == 'php')
{
// extract the base_name from the module filename
$filename = $file->getFilename();
$module = substr($filename, 0, strlen($filename) - 4);

// atempt to load the module
$this->addons[$module] = new Addon_type($module);
}
}
}
}
}
Expand Down

0 comments on commit f95ea95

Please sign in to comment.