PDA

View Full Version : ioFTPD PHP Extensions


darkone
02-07-2004, 06:41 AM
'client list' io_client_list_init('arguments')

Description:
Creates client list object.

Parameters:
'CINFO_CID' - If specified, integer element containing 'client id' is added.
'CINFO_UID' - If specified, integer element containing 'user id' is added.
'CINFO_LOGINTIME' - If specified, integer element containing 'unix time' is added.
'CINFO_IDLETIME' - If specified, integer element containing 'idle time in seconds' is added.
'CINFO_TRANSFERSTATUS' - If specified, integer element containing 'transfer status' is added.
'CINFO_TRANSFERSPEED' - If specified, double element containing 'transfer speed' is added.
'CINFO_TRANSFERPROGRESS' - If specified, double element containing 'transfer progress' is added.
'CINFO_IP' - If specified, string element containing 'ip' is added.
'CINFO_IDENT' - If specified, string element containing 'ident' is added.
'CINFO_HOSTNAME' - If specified, string element containing 'hostname' is added.
'CINFO_REALPATH' - If specified, string element containing 'path' is added.
'CINFO_VIRTUALPATH' - If specified, string element containing 'virtual path' is added.
'CINFO_REALDATAPATH' - If specified, string element containing 'data path' is added.
'CINFO_VIRTUALDATAPATH' - If specified, string element containing 'virtual data path' is added.

Return values:
If function succeeds, return value is 'client list'. Zero return value indicates error.




array io_client_list_fetch('client list')

Description:
Returns array of elements specified for 'client list' and increments offset in list.

Parameters:
'client list' - Resource allocated by client_list_init().

Return values:
If function succeeds, return value is array. Zero return value indicates error.




int io_client_list_close('client list')

Description:
Frees resources allocated by 'client list'.

Parameters:
'client list' - Resource allocated by client_list_init().

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_client_kill('client id')

Descrption:
Kills connection associated with 'client id'

Parameters:
'client id' - Non-negative integer.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_client_kick('user id')

Description:
Kicks clients associated with 'user id'

Parameters:
'user id' - Non-negative integer.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'mount table' io_mtable_open('filename')

Description:
Opens handle to mount table. (.vfs)

Parameters:
'filename' - String.

Return values:
If function succeeds, return value is 'mount table'. Zero return value indicates error.




array io_mtable_query('mount table', 'virtual path', 'user file' [, 'exists'])

Description:
Returns string array of paths that virtual path points to.

Parameters:
'mount table' - Resource allocated by io_mtable_open().
'virtual path' - String.
'user file' - Resource allocated by io_user_open().
'exists' - Boolean.

Description:
If function succeeds, return value is array. Zero return value indicates error.




array io_mtable_query_mounts('mount table', 'virtual path')

Description:
Returns string array of mounts within specified virtual path.

Parameters:
'mount table' - Resource allocated by io_mtable_open().
'virtual path' - String.

Return values:
If function succeeds, return value is array. Zero return value indicates error.




int io_mtable_close('mount table')

Description:
Frees resources allocated by 'mount table'

Parameters:
'mount table' - Resource allocated by io_mtable_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_config_get_bool('array', 'variable')

Description:
Get boolean from ini.

Parameters:
'array' - String.
'variable' - String.

Return values:
If function succeeds, return value is non-negative. Negative return value indicates error.




int io_config_get_permission('array', 'variable', 'user file')

Description:
Get permission from ini.

Parameters:
'array' - String.
'variable' - String.
'user file' - Resource allocated by io_user_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_config_get_int('array', 'variable')

Description:
Get integer from config file.

Parameters:
'array' - String.
'variable' - String.

Return values:
Zero return value may indicate error.




string io_config_get_string('array', 'variable')

Description:
Get string from config file.

Parameters:
'array' - String.
'variable' - String.

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_config_rehash()

Description:
Forces daemon to rehash.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_config_rehash('line')

Description:
Writes line to daemon's log.

Parameters:
'line' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




string io_sha1('string')

Description:
Returns sha1 hash of 'string'.

Parameters:
'string' - String.

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_fs_flush('path')

Descrption:
Forces daemon to flush directory cache for 'path'.

Parameters:
'path' - String.

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_fs_access('file info', 'user file' [, 'flags'])

Description:
Checks, if user has access to file. If 'flags' is not specified, only privacy will be checked.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()
'user file' - Resource allocated by io_user_open()
'flags' - Any combination of following: FS_NULL, FS_READ, FS_WRITE, FS_EXECUTE

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_fs_modify_attribute('file info', 'index' [, 'value'])

