当前位置: 首页>>代码示例>>PHP>>正文


PHP ftp_systype函数代码示例

本文整理汇总了PHP中ftp_systype函数的典型用法代码示例。如果您正苦于以下问题:PHP ftp_systype函数的具体用法?PHP ftp_systype怎么用?PHP ftp_systype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ftp_systype函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: conexion

 /**
  * Establece la conceccion al servidor de FTP
  *
  * @param $servidor_ftp=host  $user=usuario $pass=password $modo=de conexxion por defecto en true
  * @return $id_con identificador de la conexion FTP
  */
 function conexion($servidor_ftp, $user, $pass, $modo = true, $puerto = 21, $tiempoEspera = 360)
 {
     // configurar una conexion o abortar
     // el arroba es para evitar los warning que salgan por pantalla
     if (empty($tiempoEspera)) {
         $tiempoEspera = 90;
     }
     @($id_con = ftp_connect($servidor_ftp, $puerto, $tiempoEspera));
     if (!$id_con || !isset($id_con)) {
         return false;
         //return false conexion no establecida
     } else {
         // Abrir la session con usuario y contraseña
         // el arroba es para evitar los warning que salgan por pantalla
         @($login_result = ftp_login($id_con, $user, $pass));
         if (!$login_result || !isset($login_result)) {
             return false;
             //return false el logueo no fue establecida
         }
     }
     // Habilita o deshabilita el modo pasivo. En modo pasivo, las conexiones de datos son
     // iniciadas por el cliente, en lugar del servidor. Puede requerirse si el cliente se
     // encuentra detrás de un firewall. ftp_pasv() únicamente puede llamarse después de
     // un inicio de sesión exitoso, de otra forma fallará.
     ftp_pasv($id_con, $modo);
     // Verifico que type UNIX (tambien lo toman como valor la mayoria de los servidores windows)
     $res = ftp_systype($id_con);
     //if($res != "UNIX") return false;
     // Se conect OK
     return $id_con;
 }
开发者ID:Nilphy,项目名称:moteguardian,代码行数:37,代码来源:clase.FTPDriver.php

示例2: connect

 public function connect()
 {
     $this->printLog("Connect");
     if ($this->conn_id = ftp_connect($this->host, $this->port, $this->timeout)) {
         if (ftp_login($this->conn_id, $this->user, $this->pass)) {
             $this->updateState(PR_FTP_STATE_LOGGED_IN);
             if ($status = ftp_chdir($this->conn_id, $this->cur_path)) {
                 $this->updateState(PR_FTP_STATE_TARGETED);
                 $this->updateStatus(PR_FTP_STATUS_READY);
                 $this->systype = ftp_systype($this->conn_id);
                 // TODO: make specific OS dependednt things
                 $this->printLog("OS: " . $this->systype . " " . ftp_pwd($this->conn_id));
                 // TODO: pass the mode into the module
                 ftp_pasv($this->conn_id, true);
                 unset($this->listing_cache);
                 $this->listing_cache = array();
             } else {
                 $this->updateState(PR_FTP_STATE_ERROR);
             }
         } else {
             $this->updateState(PR_FTP_STATE_DISCONNECTED);
             $this->updateStatus(PR_FTP_STATUS_NOT_READY);
         }
     } else {
         $this->updateState(PR_FTP_STATE_DISCONNECTED);
         $this->updateStatus(PR_FTP_STATUS_NOT_READY);
     }
 }
开发者ID:revsm,项目名称:procureor,代码行数:28,代码来源:ftpclient.php

示例3: __construct

 /**
  * __construct
  * 
  * @param string $user
  * @param string $pass
  * @param string $host
  * @param int $port
  */
 public function __construct($user = 'root', $pass = '', $host = 'localhost', $port = 21)
 {
     $this->_res = ftp_connect($host, $port, 10);
     ftp_login($this->_res, $user, $pass);
     ftp_pasv($this->_res, true);
     Registry::set('sysType', strtoupper(substr(ftp_systype($this->_res), 0, 3)) == 'WIN' ? 'WIN' : 'NIX');
     // URL
     //$this->_url = 'ftp://' . $user . ':' . $pass . '@' . $host . ':' . $port;
 }
开发者ID:thaian2009,项目名称:php,代码行数:17,代码来源:FTP.php

