X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=inc%2Futils.php;h=068f6d6f185dde8a907736a5ff6331f8725efcf3;hb=80e63e12e3043d7164c35c4babd830dd969cd212;hp=a55e8794296c3ce6c90c4cc22e649b3a8077fb60;hpb=9d328be613bc25ef3f19f751bcf4de59343944c6;p=syp.git diff --git a/inc/utils.php b/inc/utils.php index a55e879..068f6d6 100644 --- a/inc/utils.php +++ b/inc/utils.php @@ -45,7 +45,7 @@ function unquote($gpc_str) { function thumb_url_from_imgpath ($filename) { if (defined ("THUMBSDIRURL") && (strlen (THUMBSDIRURL) != 0)) { - return rtrim (THUMBSDIRURL, '/') . "/_mini" . rawurlencode ($filename); + return rtrim (THUMBSDIRURL, '/') . "/mini_" . rawurlencode ($filename); } return full_url_from_path (getthumbsdir () . "/mini_" . rawurlencode ($filename)); } @@ -202,6 +202,36 @@ function safe_create_writable_dir ($dirname) { } } +function delete_from_ftp ($file) { + $ftp_conn = ftp_connect (FTPSERVER); + $login = ftp_login ($ftp_conn, FTPUSER, FTPPASS); + if ((!$ftp_conn) || (!$login)) { + server_error (); + } + $target = sprintf ("%s/%s", FTPROOTDIR, $file); + $deleted = ftp_delete ($ftp_conn, $target); + + if (!$deleted) { + server_error (); + } + ftp_close ($ftp_conn); +} + +function send_to_ftp ($file) { + $ftp_conn = ftp_connect (FTPSERVER); + $login = ftp_login ($ftp_conn, FTPUSER, FTPPASS); + if ((!$ftp_conn) || (!$login)) { + server_error (); + } + $dest = sprintf ("%s/%s", FTPROOTDIR, $file); + $upload = ftp_put ($ftp_conn, $dest, $file, FTP_BINARY); + + if (!$upload) { + server_error (); + } + ftp_close ($ftp_conn); +} + function leave () { exit ("\n"); }