Navigation

Search

ftp_connection::detect_path

Description

Two purposes - attempts to detect the path for FTP (and your username if you're on cPanel) and also attempts to detect the path to the specified file if an FTP connection is available.

Syntax

array ftp_connection::detect_path (string $filesystem_path[, string $lookup_file])



Parameter $filesystem_path

Expected type: String
Description: The filesystem path (as opposed to the FTP path) to the directory where the search should start



Parameter $lookup_file

Expected type: String
Description: The name of the file to look for. If not specified, $_SERVER['PHP_SELF'] will be used (see http://www.php.net/reserved.variables.server for more info)



Return value

Expected type: Array
Description: The array contains three values. The first will be your username (if detected, an empty string otherwise), the second is the detected path and the third is whether or not the path was found


Notes

  • Relies on the existence of $_SERVER['DOCUMENT_ROOT'] to properly set the path
  • Includes automatic detection for cPanel and "/var/www" paths
  • $filesystem_path is used to check for "/var/www" and also is used as the path if you're not on cPanel and "/var/www" can't be found in the path
  • If an FTP connection is available, SMF will attempt to find the path to the specified file using the detect path as a starting point
View all versions of this function