示例4: __construct

 /**
  * __construct
  * 
  * @param string $user
  * @param string $pass
  * @param string $host
  * @param int $port
  */
 public function __construct($user = 'root', $pass = '', $host = 'localhost', $port = 21)
 {
     $host = NetworkWrapper::set($host);
     $this->_res = ftp_connect($host, $port, 10);
     ftp_login($this->_res, $user, $pass);
     ftp_pasv($this->_res, true);
     $this->_setSysType(ftp_systype($this->_res));
     // URL
     //$this->_url = 'ftp://' . $user . ':' . $pass . '@' . $host . ':' . $port;
 }
开发者ID:Halilli,项目名称:gmanager,代码行数:18,代码来源:FTP.php

示例5: connect

 public function connect()
 {
     $this->conn_id = ftp_connect($this->host, $this->port, 30);
     if ($this->conn_id === false) {
         return false;
     }
     $result = ftp_login($this->conn_id, $this->username, $this->password);
     if ($result == true) {
         ftp_set_option($this->conn_id, FTP_TIMEOUT_SEC, $this->timeout);
         if ($this->passive == true) {
             ftp_pasv($this->conn_id, true);
         } else {
             ftp_pasv($this->conn_id, false);
         }
         $this->system_type = ftp_systype($this->conn_id);
         return true;
     } else {
         return false;
     }
 }
开发者ID:brandmobility,项目名称:kikbak,代码行数:20,代码来源:ftp.class.php

示例6: __construct

 /**
  * @param $hostName
  * @param $user
  * @param $password
  * @param int $port
  * @param int $timeout
  * @throws Exceptions\RemoteConnectException
  * @throws Exceptions\RemoteLoginException
  */
 public function __construct($hostName, $user, $password, $port = 21, $timeout = 10)
 {
     $this->hostname = $hostName;
     $this->user = $user;
     $this->password = $password;
     $this->conn_id = ftp_connect($hostName, $port, $timeout);
     if (!$this->conn_id) {
         unset($this);
         throw new Exceptions\RemoteConnectException($hostName . ' is dead');
     }
     $loginResult = @ftp_login($this->conn_id, $user, $password);
     if (!$loginResult) {
         throw new RemoteLoginException();
     }
     $this->system = ftp_systype($this->conn_id);
     $this->userRoot = $this->pwd();
     if (substr($this->userRoot, -1, 1) != '/') {
         $this->userRoot .= '/';
     }
     return true;
 }
开发者ID:mahlstrom,项目名称:remote,代码行数:30,代码来源:FTP.php

