コード例 #1
0
ファイル: FileSystemFtp.php プロジェクト: VTAMAGNO/gpEasy-CMS
 public function get_base_dir()
 {
     global $dataDir;
     if (is_null($this->ftp_root)) {
         $this->ftp_root = \gpftp::GetFTPRoot($this->conn_id, $dataDir);
         $this->ftp_root = rtrim($this->ftp_root, '/');
     }
     return $this->ftp_root;
 }
コード例 #2
0
ファイル: install.php プロジェクト: stegrams/Typesetter
 /**
  * Establish an FTP connection to be used by the installer
  * todo: remove $install_ftp_connection globabl
  */
 function FTPConnection()
 {
     global $dataDir, $langmessage, $install_ftp_connection;
     //test for functions
     if (!function_exists('ftp_connect')) {
         echo '<li>';
         echo '<span class="failed">';
         echo $langmessage['FTP_UNAVAILABLE'];
         echo '</span>';
         echo '</li>';
         return false;
     }
     //Try to connect
     echo '<li>';
     $install_ftp_connection = @ftp_connect($_POST['ftp_server'], 21, 6);
     if (!$install_ftp_connection) {
         echo '<span class="failed">';
         echo sprintf($langmessage['FAILED_TO_CONNECT'], '<em>' . htmlspecialchars($_POST['ftp_server']) . '</em>');
         echo '</span>';
         echo '</li>';
         return false;
     }
     echo '<span class="passed">';
     echo sprintf($langmessage['CONNECTED_TO'], '<em>' . htmlspecialchars($_POST['ftp_server']) . '</em>');
     echo '</span></li>';
     //Log in
     echo '<li>';
     $login_result = @ftp_login($install_ftp_connection, $_POST['ftp_user'], $_POST['ftp_pass']);
     if (!$login_result) {
         echo '<span class="failed">';
         echo sprintf($langmessage['NOT_LOOGED_IN'], '<em>' . htmlspecialchars($_POST['ftp_user']) . '</em>');
         echo '</span></li>';
         return false;
     }
     echo '<span class="passed">';
     echo sprintf($langmessage['LOGGED_IN'], '<em>' . htmlspecialchars($_POST['ftp_user']) . '</em>');
     echo '</span></li>';
     //Get FTP Root
     echo '<li>';
     if ($login_result) {
         $this->ftp_root = gpftp::GetFTPRoot($install_ftp_connection, $dataDir);
     }
     if (!$this->ftp_root) {
         echo '<span class="failed">';
         echo $langmessage['ROOT_DIRECTORY_NOT_FOUND'];
         echo '</span>';
         echo '</li>';
         return false;
     }
     echo '<span class="passed">';
     echo sprintf($langmessage['FTP_ROOT'], '<em>' . $this->ftp_root . '</em>');
     echo '</span></li>';
     return true;
 }
コード例 #3
0
ファイル: FileSystem.php プロジェクト: GedionChang/gpEasy-CMS
 function get_base_dir()
 {
     global $dataDir;
     if ($this->ftp_root === false) {
         $this->ftp_root = gpftp::GetFTPRoot($this->conn_id, $dataDir);
         $this->ftp_root = rtrim($this->ftp_root, '/');
     }
     return $this->ftp_root;
 }
コード例 #4
0
ファイル: SetupSite.php プロジェクト: rizub4u/gpEasy-CMS
 function MakeDir($parent, $new_name)
 {
     global $config, $langmessage;
     $langmessage['not_created'] = 'Oops, the folder could not be created. ';
     $langmessage['not_created'] .= 'You may still be able to create it by doing one of the following: ';
     $langmessage['not_created'] .= '<ul>';
     $langmessage['not_created'] .= '<li>Make the parent folder writable by changing it\'s permissions.</li>';
     $langmessage['not_created'] .= '<li>Supply your server\'s <a href="%s">ftp information</a> to this plugin.</li>';
     $langmessage['not_created'] .= '</ul>';
     $langmessage['not_created'] = sprintf($langmessage['not_created'], common::GetUrl('Admin_Site_Setup', 'cmd=settings'));
     $new_folder = $parent . '/' . $new_name;
     if (mkdir($new_folder, 0755)) {
         chmod($new_folder, 0755);
         //some systems need more than just the 0755 in the mkdir() function
         return true;
     }
     if (empty($config['ftp_server'])) {
         message($langmessage['not_created']);
         return false;
     }
     $conn_id = gpFiles::FTPConnect();
     if (!$conn_id) {
         message($langmessage['not_created'] . ' (FTP Connection Failed)');
         return false;
     }
     $ftp_parent = gpftp::GetFTPRoot($conn_id, $parent);
     if (!$ftp_parent) {
         message('Oops, could not find the ftp location of <i>' . $parent . '</i> using the current ftp login.');
         return false;
     }
     $ftp_destination = $ftp_parent . '/' . $new_name;
     if (!ftp_mkdir($conn_id, $ftp_destination)) {
         message('Oops, could not create the folder using the current ftp login.');
         return false;
     }
     ftp_site($conn_id, 'CHMOD 0755 ' . $ftp_destination);
     return true;
 }