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


PHP Context::getFTPConfigFile方法代码示例

本文整理汇总了PHP中Context::getFTPConfigFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getFTPConfigFile方法的具体用法?PHP Context::getFTPConfigFile怎么用?PHP Context::getFTPConfigFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Context的用法示例。


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

示例1: procInstallAdminSaveFTPInfo

 function procInstallAdminSaveFTPInfo()
 {
     $ftp_info = Context::getFTPInfo();
     $ftp_info->ftp_user = Context::get('ftp_user');
     $ftp_info->ftp_port = Context::get('ftp_port');
     $ftp_info->ftp_host = Context::get('ftp_host');
     $ftp_info->ftp_pasv = Context::get('ftp_pasv');
     if (!$ftp_info->ftp_pasv) {
         $ftp_info->ftp_pasv = "N";
     }
     $ftp_info->sftp = Context::get('sftp');
     $ftp_root_path = Context::get('ftp_root_path');
     if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/") {
         $ftp_info->ftp_root_path = $ftp_root_path;
     } else {
         $ftp_info->ftp_root_path = $ftp_root_path . '/';
     }
     if (ini_get('safe_mode')) {
         $ftp_info->ftp_password = Context::get('ftp_password');
     }
     $buff = '<?php if(!defined("__ZBXE__")) exit();' . "\n";
     foreach ($ftp_info as $key => $val) {
         if (!$val) {
             continue;
         }
         if (preg_match('/(<\\?|<\\?php|\\?>)/xsm', preg_replace('/\\s/', '', $val))) {
             continue;
         }
         $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
     }
     $buff .= "?>";
     $config_file = Context::getFTPConfigFile();
     FileHandler::WriteFile($config_file, $buff);
     if ($_SESSION['ftp_password']) {
         unset($_SESSION['ftp_password']);
     }
     $this->setMessage('success_updated');
     $this->setRedirectUrl(Context::get('error_return_url'));
 }
开发者ID:relip,项目名称:xe-core,代码行数:39,代码来源:install.admin.controller.php

示例2: procInstallFTP

 /**
  * @brief FTP 정보 등록
  **/
 function procInstallFTP()
 {
     if (Context::isInstalled()) {
         return new Object(-1, 'msg_already_installed');
     }
     $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port');
     $ftp_info->ftp_port = (int) $ftp_info->ftp_port;
     if (!$ftp_info->ftp_port) {
         $ftp_info->ftp_port = 21;
     }
     $buff = '<?php if(!defined("__ZBXE__")) exit();' . "\n";
     foreach ($ftp_info as $key => $val) {
         $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
     }
     $buff .= "?>";
     // safe_mode 일 경우
     if (ini_get('safe_mode')) {
         if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
             return new Object(-1, 'msg_safe_mode_ftp_needed');
         }
         require_once _XE_PATH_ . 'libs/ftp.class.php';
         $oFtp = new ftp();
         if (!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) {
             return new Object(-1, 'msg_ftp_not_connected');
         }
         if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_invalid_auth_info');
         }
         if (!is_dir(_XE_PATH_ . 'files') && !$oFtp->ftp_mkdir(_XE_PATH_ . 'files')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_mkdir_fail');
         }
         if (!$oFtp->ftp_site("CHMOD 777 " . _XE_PATH_ . 'files')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_chmod_fail');
         }
         if (!is_dir(_XE_PATH_ . 'files/config') && !$oFtp->ftp_mkdir(_XE_PATH_ . 'files/config')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_mkdir_fail');
         }
         if (!$oFtp->ftp_site("CHMOD 777 " . _XE_PATH_ . 'files/config')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_chmod_fail');
         }
         $oFtp->ftp_quit();
     }
     $config_file = Context::getFTPConfigFile();
     FileHandler::WriteFile($config_file, $buff);
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:53,代码来源:install.controller.php

