History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: OSC-169
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Harald Ponce de Leon
Reporter: Jan Zonjee
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
osCommerce Core

directory listing in admin not very particular about kind of file

Created: 03/Jun/07 03:39 PM   Updated: 12/Jun/07 07:13 PM
Return to search
Component/s: Core Framework
Affects Version/s: 3.0 Alpha 4
Fix Version/s: 3.0 Alpha 5

Environment: MacOSX, php4, mysql5, register globals=on


 Description  « Hide
While trying to add an item to the toolbar on top in the admin section I run across a fatal error in the administrator part, editing an admin. The directory listing of files in the directory includes/modules/access is not very particular about the kind of file it finds. On MacOSX it also lists the file .DS_Store which resulted in a fatal error.
I got around it by using this in admin/templates/pages/administrators/edit.php:
{code} foreach ($osC_DirectoryListing->getFiles() as $file) {
    $module = substr($file['name'], 0, strrpos($file['name'], '.'));
    if (empty($module)) continue; // avoid .DS_Store on MacOSX to be read as a module{code}
Perhaps it would be more elegant to call getFiles with a parameter 'php' to only get php files from that directory.


 All   Comments   Change History      Sort Order:
Jan Zonjee [03/Jun/07 04:00 PM]
The more elegant solution (IMHO) looks like this (admin/templates/pages/administrators/edit.php):
{code} $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
  $osC_DirectoryListing->setIncludeDirectories(false);
  $osC_DirectoryListing->setCheckExtension('php'); // avoid .DS_Store on MacOSX to be read as a module{code}

Harald Ponce de Leon [12/Jun/07 07:13 PM]
Fixed in r1605.

Thanks for the report!

Change by Harald Ponce de Leon [12/Jun/07 07:13 PM]
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 Alpha 5 [ 10001 ]
Resolution Fixed [ 1 ]
Assignee Harald Ponce de Leon [ hpdl ]