Typeframe::Redirect('Unable to connect to FTP server.', Typeframe::CurrentPage()->applicationUri(), -1); return; } if (!$ftp->login($_SESSION['typef_ftp_user'], $_SESSION['typef_ftp_pass'])) { Typeframe::Redirect('Unable to log into FTP server.', Typeframe::CurrentPage()->applicationUri(), -1); return; } $h = tmpfile(); fwrite($h, $_REQUEST['source']); if (!fflush($h)) { die("Failed to flush"); } rewind($h); // Make sure that all required directories exist $dirs = dirname("{$_REQUEST['skin']}{$_REQUEST['stylesheet']}"); $dirnames = split("/", $dirs); $localpath = TYPEF_DIR . '/skins'; $curdir = ''; for ($i = 0; $i < count($dirnames); $i++) { $curdir .= '/' . $dirnames[$i]; if (!file_exists("{$localpath}{$curdir}")) { echo "Making /skins{$curdir}<br/>"; $ftp->mkdir(TYPEF_FTP_ROOT . "/skins{$curdir}"); } } $ftp->fput(TYPEF_FTP_ROOT . "/skins/{$_REQUEST['skin']}{$_REQUEST['stylesheet']}", $h, FTP_ASCII); $ftp->close(); fclose($h); Typeframe::Redirect("Stylesheet updated.", Typeframe::CurrentPage()->applicationUri(), 1); return; }
if (!($filename_sql = $LMS->DataBaseCreate(get_conf('autobackup.db_gz', true), get_conf('autobackup.db_stats', false)))) { $filename_sql = false; } if (!$quiet) { print "Utworzono kopię bazy danych " . $filename_sql . "\n"; } if (get_conf('autobackup.db_ftpsend') && $filename_sql && $FTP->connect($ssl)) { $filename = str_replace(get_conf('directories.backup_dir') . '/', '', $filename_sql); $tmp = str_replace('.sql', '', $filename_sql); // $tmp = .' $FTP->chdir(get_conf('autobackup.db_ftppath'), true); if (!$quiet) { print "Tworze kopie bazy na FTP: " . $filename . "\n"; } $result = $FTP->upload($filename_sql, $filename, 'auto', $akcja); $FTP->close(); if (SYSLOG) { if ($result) { addlogs('lms-autobackup -> Utworzono kopię bazy ' . $filename . ' na serwerze FTP: ' . get_conf('autobackup.ftphost'), 'e=add;m=admin;'); } else { addlogs('lms-autobackup -> Nie utworzono kopii bazy ' . $filename . ' na serwerze FTP: ' . get_conf('autobackup.ftphost'), 'e=err;m=admin;'); } } } } // end if db backup /************************************************ * KATALOGI * ************************************************/ if (get_conf('autobackup.dir_ftpsend') && get_conf('autobackup.dir_local', '') != '' && $FTP->connect($ssl)) { $ftp_dirs = explode(',', get_conf('autobackup.dir_ftp'));
function ftp_delfile($file) { global $webdb; if (!$webdb[FtpHost] || !$webdb[FtpName] || !$webdb[FtpPwd] || !$webdb[FtpPort] || !$webdb[FtpDir]) { return; } require_once ROOT_PATH . "inc/ftp.php"; $ftp = new FTP($webdb[FtpHost], $webdb[FtpPort], $webdb[FtpName], $webdb[FtpPwd], $webdb[FtpDir]); $size = $ftp->size($file, 0); $ftp->delete($file); $ftp->close(); return $size; }