Welcome Guest, Not a member yet? Register   Sign In
directory_map issue
#1

[eluser]leonbloy[/eluser]
The API of this helper seems badly designed to me:

http://ellislab.com/codeigniter/user-gui...elper.html

Code:
directory_map
function:

Quote:Each folder name will be an array index, while its contained files will be numerically indexed.

Bad way of representing a directory tree: What if I have a directory name that happens to be a number?

It must break.... and yes, it breaks. Badly.

Case 1: tree

Code:
dummy.zip
  0 -
     assda

returns

Code:
Array
(
    [0] => dummy.zip
)

Case 2: Tree:

Code:
dummy.zip
  3 -
     assda

returns:

Code:
Array
(
    [3] => Array
        (
            [0] => asdas
        )

    [4] => dummy.zip
)
#2

[eluser]leonbloy[/eluser]
I propose to index the array by the filename.

For example, changing the line

Code:
$filedata[] = $file;

by

Code:
$filedata[$file] = $file;

does the trick.


BTW: I caught another bug in the same function. A file or directory with the name "0" (number zero) is skipped.
Fix:

replace

Code:
if ( ! trim($file, '.') OR ($hidden == FALSE && $file[0] == '.'))

by

Code:
if ( trim($file, '.') === '' OR ($hidden == FALSE && $file[0] == '.'))
#3

[eluser]InsiteFX[/eluser]
So you can fix very easy! MY_directory_helper and place it in application/helpers

InsiteFX
#4

[eluser]lisahill[/eluser]
I am having a problem with Directory Map Objects. When I attempt to map
a drive in a login script it gives an error message of "A network drive
cannot be mapped to a drive that is designated as a local drive". But if
I copy and paste the line into a Windows command prompt it works.

I am testing this on Windows XP with the 4.91 SP1 NetWare client. I have
tried this with directory objects under different OUs in our Tree. Also,
I have created directory map objects pointing to different volumes.
(NetWare 5.1/6.5 with Traditional and NSS volumes).

I have verified that I have full rights to the directory map and OU
objects.

The syntax is as follows: MAP ROOT L:=.DIRMAP.MYOU.MYORG

Any help appeciated
Thanks, Jamie

College Girls




Theme © iAndrew 2016 - Forum software by © MyBB