Skip to content

Commit

Permalink
Merge pull request ampache#649 from brownl/develop
Browse files Browse the repository at this point in the history
Loop over directories the "correct" way
  • Loading branch information
Afterster committed Jan 3, 2015
2 parents 0ee3d5d + 4476479 commit ab8ce35
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/class/art.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ public function gather_folder($limit = 5)
$processed[$dir] = true;

// Recurse through this dir and create the files array
while ($file = readdir($handle)) {
while (false !== ($file = readdir($handle))) {
$extension = pathinfo($file);
$extension = $extension['extension'];

Expand Down
2 changes: 1 addition & 1 deletion lib/class/catalog.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public static function get_catalog_types()

$results = array();

while ($file = readdir($handle)) {
while (false !== ($file = readdir($handle))) {

if (substr($file, -11, 11) != 'catalog.php') { continue; }

Expand Down
2 changes: 1 addition & 1 deletion lib/class/localplay.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static function get_controllers()

$results = array();

while ($file = readdir($handle)) {
while (false !== ($file = readdir($handle))) {

if (substr($file,-14,14) != 'controller.php') { continue; }

Expand Down
2 changes: 1 addition & 1 deletion lib/class/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function get_plugins($type='')
}

// Recurse the directory
while ($file = readdir($handle)) {
while (false !== ($file = readdir($handle))) {
// Ignore non-plugin files
if (substr($file,-10,10) != 'plugin.php') { continue; }
if (is_dir($file)) { continue; }
Expand Down
2 changes: 1 addition & 1 deletion lib/general.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function get_languages()
/* Prepend English */
$results['en_US'] = 'English (US)';

while ($file = readdir($handle)) {
while (false !== ($file = readdir($handle))) {

$full_file = AmpConfig::get('prefix') . '/locale/' . $file;

Expand Down
2 changes: 1 addition & 1 deletion modules/Auth/OpenID/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ function _rmtree($dir)
}

if ($handle = opendir($dir)) {
while ($item = readdir($handle)) {
while (false !== ($item = readdir($handle))) {
if (!in_array($item, array('.', '..'))) {
if (is_dir($dir . $item)) {

Expand Down
4 changes: 2 additions & 2 deletions modules/captcha/captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ function straighten_temp_dir() {
// clean up old files
if ((rand(0,100) <= 5) && ($dh = opendir($dir))) {
$t_kill = time() - CAPTCHA_TIMEOUT * 1.2;
while($fn = readdir($dh)) if ($fn[0] != ".") {
while(false !== ($fn = readdir($dh))) if ($fn[0] != ".") {
if (filemtime("$dir/$fn") < $t_kill) {
@unlink("$dir/$fn");
}
Expand Down Expand Up @@ -1258,4 +1258,4 @@ function canonical_path($url) {



?>
?>

0 comments on commit ab8ce35

Please sign in to comment.