Description:
Modifies special attribute associated with file. If value is not specified, existing value will be removed.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()
'index' - Non-zero integer.
'value' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




string io_fS_query_attribute('file info', 'index')

Description:
Returns special attribute associated with file.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()
'index' - Non-zero integer.

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_fs_write('file info' [, 'filename'])

Descrption:
Confirms modifications to file. If filename is specified, filename associated with 'file info'
will not be used.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()
'filename' - string

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




string io_fs_query_filename('file info')

Description:
Returns filename associated with 'file info'.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_fs_close('file info')

Descrption:
Frees resources associated with 'file info'

Parameters:
'file info' - Resource allocated by io_fs_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.





int io_fs_isdirectory('file info')

Descrption:
Tests if specified file is a directory

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_fs_query_filesize('file info')

Descrption:
Returns filesize of file.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()

Return values:
If specified file is a directory, return value is array containing number of
subdirectories and size of directory. Otherwise return value is size of file.
Negative return value indicates error.




int io_fs_query('file info')

Description:
Returns permissions associated with file.

Parameters:
'file info' - Resource allocated by io_fs_open()/io_fs_find_first()

Return values:
If function succeeds, return value is array containing 'user id', 'group id'
and 'file mode'. Negative return value indicates error.




int io_fs_modify('file info', 'user id' [, 'group id', 'file mode'])

Description:
Modified permissions associated with file.

Parameters:
'user id' - Non-negative integer. -1 indicates that item should not be modified.
'group id' - Non-negative integer. -1 indicates that item should not be modified.
'file mode' - Non-negative integer. -1 indicates that item should not be modified.


Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'file info' io_fs_open('filename')

Description:
Gets information associated with filename.

Parameters:
'filename' - String.

Return values:
If function succeeds, return value is 'file info'. Zero return value indicates error.




'file info' io_fs_find_first('path' [, 'filter'])

Descrption:
Searches specified path for files.

Parameters:
'path' - String.
'filter' - String.

Return values:
If function succeeds, return value is 'file info'. Zero return value indicates error.




int io_fs_find_next('file info')

Description:
Finds next item.

Parameters:
'file info' - Resource allocated by io_fs_find_first()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_fs_find_close('file info')

Descrption:
Frees resources associated with 'file info'

Parameters:
'file info' - Resource allocated by io_fs_find_first()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.



string io_user_name('user id')

Description:
Returns name associated with 'user id'.

Parameters:
'user id' - Non-negative integer.

Return values:
If function succeeeds, return value is a string. Zero return value indicates error.




'user id' io_user_id('name')

Description:
Returns 'user id' associated with 'name'.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is 'user id'. Negative return value indicates error.




'user id' io_user_create('name')

Description:
Creates a new user.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is 'user id'. Negative return value indicates error.




int io_user_delete('name')

Description:
Deletes existing user.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_user_rename('name', 'new name')

Description:
Renames existing user from 'name' to 'new name'.

Parameters:
'name' - String.
'new name' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'user file' io_user_open('user id')

Description:
Opens handle to 'user file'.

Parameters:
'user id' - Non-negative integer

Return values:
If function succeeds, return value is 'user file'. Zero return value indicates error.




int io_user_close('user file')

Description:
Frees resources allocated by 'user file'.

Parameters:
'user file' - Resource allocated by io_user_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_user_lock('user file')

Description:
Acquires exclusive lock to 'user file'.

Parameters:
'user file' - Resource allocated by io_user_open()

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_user_unlock('user file')

Description:
Releases exclusive lock from 'user file'.

Parameters:
'user file' - Resource allocated by io_user_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_user_print('user file')

Description:
Formats contents of 'user file' in a newline-terminated string.

Parameters:
'user file' - Resource allocated by io_user_open()

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_user_save('user file', 'data')

Description:
Updates contents of locked 'user file'.

Parameters:
'user file' - Resource allocated by io_user_open()
'data' - String using format specified by io_user_print()

Return values:
If function succeeds, return value is non-zero. Zero return value inidicates error.




'user list' io_user_list_init()

Description:
Initializes a 'user list'

Return values:
If function succeeds, return value is non-zero. Zero return value inidicates error.




int io_user_list_seek('user list', 'offset')

Description:
Jumps to specified 'offset' on 'user list'.

