Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1671
Modified Files:
serendipity_admin_images.inc.php
Log Message:
Fixes (for me) an obscure bug when trying to upload an image from an URL,
which does not work at all for me, then trying to upload from the same
session an image from a file (which did not work at all before this fix,
when upload via URL was tried first).
Still needs some further debugging re the reason for this (am not reading
cvs list, please reply to me directly).
Index: serendipity_admin_images.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_images.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- serendipity_admin_images.inc.php 21 Mar 2004 16:35:31 -0000 1.16
+++ serendipity_admin_images.inc.php 22 Mar 2004 12:13:07 -0000 1.17
@@ -59,13 +59,13 @@
$file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
$newfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['GET']['newname'] . '.' . $file['extension'];
$oldfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] . '.'. $file['extension'];
- if ($serendipity['GET']['newname'] != '' && file_exists($oldfile) && !file_exists($newfile)) {
+ if ( $serendipity['GET']['newname']!= '' && file_exists($oldfile) && !file_exists($newfile) ) {
// Rename file
rename($oldfile, $newfile);
// Rename thumbnail
- rename($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'],
- $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['GET']['newname'] . '.' . $serendipity['thumbSuffix'] . '.' . $file['extension']);
+ rename( $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'],
+ $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['GET']['newname'] . '.' . $serendipity['thumbSuffix'] . '.' . $file['extension']);
serendipity_updateImageInDatabase(array('thumbnail_name' => $serendipity['thumbSuffix'], 'name' => $serendipity['GET']['newname']), $serendipity['GET']['fid']);
// Forward user to overview (we don't want the user's back button to rename things again)
@@ -96,23 +96,24 @@
<?php
// First find out whether to fetch a file or accept an upload
- $checkfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . basename($serendipity['POST']['url']);
- if ($serendipity['POST']['url'] != '' && $serendipity['POST']['url'] != 'http://') {
+ $checkfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . basename($serendipity['POST']['myurl']);
+ if ($serendipity['POST']['myurl'] != '' && $serendipity['POST']['myurl'] != 'http://') {
if (file_exists($checkfile)) {
+ print "|$checkfile|".$serendipity['POST']['myurl']."|<br />\n";
echo ERROR_FILE_EXISTS_ALREADY;
} else {
// Fetch file
- if (!$fContent = @file_get_contents($serendipity['POST']['url']) ) {
- printf(REMOTE_FILE_NOT_FOUND, $serendipity['POST']['url']);
+ if (!$fContent = @file_get_contents($serendipity['POST']['myurl']) ) {
+ printf(REMOTE_FILE_NOT_FOUND, $serendipity['POST']['myurl']);
} else {
$fp = fopen($checkfile, 'w');
fwrite($fp, $fContent);
fclose($fp);
- printf(FILE_FETCHED . '<br />', $serendipity['POST']['url']);
+ printf(FILE_FETCHED . '<br />', $serendipity['POST']['myurl']);
// Create thumbnail
- serendipity_makeThumbnail(basename($serendipity['POST']['url']));
+ serendipity_makeThumbnail(basename($serendipity['POST']['myurl']));
echo THUMB_CREATED_DONE . '<br />';
}
}
@@ -123,8 +124,6 @@
// Accept file
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $_FILES['userfile']['name'])) {
printf(FILE_UPLOADED . '<br />', $_FILES['userfile']['name']);
- @umask(0000);
- @chmod($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $_FILES['userfile']['name'], 0664);
// Create thumbnail
serendipity_makeThumbnail($_FILES['userfile']['name']);
|