tab2space cleanup
This commit is contained in:
@ -990,49 +990,49 @@ class serendipity_event_spartacus extends serendipity_event
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ftp_server = $this->get_config('ftp_server');
|
$ftp_server = $this->get_config('ftp_server');
|
||||||
$ftp_user_name = $this->get_config('ftp_username');
|
$ftp_user_name = $this->get_config('ftp_username');
|
||||||
$ftp_user_pass = $this->get_config('ftp_password');
|
$ftp_user_pass = $this->get_config('ftp_password');
|
||||||
$basedir = $this->get_config('ftp_basedir');
|
$basedir = $this->get_config('ftp_basedir');
|
||||||
$dir_rules = intval($this->get_config('chmod_dir'), 8);
|
$dir_rules = intval($this->get_config('chmod_dir'), 8);
|
||||||
|
|
||||||
if (empty($ftp_server) || empty($ftp_user_name)) {
|
if (empty($ftp_server) || empty($ftp_user_name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = str_replace($serendipity['serendipityPath'],"",$dir);
|
$dir = str_replace($serendipity['serendipityPath'],"",$dir);
|
||||||
|
|
||||||
// set up basic connection and log in with username and password
|
// set up basic connection and log in with username and password
|
||||||
$conn_id = ftp_connect($ftp_server);
|
$conn_id = ftp_connect($ftp_server);
|
||||||
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
|
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
|
||||||
|
|
||||||
// check connection
|
// check connection
|
||||||
if ((!$conn_id) || (!$login_result)) {
|
if ((!$conn_id) || (!$login_result)) {
|
||||||
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_CONNECT);
|
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_CONNECT);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$paths = preg_split('@/@', $basedir.$dir,-1,PREG_SPLIT_NO_EMPTY);
|
$paths = preg_split('@/@', $basedir.$dir,-1,PREG_SPLIT_NO_EMPTY);
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
// trying to change directory, if not succesfull, it means
|
// trying to change directory, if not succesfull, it means
|
||||||
// the directory does not exist and we must create it
|
// the directory does not exist and we must create it
|
||||||
if (!ftp_chdir($conn_id,$path)) {
|
if (!ftp_chdir($conn_id,$path)) {
|
||||||
if (!ftp_mkdir($conn_id,$path)) {
|
if (!ftp_mkdir($conn_id,$path)) {
|
||||||
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_MKDIR);
|
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_MKDIR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ftp_chmod($conn_id,$dir_rules,$path)) {
|
if (!ftp_chmod($conn_id,$dir_rules,$path)) {
|
||||||
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_CHMOD);
|
$this->outputMSG('error',PLUGIN_EVENT_SPARTACUS_FTP_ERROR_CHMOD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ftp_chdir($conn_id,$path)) {
|
if (!ftp_chdir($conn_id,$path)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->outputMSG('success',sprintf(PLUGIN_EVENT_SPARTACUS_FTP_SUCCESS, $path));
|
$this->outputMSG('success',sprintf(PLUGIN_EVENT_SPARTACUS_FTP_SUCCESS, $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ftp_close($conn_id);
|
ftp_close($conn_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function event_hook($event, &$bag, &$eventData, $addData = null) {
|
function event_hook($event, &$bag, &$eventData, $addData = null) {
|
||||||
|
Reference in New Issue
Block a user