示例7: connect

 public function connect()
 {
     $time_start = time();
     $this->conn_id = ftp_connect($this->host, $this->port, 20);
     if ($this->conn_id) {
         $result = ftp_login($this->conn_id, $this->username, $this->password);
     }
     if (!empty($result)) {
         ftp_set_option($this->conn_id, FTP_TIMEOUT_SEC, $this->timeout);
         ftp_pasv($this->conn_id, $this->passive);
         $this->system_type = ftp_systype($this->conn_id);
         return true;
     } elseif (time() - $time_start > 19) {
         global $updraftplus_admin;
         if (isset($updraftplus_admin->logged) && is_array($updraftplus_admin->logged)) {
             $updraftplus_admin->logged[] = sprintf(__('The %s connection timed out; if you entered the server correctly, then this is usually caused by a firewall blocking the connection - you should check with your web hosting company.', 'updraftplus'), 'FTP');
         } else {
             global $updraftplus;
             $updraftplus->log(sprintf(__('The %s connection timed out; if you entered the server correctly, then this is usually caused by a firewall blocking the connection - you should check with your web hosting company.', 'updraftplus'), 'FTP'), 'error');
         }
     }
     return false;
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:23,代码来源:ftp.class.php

示例8: isWindows

 /**
  *
  * @access	public
  * @return	@api
  */
 public function isWindows()
 {
     return 'Windows_NT' === ftp_systype($this->_conn);
 }
开发者ID:nguyen113,项目名称:Rai5,代码行数:9,代码来源:Ftp.php

示例9: getSystemType

 /**
  * get OS type
  *
  * @return string
  */
 function getSystemType()
 {
     if ($this->sysType) {
         return $this->sysType;
     }
     if ($this->checkFtp()) {
         $this->sysType = @ftp_systype($this->ftp);
     } else {
         if (!$this->FileManager->ftpHost) {
             $this->sysType = function_exists('php_uname') ? php_uname() : PHP_OS;
         }
     }
     if ($this->sysType) {
         if (!$this->FileManager->hideSystemType) {
             $this->addMsg("System type is {$this->sysType}");
         }
         return $this->sysType;
     }
     $this->addMsg('Could not get system type', 'error');
     return false;
 }
开发者ID:andreyvit,项目名称:retester,代码行数:26,代码来源:FileSystem.php

示例10: upload

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function upload(&$out)
 {
     set_time_limit(0);
     global $restore;
     global $file;
     global $file_name;
     global $folder;
     if (!$folder) {
         if (substr(php_uname(), 0, 7) == "Windows") {
             $folder = '/.';
         } else {
             $folder = '/';
         }
     } else {
         $folder = '/' . $folder;
     }
     if ($restore != '') {
         //$file=ROOT.'saverestore/'.$restore;
         $file = $restore;
     } elseif ($file != '') {
         copy($file, ROOT . 'saverestore/' . $file_name);
         //$file=ROOT.'saverestore/'.$file_name;
         $file = $file_name;
     }
     umask(0);
     @mkdir(ROOT . 'saverestore/temp', 0777);
     if ($file != '') {
         // && mkdir(ROOT.'saverestore/temp', 0777)
         chdir(ROOT . 'saverestore/temp');
         if (substr(php_uname(), 0, 7) == "Windows") {
             // for windows only
             exec(DOC_ROOT . '/gunzip ../' . $file, $output, $res);
             exec(DOC_ROOT . '/tar xvf ../' . str_replace('.tgz', '.tar', $file), $output, $res);
             //@unlink('../'.str_replace('.tgz', '.tar', $file));
         } else {
             exec('tar xzvf ../' . $file, $output, $res);
         }
         @unlink(ROOT . 'saverestore/temp' . $folder . '/config.php');
         //print_r($output);exit;
         if (1) {
             chdir('../../');
             if ($this->method == 'direct') {
                 // UPDATING FILES DIRECTLY
                 $this->copyTree(ROOT . 'saverestore/temp' . $folder, ROOT, 1);
                 // restore all files
             } elseif ($this->method == 'ftp') {
                 // UPDATING FILES BY FTP
                 $conn_id = @ftp_connect($this->config['FTP_HOST']);
                 if ($conn_id) {
                     $login_result = @ftp_login($conn_id, $this->config['FTP_USERNAME'], $this->config['FTP_PASSWORD']);
                     if ($login_result) {
                         $systyp = ftp_systype($conn_id);
                         if (@ftp_chdir($conn_id, $this->config['FTP_FOLDER'] . 'saverestore')) {
                             @ftp_chdir($conn_id, $this->config['FTP_FOLDER']);
                             // ok, we're in. updating!
                             $log = '';
                             $files = $this->getLocalFilesTree(ROOT . 'saverestore/temp' . $folder, '.+', 'installed', $log, 0);
                             $total = count($files);
                             $modules_processed = array();
                             for ($i = 0; $i < $total; $i++) {
                                 $file = $files[$i];
                                 $file['REMOTE_FILENAME'] = preg_replace('/^' . preg_quote(ROOT . 'saverestore/temp/' . $folder, '/') . '/is', $this->config['FTP_FOLDER'], $file['FILENAME']);
                                 $file['REMOTE_FILENAME'] = str_replace('//', '/', $file['REMOTE_FILENAME']);
                                 $res_f = $this->ftpput($conn_id, $file['REMOTE_FILENAME'], $file['FILENAME'], FTP_BINARY);
                                 if (preg_match('/\\.class\\.php$/', basename($file['FILENAME'])) && !$modules_processed[dirname($file['REMOTE_FILENAME'])]) {
                                     // if this a module then we should update attributes for folder and remove 'installed' file
                                     $modules_processed[dirname($file['REMOTE_FILENAME'])] = 1;
                                     @ftp_site($conn_id, "CHMOD 0777 " . dirname($file['REMOTE_FILENAME']));
                                     @ftp_delete($conn_id, dirname($file['REMOTE_FILENAME']) . '/installed');
                                 }
                             }
                         } else {
                             $out['FTP_ERR'] = 'Incorrect folder (' . $ftp_folder . ')';
                         }
                     } else {
                         $out['FTP_ERR'] = 'Incorrect username/password';
                     }
                     ftp_close($conn_id);
                 } else {
                     $out['FTP_ERR'] = 'Cannot connect to host (' . $ftp_host . ')';
                     $this->redirect("?err_msg=" . urlencode($out['FTP_ERR']));
                 }
             }
             //if (is_dir(ROOT.'saverestore/temp/'.$folder.'modules')) {
             // code restore
             $source = ROOT . 'modules';
             if ($dir = @opendir($source)) {
                 while (($file = readdir($dir)) !== false) {
                     if (Is_Dir($source . "/" . $file) && $file != '.' && $file != '..') {
                         // && !file_exists($source."/".$file."/installed")
                         @unlink(ROOT . "modules/" . $file . "/installed");
                     }
                 }
//.........这里部分代码省略.........
开发者ID:vasvlad,项目名称:majordomo,代码行数:101,代码来源:saverestore.class.php

示例11: systype

 /**
  * Facade for ftp_systype().
  *
  * @param resource $ftp_stream The ftp resource.
  *
  * @return boolean True on ftp systype.
  */
 public function systype($ftp_stream)
 {
     return ftp_systype($ftp_stream);
 }
开发者ID:zikula,项目名称:filesystem,代码行数:11,代码来源:FtpFacade.php

示例12: systype

 /**
  *
  * 返回远程 FTP 服务器的操作系统类型
  *
  * @return string
  */
 public static function systype()
 {
     return ftp_systype(self::$resource);
 }
开发者ID:luozhanhong,项目名称:share,代码行数:10,代码来源:ftp.php

示例13: job_run_archive

 /**
  * @param $job_object
  * @return bool
  */
 public function job_run_archive(BackWPup_Job $job_object)
 {
     $job_object->substeps_todo = 2 + $job_object->backup_filesize;
     if ($job_object->steps_data[$job_object->step_working]['SAVE_STEP_TRY'] != $job_object->steps_data[$job_object->step_working]['STEP_TRY']) {
         $job_object->log(sprintf(__('%d. Try to send backup file to an FTP server&#160;&hellip;', 'backwpup'), $job_object->steps_data[$job_object->step_working]['STEP_TRY']), E_USER_NOTICE);
     }
     if (!empty($job_object->job['ftpssl'])) {
         //make SSL FTP connection
         if (function_exists('ftp_ssl_connect')) {
             $ftp_conn_id = ftp_ssl_connect($job_object->job['ftphost'], $job_object->job['ftphostport'], $job_object->job['ftptimeout']);
             if ($ftp_conn_id) {
                 $job_object->log(sprintf(__('Connected via explicit SSL-FTP to server: %s', 'backwpup'), $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport']), E_USER_NOTICE);
             } else {
                 $job_object->log(sprintf(__('Cannot connect via explicit SSL-FTP to server: %s', 'backwpup'), $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport']), E_USER_ERROR);
                 return FALSE;
             }
         } else {
             $job_object->log(__('PHP function to connect with explicit SSL-FTP to server does not exist!', 'backwpup'), E_USER_ERROR);
             return TRUE;
         }
     } else {
         //make normal FTP connection if SSL not work
         $ftp_conn_id = ftp_connect($job_object->job['ftphost'], $job_object->job['ftphostport'], $job_object->job['ftptimeout']);
         if ($ftp_conn_id) {
             $job_object->log(sprintf(__('Connected to FTP server: %s', 'backwpup'), $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport']), E_USER_NOTICE);
         } else {
             $job_object->log(sprintf(__('Cannot connect to FTP server: %s', 'backwpup'), $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport']), E_USER_ERROR);
             return FALSE;
         }
     }
     //FTP Login
     $job_object->log(sprintf(__('FTP client command: %s', 'backwpup'), 'USER ' . $job_object->job['ftpuser']), E_USER_NOTICE);
     if ($loginok = @ftp_login($ftp_conn_id, $job_object->job['ftpuser'], BackWPup_Encryption::decrypt($job_object->job['ftppass']))) {
         $job_object->log(sprintf(__('FTP server response: %s', 'backwpup'), 'User ' . $job_object->job['ftpuser'] . ' logged in.'), E_USER_NOTICE);
     } else {
         //if PHP ftp login don't work use raw login
         $return = ftp_raw($ftp_conn_id, 'USER ' . $job_object->job['ftpuser']);
         $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), $return[0]), E_USER_NOTICE);
         if (substr(trim($return[0]), 0, 3) <= 400) {
             $job_object->log(sprintf(__('FTP client command: %s', 'backwpup'), 'PASS *******'), E_USER_NOTICE);
             $return = ftp_raw($ftp_conn_id, 'PASS ' . BackWPup_Encryption::decrypt($job_object->job['ftppass']));
             if (substr(trim($return[0]), 0, 3) <= 400) {
                 $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), $return[0]), E_USER_NOTICE);
                 $loginok = TRUE;
             } else {
                 $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), $return[0]), E_USER_ERROR);
             }
         }
     }
     if (!$loginok) {
         return FALSE;
     }
     //SYSTYPE
     $job_object->log(sprintf(__('FTP client command: %s', 'backwpup'), 'SYST'), E_USER_NOTICE);
     $systype = ftp_systype($ftp_conn_id);
     if ($systype) {
         $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), $systype), E_USER_NOTICE);
     } else {
         $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), __('Error getting SYSTYPE', 'backwpup')), E_USER_ERROR);
     }
     //set actual ftp dir to ftp dir
     if (empty($job_object->job['ftpdir'])) {
         $job_object->job['ftpdir'] = trailingslashit(ftp_pwd($ftp_conn_id));
     }
     // prepend actual ftp dir if relative dir
     if (substr($job_object->job['ftpdir'], 0, 1) != '/') {
         $job_object->job['ftpdir'] = trailingslashit(ftp_pwd($ftp_conn_id)) . $job_object->job['ftpdir'];
     }
     //test ftp dir and create it if not exists
     if ($job_object->job['ftpdir'] != '/') {
         @ftp_chdir($ftp_conn_id, '/');
         //go to root
         $ftpdirs = explode('/', trim($job_object->job['ftpdir'], '/'));
         foreach ($ftpdirs as $ftpdir) {
             if (empty($ftpdir)) {
                 continue;
             }
             if (!@ftp_chdir($ftp_conn_id, $ftpdir)) {
                 if (@ftp_mkdir($ftp_conn_id, $ftpdir)) {
                     $job_object->log(sprintf(__('FTP Folder "%s" created!', 'backwpup'), $ftpdir), E_USER_NOTICE);
                     ftp_chdir($ftp_conn_id, $ftpdir);
                 } else {
                     $job_object->log(sprintf(__('FTP Folder "%s" cannot be created!', 'backwpup'), $ftpdir), E_USER_ERROR);
                     return FALSE;
                 }
             }
         }
     }
     // Get the current working directory
     $current_ftp_dir = trailingslashit(ftp_pwd($ftp_conn_id));
     if ($job_object->substeps_done == 0) {
         $job_object->log(sprintf(__('FTP current folder is: %s', 'backwpup'), $current_ftp_dir), E_USER_NOTICE);
     }
     //get file size to resume upload
     @clearstatcache();
     $job_object->substeps_done = @ftp_size($ftp_conn_id, $job_object->job['ftpdir'] . $job_object->backup_file);
//.........这里部分代码省略.........
开发者ID:skinnard,项目名称:FTL-2,代码行数:101,代码来源:class-destination-ftp.php

示例14: system_type

 public function system_type()
 {
     if ($this->debug) {
         echo "Recuperation du type de systeme distant\n<br>";
     }
     if (($systype = @ftp_systype($this->connexion)) === false) {
         throw new Exception('Impossible de recuperer le type de systeme');
     }
     return $systype;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:10,代码来源:ftpclient.php

示例15: getSystemType

 public function getSystemType()
 {
     if (null === $this->_systemType) {
         $systype = @ftp_systype($this->getResource());
         $this->_systemType = self::processSystemType($systype);
     }
     return $this->_systemType;
 }
开发者ID:robeendey,项目名称:ce,代码行数:8,代码来源:Ftp.php


注:本文中的ftp_systype函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。