Parameters:
'user list' - Resource allocated by io_user_list_init()
'offset' - Non-negative integer value

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'user id' io_user_list_fetch('user list')

Description:
Extracts 'user id' from 'user list' and increments current offset in list by one.

Parameters:
'user list' - Resource allocated by io_user_list_init()

Return values:
If function succeeds, return value is 'user id'. Negative return value indicates error.




int io_user_list_close('user list')

Description:
Frees resources allocated by 'user list'

Parameters:
'user list' - Resource allocated by io_user_list_init()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.



int io_user_ingroup('user file', 'group id')

Description:
Checks if users is member of group.

Parameters:
'user file' - Resource allocated by io_user_open()
'group id' - Non-negative integer.




'user mask' io_user_mask_init(...)

Description:
Creates a 'user mask'.

Parameters:
'UINFO_DAYUP' - If specified, double elements containing stats is added.
'UINFO_DAYDN'
'UINFO_WKUP'
'UINFO_WKDN'
'UINFO_MONTHUP'
'UINFO_MONTHDN'
'UINFO_ALLUP'
'UINFO_ALLDN'
'UINFO_CREDITS' - If specified, double elements containing 'credits' is added.
'UINFO_GROUPS' - If specified, integer element containing number of groups and
integer elements containing groups is added.
'UINFO_ADMINGROUPS'
'UINFO_IPLIST' - If specified, integer element containing 'number of ips' and
string elements containing 'ips' is added.
'UINFO_LIMITS' - If specified, integer elements containing 'limits' is added.
'UINFO_PASSWORD' - If specified, string element containing 'password' is added.
'UINFO_FLAGS' - If specified, string element containing 'flags' is added.
'UINFO_HOMEDIR' - If specified, string element containing 'home directory' is added.
'UINFO_DESCRPTION' - If specified, string element containing 'description' is added.
'UINFO_MOUNTFILE' - If specified, string element containing 'mountfile' is added.
'UINFO_MERGE_STATS' - If specified, stats are merged.
'UINFO_START_SECTION' - If specified, next argument indicates first section to include.
'UINFO_END_SECTION' - If specified, next argument indicates last section to include.
'UINFO_NOBYTES' - If specified, stats will not return bytes element.
'UINFO_NOFILES' - If specified, stats will not return files element.
'UINFO_NOTIME' - If specified, stats will not return time element.

Return values:
If function succeeds, return values is 'user mask'. Zero return value indicates error.




int io_user_mask_close('user mask')

Description:
Frees resources allocated by 'user mask'

Parameters:
'user mask' - Resource allocated by io_user_mask_init().

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




array io_user_query('user file', 'user mask')

Descrption:
Returns array of elements specified by 'user mask'.

Parameters:
'user file' - Resource allocated by io_user_open().
'user mask' - Resource allocated by io_user_mask_init().

Return values:
If function succeeds, return value is array. Zero return value indicates error.




string io_group_name('group id')

Description:
Returns name associated with 'group id'.

Parameters:
'group id' - Non-negative integer.

Return values:
If function succeeeds, return value is a string. Zero return value indicates error.




'group id' io_group_id('name')

Description:
Returns 'group id' associated with 'name'.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is 'group id'. Negative return value indicates error.




'group id' io_group_create('name')

Description:
Creates a new group.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is 'group id'. Negative return value indicates error.




int io_group_delete('name')

Description:
Deletes existing group.

Parameters:
'name' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_group_rename('name', 'new name')

Description:
Renames existing group from 'name' to 'new name'.

Parameters:
'name' - String.
'new name' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'group file' io_group_open('group id')

Description:
Opens handle to 'group file'.

Parameters:
'group id' - Non-negative integer

Return values:
If function succeeds, return value is 'group file'. Zero return value indicates error.




int io_group_close('group file')

Description:
Frees resources allocated by 'group file'.

Parameters:
'group file' - Resource allocated by io_group_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_group_lock('group file')

Description:
Acquires exclusive lock to 'group file'.

Parameters:
'group file' - Resource allocated by io_group_open()

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_group_unlock('group file')

Description:
Releases exclusive lock from 'group file'.

Parameters:
'group file' - Resource allocated by io_group_open()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_group_print('group file')

Description:
Formats contents of 'group file' in a newline-terminated string.

Parameters:
'group file' - Resource allocated by io_group_open()

Return values:
If function succeeds, return value is a string. Zero return value indicates error.




int io_group_save('group file', 'data')

