[ Index ] |
PHP Cross Reference of phpSSH |
[Source view] [Print]
General utility functions This file contains convenience functions used throughout the package.
Author: | José R. Valverde |
File Size: | 334 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
set_header() X-Ref |
Start the display of a www page We have it as a function so we can customise all pages generated as needed. This routine will open HTML, create the page header, and include any needed style sheets (if any) to provide a common look-and-feel for all pages generated. |
set_footer() X-Ref |
close a web page Make sure we end the page with all the appropriate formulisms: close the body, include copyright notice, state creator and any needed details, and close the page. |
warning($msg) X-Ref |
print a warning Prints a warning in a separate pop-up window. A warning is issued when a non-critical problem has been detected. Execution can be resumed using some defaults, but the user should be notified. In order to not disrupt the web page we are displaying we use a JavaScript pop-up alert to notify the user. |
error($where, $what) X-Ref |
print an error message and exit Whenever we detect something wrong, we must tell the user. This function will take an error message as its argument, format it suitably and spit it out. |
letal($what, $where) X-Ref |
print a letal error message and die This function is called whenever a letal error (one that prevents further processing) is detected. The function will spit out an error message, close the page and exit the program. It should seldomly be used, since it may potentially disrupt the page layout (e.g. amid a table) by not closing open tags of which it is unaware. Actually it is a wrapper for error + terminate. |
ssh_passthru($remote, $password, $command, $status) X-Ref |
Execute a single command remotely using ssh and return its entire output (like passthru) This might be done as well using a pipe on /tmp and making the command 'cat' the pipe: when ssh runs, it runs the command 'cat' on the pipe and hangs on read. Then we just need a thread to open the pipe, put the password and close the pipe. This other way the password is never wirtten down. But, OTOH, the file life is so ephemeral that most of the time it will only exist in the internal system cache, so this approach is not that bad either. |
ssh_copy($origin, $destination, $password) X-Ref |
Copy a file or directory from one source to a destination This function copies source to dest, where one of them is a local filespec and the other a remote filespec of the form [user@]host:path If the original source is a directory, it will be copied recursively to destination (hence easing file transfers). The function returns TRUE on success or FALSE on failure. |
ssh_open($remote, $password) X-Ref |
No description |
Generated: Tue May 31 15:44:47 2005 | Cross-referenced by PHPXref 0.4.1 |