public static function FTP_CheckDir($dir) { $conn_id = gpFiles::FTPConnect(); $dir = gpFiles::ftpLocation($dir); if (!ftp_mkdir($conn_id, $dir)) { return false; } return ftp_site($conn_id, 'CHMOD 0777 ' . $dir); }
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; }