Description:
Updates contents of locked 'group file'.

Parameters:
'group file' - Resource allocated by io_group_open()
'data' - String using format specified by io_group_print()

Return values:
If function succeeds, return value is non-zero. Zero return value inidicates error.




'group list' io_group_list_init()

Description:
Initializes a 'group list'

Return values:
If function succeeds, return value is non-zero. Zero return value inidicates error.




int io_group_list_seek('group list', 'offset')

Description:
Jumps to specified 'offset' on 'group list'.

Parameters:
'group list' - Resource allocated by io_group_list_init()
'offset' - Non-negative integer value

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




'group id' io_group_list_fetch('group list')

Description:
Extracts 'group id' from 'group list' and increments current offset in list by one.

Parameters:
'group list' - Resource allocated by io_group_list_init()

Return values:
If function succeeds, return value is 'group id'. Negative return value indicates error.




int io_group_list_close('group list')

Description:
Frees resources allocated by 'group list'

Parameters:
'group list' - Resource allocated by io_group_list_init()

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.




int io_attachment('filename')

Description:
Adds file to output buffer. Provides superior performance for transmitting large files over HTTP.

Parameters:
'filename' - String.

Return values:
If function succeeds, return value is non-zero. Zero return value indicates error.

SnypeTEST
02-07-2004, 01:18 PM
oh man! that list is better than porn.

darkone
02-07-2004, 04:22 PM
I second that ;p writing the documentation took 2hours =D writing extensions took only 2days :p Anyways, it's damn cool.. there's very little that can't be done using these commands...

PaJa
03-13-2004, 05:45 AM
Nice, nice ;)
Can you write something like this to itcl? It would by nice to have all on one place not all around in the forum ;)

Thanx for good work anyways.

Farch
04-04-2004, 09:21 AM
'CINFO_LOGINTIME' - If specified, integer element containing 'unix time' is added.

what about date?

like: Login in Friday, 24 April, at 10:04 AM

Harm
04-04-2004, 09:52 AM
An unix timestamp does contain the date as well.
In fact, it is the number of seconds since 00:00:00 UTC on Jan. 1, 1970.

SnypeTEST
04-04-2004, 10:28 AM
Originally posted by Farch
'CINFO_LOGINTIME' - If specified, integer element containing 'unix time' is added.

what about date?

like: Login in Friday, 24 April, at 10:04 AM

http://us2.php.net/manual/en/function.date.php

date("D, d F, H:i",CINFO_LOGINTIME)
try that.

Nemon
06-29-2004, 10:06 AM
How can i use these PHP extensions from a custom command script?

EXEC php.exe -q ..\scripts\somephp.php

Doesnt have access to the extensions, im presuming the extensions are only available via the http service?

SnypeTEST
06-29-2004, 10:44 AM
Originally posted by Nemon
How can i use these PHP extensions from a custom command script?

EXEC php.exe -q ..\scripts\somephp.php

Doesnt have access to the extensions, im presuming the extensions are only available via the http service?


nope. only via http for now :(

Nemon
06-29-2004, 11:08 AM
Originally posted by SnypeTEST
nope. only via http for now :(

Well i've found PHP can gain access to a bit of information by setting the cookies to the environment variables, which are available in PHP $_ENV.

SnypeTEST
06-29-2004, 11:38 AM
well thats for all scripts (except tcl) .. they access the info in the environment variables.

Nemon
06-29-2004, 11:43 AM
Originally posted by SnypeTEST
well thats for all scripts (except tcl) .. they access the info in the environment variables.

I suppose you could use PHPs FTP extension to open a connection back to the server and issue commands that way, a bit odd tho :banana:

SnypeTEST
06-29-2004, 11:52 AM
and a bit time consuming? :o

Jog
09-15-2005, 02:51 AM
i have used for checking password for user with id=0 :

$myuserfile=io_user_open('0');
$myusermask=io_user_mask_init(UINFO_PASSWORD);
$mypassword=io_user_query($myuserfile,$myusermask) ;
$myfilecontent = io_user_print($myuserfile);

$mypassword is different from password in $myfilecontent :

for "print_r($mypassword)" the result is :

Array ( [0] => ff6661ffffff3532ffff01ffff1b130cffff30ff )

for "print($myfilecontent)" the result is :

wkup ................ password 826661e7f1903532becf01dcff1b130ce6fe30c2 ........... admingroups

Why some bit of real sha1 pass replaced with f ?

Thanks for help.