system Class
Root class of the System API, used for accessing the CompleteFTP server's internal state. Accessed via the global variable 'system'.
Item Index
Methods
executeCustomCommand
-
commandName
-
arguments
Executes a custom command and returns the result. Custom commands are methods that have been implemented in Custom Command Extensions and Custom Command Scripts. There are some inbuilt commands, including administration commands and the file-sharing commands (ask support), but you can also add your own.
Parameters:
-
commandName
StringName of the custom command (e.g. "useradd")
-
arguments
StringArguments to be passed to the command.
Returns:
getFile
-
path
Returns a File object for the given path.
The File object may or may not represent an existing file or directory.
Parameters:
-
path
StringPath of file
Returns:
login
-
userName
-
password
Log in using the given user-name and password, or throws an exception indicating that the user could not be authenticated. Until this function is invoked the active user will be the 'anonymous' user. Logins are associated with session IDs, which are stored in a cookie named "_cftpsessid". Cookies must therefore be enabled for logins to work. Users must be set up within CompleteFTP. If users are to be managed from within the web-app then CompleteFTP's database authentication should be used in combination with the server-side WebSQLDatabase feature (see System/openDatabaseSync:method). Use the System/user:property property to access information about the active user.
Parameters:
-
userName
StringUser-name
-
password
StringPassword
logout
()
Log out the current user.
openDatabaseSync
-
connectionString
-
version
Opens a connection to the database with the given connection-string. The connectionString must be either the virtual file-system path of an SQLite or SQL Server Compact file, or a prefixed database connection-string. The prefixes are shown below:
Connection-type | Prefix | File-extension | Database DLLs required? |
---|---|---|---|
SQLite | sqlite:* | .sqlite3 | no |
SQL Server Compact | sqlserverce:* | .sdf | no |
SQL Server | sqlserver: | n/a | no |
ODBC | odbc: | n/a | no |
OLE DB | oledb: | n/a | yes** |
* - Prefixes are only required for SQLite and SQL Server Compact if the listed file-extension
isn't being used.
** - For OLE DB connections the DLLs for the specific database being accessed must be placed in the same directory
as the CompleteFTP server executables.
Parameters:
-
connectionString
StringConnection-string.
-
version
StringNot used (optional).
Returns:
Properties
server
Object
Represents the current server.
Sub-properties:
-
name
StringName of the server.
site
Object
Represents the CompleteFTP site that is serving up this script.
Sub-properties:
-
name
StringName of the site.
-
welcomeMessage
StringWelcome-message of the site.
user
Object
Represents the currently logged in user or the anonymous user, if a user isn't logged in.
Sub-properties:
-
userName
StringUser-name of the user.
-
isAnonymous
BooleanTrue if no user is currently logged in.
-
homeFolder
StringFull path of the user's home-folder.
-
tags
ObjectA set of name-value pairs whose lifetime is that of the session