API16

JFTP/syst: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 55: Line 55:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=syst
  category=syst
  category=JFTP
  category=JFTP
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:38, 25 March 2017

Description

Method to system string from the FTP server


<! removed transcluded page call, red link never existed >

Syntax

syst()


Returns

string System identifier string

Defined in

libraries/joomla/client/ftp.php

Importing

jimport( 'joomla.client.ftp' );

Source Body

function syst() {

        // If native FTP support is enabled lets use it...
        if (FTP_NATIVE) {
                if (($ret = @ftp_systype($this->_conn)) === false) {
                        JError::raiseWarning('35', 'JFTP::syst: Bad response');
                        return false;
                }
        } else {
                // Send print working directory command and verify success
                if (!$this->_putCmd('SYST', 215)) {
                        JError::raiseWarning('35', 'JFTP::syst: Bad response', 'Server response: '.$this->_response.' [Expected: 215]');
                        return false;
                }
                $ret = $this->_response;
        }

        // Match the system string to an OS
        if (strpos(strtoupper($ret), 'MAC') !== false) {
                $ret = 'MAC';
        } elseif (strpos(strtoupper($ret), 'WIN') !== false) {
                $ret = 'WIN';
        } else {
                $ret = 'UNIX';
        }

        // Return the os type
        return $ret;
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples