API Docs for:
Show:

system Class

Module: API

Root class of the System API, used for accessing the CompleteFTP server's internal state. Accessed via the global variable 'system'.

Methods

executeCustomCommand

(
  • commandName
  • arguments
)
String

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 String

    Name of the custom command (e.g. "useradd")

  • arguments String

    Arguments to be passed to the command.

Returns:

String: Result of the command.

getFile

(
  • path
)
File

Returns a File object for the given path.
The File object may or may not represent an existing file or directory.

Parameters:

  • path String

    Path of file

Returns:

File:

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 String

    User-name

  • password String

    Password

logout

()

Log out the current user.

openDatabaseSync

(
  • connectionString
  • version
)
DatabaseSync

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-typePrefixFile-extensionDatabase DLLs required?
SQLitesqlite:*.sqlite3no
SQL Server Compactsqlserverce:*.sdfno
SQL Serversqlserver:n/ano
ODBCodbc:n/ano
OLE DBoledb:n/ayes**

* - 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 String

    Connection-string.

  • version String

    Not used (optional).

Returns:

Properties

server

Object

Represents the current server.

Sub-properties:

  • name String

    Name of the server.

site

Object

Represents the CompleteFTP site that is serving up this script.

Sub-properties:

  • name String

    Name of the site.

  • welcomeMessage String

    Welcome-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 String

    User-name of the user.

  • isAnonymous Boolean

    True if no user is currently logged in.

  • homeFolder String

    Full path of the user's home-folder.

  • tags Object

    A set of name-value pairs whose lifetime is that of the session