示例3: procInstallFTP

 /**
  * @brief Set FTP Information
  */
 function procInstallFTP()
 {
     if (Context::isInstalled()) {
         return new Object(-1, 'msg_already_installed');
     }
     $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
     $ftp_info->ftp_port = (int) $ftp_info->ftp_port;
     if (!$ftp_info->ftp_port) {
         $ftp_info->ftp_port = 21;
     }
     if (!$ftp_info->ftp_host) {
         $ftp_info->ftp_host = '127.0.0.1';
     }
     if (!$ftp_info->ftp_root_path) {
         $ftp_info->ftp_root_path = '/';
     }
     $buff = array('<?php if(!defined("__XE__")) exit();');
     $buff[] = "\$ftp_info = new stdClass();";
     foreach ($ftp_info as $key => $val) {
         $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
     }
     // If safe_mode
     if (ini_get('safe_mode')) {
         if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
             return new Object(-1, 'msg_safe_mode_ftp_needed');
         }
         require_once _XE_PATH_ . 'libs/ftp.class.php';
         $oFtp = new ftp();
         if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
             return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
         }
         if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_invalid_auth_info');
         }
         if (!is_dir(_XE_PATH_ . 'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path . 'files')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_mkdir_fail');
         }
         if (!$oFtp->ftp_site("CHMOD 777 " . $ftp_info->ftp_root_path . 'files')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_chmod_fail');
         }
         if (!is_dir(_XE_PATH_ . 'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path . 'files/config')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_mkdir_fail');
         }
         if (!$oFtp->ftp_site("CHMOD 777 " . $ftp_info->ftp_root_path . 'files/config')) {
             $oFtp->ftp_quit();
             return new Object(-1, 'msg_ftp_chmod_fail');
         }
         $oFtp->ftp_quit();
     }
     FileHandler::WriteFile(Context::getFTPConfigFile(), join(PHP_EOL, $buff));
 }
开发者ID:rubythonode,项目名称:xe-core,代码行数:58,代码来源:install.controller.php

示例4: procInstallAdminSaveFTPInfo

 function procInstallAdminSaveFTPInfo()
 {
     $ftp_info = Context::getFTPInfo();
     $ftp_info->ftp_user = Context::get('ftp_user');
     $ftp_info->ftp_port = Context::get('ftp_port');
     $ftp_info->ftp_host = Context::get('ftp_host');
     $ftp_info->ftp_pasv = Context::get('ftp_pasv');
     if (!$ftp_info->ftp_pasv) {
         $ftp_info->ftp_pasv = "N";
     }
     $ftp_info->sftp = Context::get('sftp');
     $ftp_root_path = Context::get('ftp_root_path');
     if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/") {
         $ftp_info->ftp_root_path = $ftp_root_path;
     } else {
         $ftp_info->ftp_root_path = $ftp_root_path . '/';
     }
     if (ini_get('safe_mode')) {
         $ftp_info->ftp_password = Context::get('ftp_password');
     }
     $buff = '<?php if(!defined("__XE__")) exit();' . "\n\$ftp_info = new stdClass;\n";
     foreach ($ftp_info as $key => $val) {
         if (!$val) {
             continue;
         }
         if (preg_match('/(<\\?|<\\?php|\\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\\/\\*|\\*\\/|chr\\()/xsm', preg_replace('/\\s/', '', $val))) {
             continue;
         }
         $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
     }
     $buff .= "?>";
     $config_file = Context::getFTPConfigFile();
     FileHandler::WriteFile($config_file, $buff);
     if ($_SESSION['ftp_password']) {
         unset($_SESSION['ftp_password']);
     }
     $this->setMessage('success_updated');
     $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
     $this->setRedirectUrl($returnUrl);
 }
开发者ID:kkkyyy03,项目名称:coffeemix,代码行数:40,代码来源:install.admin.controller.php

示例5: procInstallAdminSaveFTPInfo

 /**
  * @brief FTP 정보 등록
  **/
 function procInstallAdminSaveFTPInfo()
 {
     $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port');
     $ftp_info->ftp_port = (int) $ftp_info->ftp_port;
     if (!$ftp_info->ftp_port) {
         $ftp_info->ftp_port = 21;
     }
     $buff = '<?php if(!defined("__ZBXE__")) exit();' . "\n";
     foreach ($ftp_info as $key => $val) {
         $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
     }
     $buff .= "?>";
     $config_file = Context::getFTPConfigFile();
     FileHandler::WriteFile($config_file, $buff);
     $this->setMessage('success_updated');
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:19,代码来源:install.admin.controller.php

示例6: isFTPRegisted

 /**
  * Check if FTP info is registered
  *
  * @return bool True: FTP information is registered, False: otherwise
  */
 function isFTPRegisted()
 {
     $ftp_config_file = Context::getFTPConfigFile();
     if (file_exists($ftp_config_file)) {
         return true;
     }
     return false;
 }
开发者ID:relip,项目名称:xe-core,代码行数:13,代码来源:Context.class.php


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