Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32277
Modified Files:
NEWS serendipity_admin_image_selector.php
serendipity_admin_images.inc.php serendipity_config.inc.php
serendipity_entries.php serendipity_functions_images.inc.php
Log Message:
Upgraded image manager: Manage/upload to/sync/browse subdirectories.
Accept non-image files.
DB Layout upgrade needed!
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- serendipity_config.inc.php 24 May 2004 10:42:53 -0000 1.74
+++ serendipity_config.inc.php 25 May 2004 16:16:14 -0000 1.75
@@ -12,7 +12,7 @@
}
include_once(S9Y_INCLUDE_PATH . 'compat.php');
-$serendipity['version'] = '0.6.2-CVS';
+$serendipity['version'] = '0.6.3-CVS';
$serendipity['production'] = 1;
$serendipity['rewrite'] = 'none';
$serendipity['messagestack'] = array();
Index: serendipity_entries.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_entries.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- serendipity_entries.php 19 May 2004 21:37:27 -0000 1.31
+++ serendipity_entries.php 25 May 2004 16:16:14 -0000 1.32
@@ -69,6 +69,9 @@
<div class="serendipitySideBarContent">
• <a href="?serendipity[adminModule]=images&serendipity[adminAction]=addSelect"><?php echo ADD_IMAGES; ?></a><br />
• <a href="?serendipity[adminModule]=images"><?php echo MANAGE_IMAGES; ?></a><br />
+ <?php if ($serendipity['serendipityUserlevel'] >= USERLEVEL_CHIEF) { ?>
+ • <a href="?serendipity[adminModule]=images&serendipity[adminAction]=directorySelect"><?php echo MANAGE_DIRECTORIES; ?></a><br />
+ <?php } ?>
• <a href="?serendipity[adminModule]=images&serendipity[adminAction]=sync" onclick="return confirm('<?php echo WARNING_THIS_BLAHBLAH; ?>');"><?php echo CREATE_THUMBS; ?></a><br />
</div>
</div>
Index: serendipity_functions_images.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions_images.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- serendipity_functions_images.inc.php 19 May 2004 21:22:11 -0000 1.11
+++ serendipity_functions_images.inc.php 25 May 2004 16:16:14 -0000 1.12
@@ -1,29 +1,39 @@
<?php # $Id$
-
/**
* Get a list of images
**/
-function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total, $order = false, $ordermode = false) {
+function serendipity_fetchImagesFromDatabase($start=0, $limit=0, &$total, $order = false, $ordermode = false, $directory = '') {
global $serendipity;
-
+
if (empty($order)) {
$order = 'date';
}
-
+
if (empty($ordermode)) {
$ordermode = 'DESC';
}
- $rs = serendipity_db_query("SELECT i.*, a.username AS authorname FROM {$serendipity['dbPrefix']}images AS i LEFT OUTER JOIN {$serendipity['dbPrefix']}authors AS a on i.authorid = a.authorid ORDER BY $order $ordermode", false, 'assoc');
+ if ($limit != 0) {
+ $limitsql = serendipity_db_limit_sql(serendipity_db_limit($start, $limit));
+ }
+
+ if (!empty($directory)) {
+ $directorysql = ' WHERE path LIKE \'' . serendipity_db_escape_string($directory) . '%\' ';
+ }
+
+ $query = "SELECT i.*, a.username AS authorname FROM {$serendipity['dbPrefix']}images AS i LEFT OUTER JOIN {$serendipity['dbPrefix']}authors AS a ON i.authorid = a.authorid $directorysql ORDER BY $order $ordermode $limitsql";
+ $rs = serendipity_db_query($query, false, 'assoc');
if (!is_array($rs)) {
return array();
}
- $total = sizeof($rs)+1;
- if ($limit > 0) {
- $rs = @array_slice($rs, $start, $limit);
+ $total_query = "SELECT count(i.id) FROM {$serendipity['dbPrefix']}images AS i LEFT OUTER JOIN {$serendipity['dbPrefix']}authors AS a on i.authorid = a.authorid";
+ $total_rs = serendipity_db_query($total_query, true, 'num');
+ if (is_array($total_rs)) {
+ $total = $total_rs[0];
}
+
return $rs;
}
@@ -40,11 +50,11 @@
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
$admin = ' AND (authorid = ' . $serendipity['authorid'] . ' OR authorid = 0)';
}
-
+
$i=0;
if (sizeof($updates) > 0) {
foreach ($updates as $k => $v) {
- $q[] = $k ." = '". $v ."'";
+ $q[] = $k ." = '" . $v . "'";
}
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}images SET ". implode($q, ',') ." WHERE id = $id $admin");
$i++;
@@ -54,9 +64,9 @@
function serendipity_deleteImage($id) {
global $serendipity;
- $file = serendipity_fetchImageFromDatabase($id);
- $dFile = $file['name'] .'.'. $file['extension'];
- $dThumb = $file['name'] .'.'. $file['thumbnail_name'] .'.'. $file['extension'];
+ $file = serendipity_fetchImageFromDatabase($id);
+ $dFile = $file['path'] . $file['name'] .'.'. $file['extension'];
+ $dThumb = $file['path'] . $file['name'] .'.'. $file['thumbnail_name'] .'.'. $file['extension'];
$admin = '';
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF && $file['authorid'] != '0' && $file['authorid'] != $serendipity['authorid']) {
@@ -83,15 +93,24 @@
/**
* Get a list of images
**/
-function serendipity_fetchImages($group = false, $start = 0, $end = 20) {
+function serendipity_fetchImages($group = false, $start = 0, $end = 20, $images = '', $odir = '') {
global $serendipity;
// Open directory
+ $basedir = $serendipity['serendipityPath'] . $serendipity['uploadPath'];
$images = array();
- if ($dir = @opendir($serendipity['serendipityPath'] . $serendipity['uploadPath'])) {
+ if ($dir = @opendir($basedir . $odir)) {
while(false !== ($f = readdir($dir))) {
if ($f != '.' && $f != '..' && strpos($f, $serendipity['thumbSuffix']) === false) {
- array_push($images, $f);
+ $cdir = ($odir != '' ? $odir . DIRECTORY_SEPARATOR : '');
+ if (is_dir($basedir . $odir . DIRECTORY_SEPARATOR . $f)) {
+ $temp = serendipity_fetchImages($group, $start, $end, $images, $cdir . $f);
+ foreach($temp AS $tkey => $tval) {
+ array_push($images, $tval);
+ }
+ } else {
+ array_push($images, $cdir . $f);
+ }
}
}
}
@@ -100,14 +119,60 @@
/* BC */
$serendipity['imageList'] = $images;
return $images;
-
}
-function serendipity_insertImageInDatabase($filename, $extension, $mimetype, $filesize, $width, $height, $thumbnail, $date, $authorid) {
+function serendipity_insertImageInDatabase($filename, $extension, $mimetype, $filesize, $width, $height, $thumbnail, $date, $authorid, $directory) {
global $serendipity;
- $sql = serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}images
- (name, extension, mime, size, dimensions_width, dimensions_height, thumbnail_name, date, authorid)
- VALUES('". $filename ."', '". $extension ."', '". $mimetype ."', ". $filesize .", ". $width.", ". $height .", '". $thumbnail ."', ". $date .", " . $authorid . ")");
+
+ if (empty($width)) {
+ $width = 0;
+ }
+
+ if (empty($height)) {
+ $height = 0;
+ }
+
+ $query = sprintf(
+ "INSERT INTO {$serendipity['dbPrefix']}images (
+ name,
+ extension,
+ mime,
+ size,
+ dimensions_width,
+ dimensions_height,
+ thumbnail_name,
+ date,
+ authorid,
+ path
+ ) VALUES (
+ '%s',
+ '%s',
+ '%s',
+ %s,
+ %s,
+ %s,
+ '%s',
+ %s,
+ %s,
+ '%s'
+ )",
+ serendipity_db_escape_string($filename),
+ serendipity_db_escape_string($extension),
+ serendipity_db_escape_string($mimetype),
+ serendipity_db_escape_string($filesize),
+ serendipity_db_escape_string($width),
+ serendipity_db_escape_string($height),
+ serendipity_db_escape_string($thumbnail),
+ serendipity_db_escape_string($date),
+ serendipity_db_escape_string($authorid),
+ serendipity_db_escape_string($directory)
+ );
+
+ $sql = serendipity_db_query($query);
+ if (is_string($sql)) {
+ echo $query . '<br />';
+ echo $sql . '<br />';
+ }
return true;
}
@@ -115,7 +180,7 @@
/**
* Generate a thumbnail
**/
-function serendipity_makeThumbnail($file, $size=false, $authorid='0') {
+function serendipity_makeThumbnail($file, $size = false, $authorid = '0', $directory = '', $insertMode = true) {
global $serendipity;
if ($size === false) {
@@ -123,31 +188,43 @@
}
// Calculate name of thumbnail
- $t = serendipity_parseFileName($file);
- $f = $t[0];
+ $t = serendipity_parseFileName($file);
+ $f = $t[0];
$suf = $t[1];
- $infile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file;
- $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $f . '.' . $serendipity['thumbSuffix'] . '.' . $suf;
- $fdim = getimagesize($infile);
-
- if (!isset($fdim['mime'])) {
- $fdim['mime'] = serendipity_guessMime($infile);
- }
+ $infile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $directory . $file;
+ $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $directory . $f . '.' . $serendipity['thumbSuffix'] . '.' . $suf;
+ $fdim = @getimagesize($infile);
- if ($serendipity['magick'] !== true) {
- $r = serendipity_resize_image_gd($infile, $outfile, $size);
+ if (!is_array($fdim)) {
+ // The file is no image.
+ $fdim = array(
+ 0 => 0,
+ 1 => 0,
+ 'mime' => serendipity_guessMime($suf)
+ );
+ $r = array(0, 0);
} else {
- /*if ($serendipity["dim"] == "height") $newSize = "*x".$serendipity["thumbSize"];
- else $newSize = $serendipity["thumbSize"]."x*"; */
- $newSize = $size . 'x' . $size;
- $r = array($size, $size);
- $cmd = $serendipity['convert'] . " -antialias -scale $newSize $infile $outfile 2>&1";
- $res = `$cmd`;
+ if (!isset($fdim['mime'])) {
+ $fdim['mime'] = serendipity_guessMime($suf);
+ }
+
+ if ($serendipity['magick'] !== true) {
+ $r = serendipity_resize_image_gd($infile, $outfile, $size);
+ } else {
+ /*if ($serendipity["dim"] == "height") $newSize = "*x".$serendipity["thumbSize"];
+ else $newSize = $serendipity["thumbSize"]."x*"; */
+ $newSize = $size . 'x' . $size;
+ $r = array($size, $size);
+ $cmd = $serendipity['convert'] . " -antialias -scale $newSize $infile $outfile 2>&1";
+ $res = `$cmd`;
+ }
}
/* Lets assume we are all done, now we add the image to the image database */
- serendipity_insertImageInDatabase($f, $suf, $fdim['mime'], filesize($infile), $fdim[0], $fdim[1], $serendipity['thumbSuffix'], time(), $authorid);
+ if ($insertMode) {
+ serendipity_insertImageInDatabase($f, $suf, $fdim['mime'], filesize($infile), $fdim[0], $fdim[1], $serendipity['thumbSuffix'], time(), $authorid, $directory);
+ }
return $r;
}
@@ -157,7 +234,7 @@
**/
function serendipity_scaleImg($id, $width, $height) {
global $serendipity;
-
+
$file = serendipity_fetchImageFromDatabase($id);
$admin = '';
@@ -166,7 +243,7 @@
return;
}
- $infile = $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] .'.'. $file['extension'];
+ $infile = $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['extension'];
if ($serendipity['magick'] !== true) {
serendipity_resize_image_gd($infile, $outfile, $width, $height);
@@ -187,24 +264,50 @@
$i=0;
$serendipity['imageList'] = serendipity_fetchImagesFromDatabase(0, 0, $total);
-
+
foreach ($serendipity['imageList'] as $k => $file) {
- $filename = $file['name'] .'.'. $file['extension'];
- $ffull = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $filename;
- $fdim = @getimagesize($ffull);
- $oldThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] .'.'. $file['thumbnail_name'] .'.'. $file['extension'];
- $newThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] .'.'. $serendipity['thumbSuffix'] .'.'. $file['extension'];
+ $is_image = (preg_match('@^image/@i', $file['mime']) ? true : false);
- if (!file_exists($oldThumb) && !file_exists($newThumb) && ($fdim[0] > $serendipity['thumbSize'] || $fdim[1] > $serendipity['thumbSize'])) {
- printf(RESIZE_BLAHBLAH, $filename . ': ' . serendipity_makeThumbnail($filename, false, $file['authorid']));
- $i++;
- } elseif (!file_exists($oldThumb) && !file_exists($newThumb) && $fdim[0] < $serendipity['thumbSize'] && $fdim[1] < $serendipity['thumbSize']) {
- $res = copy ($ffull, $newThumb);
- if (@$res === true) {
- printf(THUMBNAIL_USING_OWN . '<br />', $filename);
- } else {
- printf('<span style="color: #ff0000">' . THUMBNAIL_FAILED_COPY . '</span><br />', $filename);
+ if ($is_image) {
+ $update = false;
+ $filename = $file['path'] . $file['name'] .'.'. $file['extension'];
+ $ffull = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $filename;
+
+ if (empty($file['thumbnail_name'])) {
+ $file['thumbnail_name'] = $serendipity['thumbSuffix'];
+ }
+
+ $oldThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $newThumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $serendipity['thumbSuffix'] . '.' . $file['extension'];
+ $fdim = @getimagesize($ffull);
+
+ if (!file_exists($oldThumb) && !file_exists($newThumb) && ($fdim[0] > $serendipity['thumbSize'] || $fdim[1] > $serendipity['thumbSize'])) {
+ $returnsize = serendipity_makeThumbnail($filename, false, $file['authorid'], '', false);
+ printf(RESIZE_BLAHBLAH, $filename . ': ' . $returnsize[0] . 'x' . $returnsize[1]);
+ if (!file_exists($newThumb)) {
+ printf('<span style="color: #ff0000">' . THUMBNAIL_FAILED_COPY . '</span><br />', $filename);
+ } else {
+ $update = true;
+ }
+ } elseif (!file_exists($oldThumb) && !file_exists($newThumb) && $fdim[0] <= $serendipity['thumbSize'] && $fdim[1] <= $serendipity['thumbSize']) {
+ $res = @copy($ffull, $newThumb);
+ if (@$res === true) {
+ printf(THUMBNAIL_USING_OWN . '<br />', $filename);
+ $update = true;
+ } else {
+ printf('<span style="color: #ff0000">' . THUMBNAIL_FAILED_COPY . '</span><br />', $filename);
+ }
+ }
+
+ if ($update) {
+ $i++;
+ $updates = array(
+ 'thumbnail_name' => $serendipity['thumbSuffix']
+ );
+ serendipity_updateImageInDatabase($updates, $file['id']);
}
+ } else {
+ // Currently, non-image files have no thumbnail.
}
}
@@ -212,7 +315,88 @@
}
function serendipity_guessMIME($extension) {
- switch ($extension) {
+ $mime = '';
+ switch (strtolower($extension)) {
+ case 'pdf':
+ $mime = 'application/pdf';
+ break;
+
+ case 'doc':
+ $mime = 'application/msword';
+ break;
+
+ case 'rtf':
+ $mime = 'application/rtf';
+ break;
+
+ case 'wav':
+ case 'wave':
+ $mime = 'audio/x-wav';
+ break;
+
+ case 'mpg':
+ case 'mpeg':
+ $mime = 'video/x-mpeg';
+ break;
+
+ case 'avi':
+ $mime = 'video/x-msvideo';
+ break;
+
+ case 'mp3':
+ $mime = 'audio/x-mpeg3';
+ break;
+
+ case 'xls':
+ case 'xlt':
+ $mime = 'application/vnd.ms-excel';
+ break;
+
+ case 'ppt':
+ case 'pps':
+ $mime = 'application/vnd.ms-powerpoint';
+ break;
+
+ case 'html':
+ case 'htm':
+ $mime = 'text/html';
+ break;
+
+ case 'zip':
+ $mime = 'application/zip';
+ break;
+
+ case 'tar':
+ $mime = 'application/x-tar';
+ break;
+
+ case 'tgz':
+ case 'gz':
+ $mime = 'application/x-gzip';
+ break;
+
+ case 'swf':
+ $mime = 'application/x-shockwave-flash';
+ break;
+
+ case 'ra':
+ case 'ram':
+ $mime = 'application/vnd.rn-realaudio';
+ break;
+
+ case 'exe':
+ $mime = 'application/octet-stream';
+ break;
+
+ case 'mov':
+ case 'qt':
+ $mime = 'video/x-quicktime';
+ break;
+
+ case 'midi':
+ case 'mid':
+ $mime = 'audio/x-midi';
+ break;
}
return $mime;
@@ -226,49 +410,72 @@
$i=0;
$files = serendipity_fetchImages();
+
$fcount = count($files);
for ($x = 0; $x < $fcount; $x++) {
$update = $q = array();
$f = serendipity_parseFileName($files[$x]);
+ if (empty($f[1]) || $f[1] == $files[$x]) {
+ // No extension means bad file most probably. Skip it.
+ printf(SKIPPING_FILE_EXTENSION . '<br />', $files[$x]);
+ continue;
+ }
+
$ffull = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $files[$x];
$fthumb = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $f[0] . '.' . $serendipity['thumbSuffix'] . '.' . $f[1];
+ $fbase = basename($f[0]);
+ $fdir = dirname($f[0]) . DIRECTORY_SEPARATOR;
+ if ($fdir == '.' . DIRECTORY_SEPARATOR) {
+ $fdir = '';
+ }
+
+ if (!is_readable($ffull) || filesize($ffull) == 0) {
+ printf(SKIPPING_FILE_UNREADABLE . '<br />', $files[$x]);
+ continue;
+ }
+
$fdim = getimagesize($ffull);
if (!isset($fdim['mime'])) {
$fdim['mime'] = serendipity_guessMime($f[1]);
}
-
- $rs = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}images
- WHERE name = '$f[0]'
+
+ $rs = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}images
+ WHERE name = '" . serendipity_db_escape_string($fbase) . "'
+ " . ($fdir != '' ? "AND path = '$fdir'" : '') . "
AND mime = '$fdim[mime]'", true, 'assoc');
if (is_array($rs)) {
- $checkfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $rs['name'] . '.' . $rs['thumbnail_name'] . '.' . $rs['extension'];
- if ($rs['dimensions_width'] != $fdim[0]) {
+ $update = array();
+ $checkfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $rs['path'] . $rs['name'] . '.' . $rs['thumbnail_name'] . '.' . $rs['extension'];
+ if (isset($fdim[0]) && $rs['dimensions_width'] != $fdim[0]) {
$update['dimensions_width'] = $fdim[0];
}
-
- if ($rs['dimensions_height'] != $fdim[1]) {
+
+ if (isset($fdim[1]) && $rs['dimensions_height'] != $fdim[1]) {
$update['dimensions_height'] = $fdim[1];
}
-
+
if ($rs['size'] != filesize($ffull)) {
$update['size'] = filesize($ffull);
}
-
+
if (!file_exists($checkfile) && file_exists($fthumb)) {
$update['thumbnail_name'] = $serendipity['thumbSuffix'];
}
/* Do the database update, if needed */
- serendipity_updateImageInDatabase($update, $rs['id']);
- if (sizeof($update) != 0) {
- $i++;
+ if (sizeof($update) != 0) {
+ printf(FOUND_FILE . '<br />', $files[$x]);
+ serendipity_updateImageInDatabase($update, $rs['id']);
+ $i++;
}
} else {
if (file_exists($fthumb)) {
$thumbnail = $serendipity['thumbSuffix'];
}
- serendipity_insertImageInDatabase($f[0], $f[1], $fdim['mime'], filesize($ffull), $fdim[0], $fdim[1], $thumbnail, filemtime($ffull), '0');
+
+ printf(FOUND_FILE . '<br />', $files[$x]);
+ serendipity_insertImageInDatabase($fbase, $f[1], $fdim['mime'], filesize($ffull), $fdim[0], $fdim[1], $thumbnail, filemtime($ffull), '0', $fdir);
$i++;
}
}
@@ -321,7 +528,7 @@
$in = $loadfn($infilename);
$width = imagesx($in);
$height = imagesy($in);
-
+
if (is_null($newheight)) {
// calculate aspect ratio
$div_width = $width / $newwidth;
@@ -358,16 +565,17 @@
$end,
$totalImages,
(isset($serendipity['GET']['order']) ? $serendipity['GET']['order'] : false),
- (isset($serendipity['GET']['ordermode']) ? $serendipity['GET']['ordermode'] : false)
+ (isset($serendipity['GET']['ordermode']) ? $serendipity['GET']['ordermode'] : false),
+ (isset($serendipity['GET']['only_path']) ? $serendipity['GET']['only_path'] : '')
);
-
+
$inc = $end - $start;
-
+
$extraParems = '';
if (isset($serendipity['GET']['adminModule'])) {
$extraParems = 'serendipity[adminModule]='. $serendipity['GET']['adminModule'] .'&';
}
-
+
if (isset($serendipity['GET']['order'])) {
$extraParems .= 'serendipity[order]='. $serendipity['GET']['order'] .'&';
}
@@ -376,6 +584,10 @@
$extraParems .= 'serendipity[ordermode]='. $serendipity['GET']['ordermode'] .'&';
}
+ if (isset($serendipity['GET']['only_path'])) {
+ serendipity_uploadSecure($serendipity['GET']['only_path'], true);
+ }
+
$left = '<input type="button" value="<<<" onclick="location.href=\'?'. $extraParems .'serendipity[start]=' . ($start-$end) . '\';" '. (($start <= 0) ? 'disabled' : '') .'>' . "\n";
$right = '<input type="button" value=">>>" onclick="location.href=\'?'. $extraParems .'serendipity[start]=' . ($start+$end) . '\';" '. (($totalImages < $start+$end) ? 'disabled' : '') .'>' . "\n";
@@ -398,6 +610,17 @@
$sort .= '<option value="' . $so_key . '" ' . (isset($serendipity['GET']['order']) && $serendipity['GET']['order'] == $so_key ? 'selected="selected"' : '') . '>' . $so_val . '</option>';
}
+ serendipity_traversePath(
+ $paths,
+ $serendipity['serendipityPath'] . $serendipity['uploadPath'],
+ '',
+ '',
+ false,
+ '',
+ 2,
+ 0,
+ (isset($serendipity['GET']['only_path']) ? $serendipity['GET']['only_path'] : '')
+ );
$sort .= '</select><select name="serendipity[ordermode]">'
. '<option value="DESC" ' . (isset($serendipity['GET']['ordermode']) && $serendipity['GET']['ordermode'] == 'DESC' ? 'selected="selected"' : '') . '>' . SORT_ORDER_DESC . '</option>'
. '<option value="ASC" ' . (isset($serendipity['GET']['ordermode']) && $serendipity['GET']['ordermode'] == 'ASC' ? 'selected="selected"' : '') . '>' . SORT_ORDER_ASC . '</option>'
@@ -408,8 +631,12 @@
. '<option value="50" ' . (isset($serendipity['GET']['end']) && $serendipity['GET']['end'] == 50 ? 'selected="selected"' : '') . '>50 ' . IMAGES_PER_PAGE . '</option>'
. '<option value="100" ' . (isset($serendipity['GET']['end']) && $serendipity['GET']['end'] == 100 ? 'selected="selected"' : '') . '>100 ' . IMAGES_PER_PAGE . '</option>'
. '</select>'
+ . '<select name="serendipity[only_path]">'
+ . '<option value="">' . ALL_DIRECTORIES . '</option>'
+ . $paths
+ . '</select>'
. '<input type="submit" name="go" value="' . GO . ' " /></form>';
-
+
if (is_null($lineBreak)) {
$lineBreak = floor(750 / ($serendipity['thumbSize'] + 20));
}
@@ -424,7 +651,7 @@
<?php echo $right; ?>
</td>
</tr>
-
+
<tr>
<td align="center" class="serendipity_admin_filters" colspan="<?php echo $lineBreak; ?>"><?php echo $sort; ?></td>
</tr>
@@ -434,31 +661,45 @@
$x = 0;
foreach ($serendipity['imageList'] as $k => $file) {
++$x; $preview = '';
- $i = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . '/' . $file['name'] .'.'. $file['thumbnail_name'] .'.'. $file['extension']);
- $imgsrc = $serendipity['uploadHTTPPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $i = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension']);
+ $imgsrc = $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $is_image = (preg_match('@^image/@i', $file['mime']) ? true : false);
if (file_exists($imgsrc)) {
$preview .= '<img src="' . $imgsrc . '" border="0" alt="'. $file['name'] . '" />';
- if ($url) { $preview = '<a href="'.$url.'&serendipity[image]='. $file['id'] .'">'. $preview .'</a>'; }
+ if ($url) { $preview = '<a href="'. $url .'&serendipity[image]='. $file['id'] .'">'. $preview .'</a>'; }
+ }
+
+ if (!$is_image) {
+ $preview .= '<div class="serendipity_admin_mimetype" style="width: ' . $serendipity['thumbSize'] . 'px; height: ' . $serendipity['thumbSize'] . 'px; border: 1px solid; text-align: center;"><br /><br /><br />' . $file['mime'];
+ if ($url) { $preview .= '<br /><a href="' . $url . '&serendipity[image]=' . $file['id'] . '">' . $file['name'] . '.' . $file['extension'] . '</a>'; }
+ $preview .= '</div>';
}
?>
<td nowrap="nowrap" align="center" valign="bottom" <?php echo ($manage) ? 'style="border-bottom: 1px solid #000000"' : '' ?>>
-<?php
+<?php
echo $preview;
- if ($manage) {
+ if ($manage) {
?>
<div align="center"><?php echo $file['name'] . '.' . $file['extension']; ?> <sub>(<?php echo ($file['authorid'] == '0' ? ALL_AUTHORS : $file['authorname']); ?>)</sub></div>
<table border="0" width="300">
<tr>
- <td valign="middle"><font size="1">
- <?php echo ORIGINAL_SHORT . ': ' . $file['dimensions_width'] . 'x' . $file['dimensions_height']; ?><br />
- <?php echo THUMBNAIL_SHORT . ': ' . $i[0] . 'x' . $i[1]; ?></font></td>
+ <td valign="middle" style="font-size: x-small">
+<?php
+ if ($is_image) {
+ echo ORIGINAL_SHORT . ': ' . $file['dimensions_width'] . 'x' . $file['dimensions_height'] . '<br />';
+ echo THUMBNAIL_SHORT . ': ' . $i[0] . 'x' . $i[1];
+ } else {
+ echo SORT_ORDER_SIZE . ': ' . number_format(round($file['size']/1024, 2), NUMBER_FORMAT_DECIMALS, NUMBER_FORMAT_DECPOINT, NUMBER_FORMAT_THOUSANDS) . 'kb';
+ }
+?>
+ </td>
<?php
if ($serendipity['authorid'] == $file['authorid'] || $file['authorid'] == '0' || $serendipity['serendipityUserlevel'] >= USERLEVEL_CHIEF) {
?>
- <td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_FULLSIZE; ?>" alt="<?php echo IMAGE_FULLSIZE; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/zoom.png" border="0" onclick="F1 = window.open('<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] . '.'. $file['extension']; ?>','Zoom','height=<?php echo ($file['dimensions_height'] + 20); ?>,width=<?php echo ($file['dimensions_width'] + 20); ?>,toolbar=no,menubar=no,location=no');" /></td>
+ <td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_FULLSIZE; ?>" alt="<?php echo IMAGE_FULLSIZE; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/zoom.png" border="0" onclick="F1 = window.open('<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.'. $file['extension']; ?>','Zoom','height=<?php echo ($file['dimensions_height'] + 20); ?>,width=<?php echo ($file['dimensions_width'] + 20); ?>,toolbar=no,menubar=no,location=no,resize=1,resizable=1');" /></td>
<td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_RENAME; ?>" alt="<?php echo IMAGE_RENAME; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/rename.png" border="0" onclick="rename('<?php echo $file['id']; ?>', '<?php echo addslashes($file['name']); ?>')" /></td>
- <td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_RESIZE; ?>" alt="<?php echo IMAGE_RESIZE; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/scale.png" border="0" onclick="location.href='?serendipity[adminModule]=images&serendipity[adminAction]=scaleSelect&serendipity[fid]=<?php echo $file['id']; ?>';" /></td>
+ <?php if ($is_image) { ?><td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_RESIZE; ?>" alt="<?php echo IMAGE_RESIZE; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/scale.png" border="0" onclick="location.href='?serendipity[adminModule]=images&serendipity[adminAction]=scaleSelect&serendipity[fid]=<?php echo $file['id']; ?>';" /></td><?php } ?>
<td valign="middle" align="center"><img class="serendipityImageButton" title="<?php echo IMAGE_DELETE; ?>" alt="<?php echo IMAGE_DELETE; ?>" src="<?php echo $serendipity['serendipityHTTPPath']; ?>pixel/delete.png" border="0" onclick="location.href='?serendipity[adminModule]=images&serendipity[adminAction]=delete&serendipity[fid]=<?php echo $file['id']; ?>';" /></td>
<?php
}
@@ -496,4 +737,145 @@
</table>
<?php
}
-?>
+
+function serendipity_killPath($basedir, $directory = '', $forceDelete = false) {
+static $n = "<br />\n";
+static $serious = true;
+
+ if ($handle = @opendir($basedir . $directory)) {
+ while (false !== ($file = @readdir($handle))) {
+ if ($file != '.' && $file != '..') {
+ if (is_dir($basedir . $directory . $file)) {
+ serendipity_killPath($basedir, $directory . $file . DIRECTORY_SEPARATOR, $forceDelete);
+ } else {
+ $filestack[$file] = $directory . $file;
+ }
+ }
+ }
+
+ printf(CHECKING_DIRECTORY . "<br />\n", $directory);
+
+ // No, we just don't kill files the easy way. We sort them out properly from the database
+ // and preserve files not entered therein.
+ $files = serendipity_fetchImagesFromDatabase(0, 0, $total, false, false, $directory);
+ if (is_array($files)) {
+ echo "<ul>\n";
+ foreach($files AS $f => $file) {
+ echo "<li>\n";
+ if ($serious) {
+ serendipity_deleteImage($file['id']);
+ } else {
+ echo $file['name'] . '.' . $file['extension'];
+ }
+ echo "</li>\n";
+
+ unset($filestack[$file['name'] . '.' . $file['extension']]);
+ unset($filestack[$file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension']]);
+ }
+ echo "</ul>\n";
+ }
+
+ if (count($filestack) > 0) {
+ if ($forceDelete) {
+ echo "<ul>\n";
+ foreach($filestack AS $f => $file) {
+ if ($serious && @unlink($basedir . $file)) {
+ printf('<li>' . DELETING_FILE . $n . DONE . "</li>\n", $file);
+ } else {
+ printf('<li>' . DELETING_FILE . $n . ERROR . "</li>\n", $file);
+ }
+ }
+ echo "</ul>\n";
+ } else {
+ echo ERROR_DIRECTORY_NOT_EMPTY . $n;
+ echo "<ul>\n";
+ foreach($filestack AS $f => $file) {
+ echo '<li>' . $file . "</li>\n";
+ }
+ echo "</ul>\n";
+ }
+ }
+
+ echo '<strong>';
+ if ($serious && @rmdir($basedir . $directory)) {
+ printf(DIRECTORY_DELETE_SUCCESS . $n, $directory);
+ } else {
+ printf(DIRECTORY_DELETE_FAILED . $n, $directory);
+ }
+ echo '</strong>';
+
+ }
+
+ return true;
+}
+
+function serendipity_traversePath(&$out, $basedir, $jscode = '', $directory = '', $show_files = false, $pattern = '', $output_mode = 1, $level = 0, $selected = '') {
+ if (empty($pattern)) {
+ $pattern = '@.*@';
+ }
+
+ if ($handle = @opendir($basedir . DIRECTORY_SEPARATOR . $directory)) {
+ if ($output_mode == 1) {
+ $out .= '<ul>';
+ }
+
+ while (false !== ($file = @readdir($handle))) {
+ if ($file != '.' && $file != '..' && preg_match($pattern, $file)) {
+ if (is_dir($basedir . $directory . DIRECTORY_SEPARATOR . $file)) {
+ $cdir = (!empty($directory) ? $directory . DIRECTORY_SEPARATOR : '');
+ switch($output_mode) {
+ default:
+ case 1:
+ $out .= '<li><a href="#" onclick="' . $jscode . '" title="' . $cdir . $file . DIRECTORY_SEPARATOR . '">' . $file . DIRECTORY_SEPARATOR . '</a></li>' . "\n";
+ break;
+
+ case 2:
+ $value = $cdir . $file . DIRECTORY_SEPARATOR;
+ $out .= '<option ' . ($selected == $value ? 'selected="selected"' : '') . ' value="' . $value . '">' . str_repeat(' ', $level * 2) . $file . '</option>' . "\n";
+ break;
+ }
+
+ serendipity_traversePath($out, $basedir, $jscode, $cdir . $file, $show_files, $pattern, $output_mode, $level + 1);
+ } elseif ($show_files) {
+ $out .= '<li>' . $file . '</li>' . "\n";
+ }
+ }
+ }
+
+ if ($output_mode == 1) {
+ $out .= '</ul>';
+ }
+
+ closedir($handle);
+ }
+}
+
+function serendipity_deletePath($dir) {
+ $d = dir($dir);
+ if ($d) {
+ while ($f = $d->read() ){
+ if ($f != '.' && $f != '..') {
+ if (is_dir($dir . $f)){
+ serendipity_deletePath($dir . $f . DIRECTORY_SEPARATOR);
+ rmdir($dir . $f);
+ }
+
+ if (is_file($dir . $f)) {
+ unlink($dir . $f);
+ }
+ }
+ }
+
+ $d->close();
+ }
+}
+
+function serendipity_uploadSecure(&$var, $strip_paths = false) {
+ $var = preg_replace('@[^0-9a-z\._/-]@i', '', $var);
+ if ($strip_paths) {
+ $var = preg_replace('@(\.+[/\\\\]+)@', '/', $var);
+ }
+
+ return true;
+}
+?>
\ No newline at end of file
Index: serendipity_admin_image_selector.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_image_selector.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- serendipity_admin_image_selector.php 12 May 2004 14:35:20 -0000 1.22
+++ serendipity_admin_image_selector.php 25 May 2004 16:16:14 -0000 1.23
@@ -35,16 +35,18 @@
switch ($serendipity['GET']['step']) {
case '1':
$file = serendipity_fetchImageFromDatabase($serendipity['GET']['image']);
- $imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
- $imgName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['name'] .'.'. $file['extension'];
- $thumbbasename = $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
+ $imgName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] .'.'. $file['extension'];
+ $thumbbasename = $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $thumbbasename;
- $thumbsize = getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename);
+ $thumbsize = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename);
+ $is_image = (preg_match('@^image/@i', $file['mime']) ? true : false);
?>
<script type="text/javascript" language="JavaScript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_define.js.php"></script>
<script type="text/javascript" language="Javascript" src="<?php echo $serendipity['serendipityHTTPPath']; ?>serendipity_editor.js"></script>
<div>
+<?php if ($is_image) {?>
<img align="right" src="<?php echo $imgsrc; ?>">
<h1><?php printf(YOU_CHOSE, $file['name']); ?></h1>
<p>
@@ -96,6 +98,20 @@
</form>
</p>
<?php
+ } else {
+ // What to do if file is no image.
+ // For the future, maybe allow the user to add title/link description and target window
+?>
+ <script type="text/javascript">
+ block = '<a href="<?php echo htmlspecialchars($imgName); ?>" title="<?php echo htmlspecialchars($file['name'] . '.' . $file['extension']); ?>" target="_blank"><?php echo htmlspecialchars($file['name'] . '.' . $file['extension']); ?></a>';
+ if (self.opener.editorref) {
+ self.opener.editorref.surroundHTML(block, '');
+ } else {
+ self.opener.serendipity_imageSelector_addToBody(block);
+ }
+ self.close();
+ </script>
+<?php }
break;
default:
Index: serendipity_admin_images.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_images.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- serendipity_admin_images.inc.php 19 May 2004 21:08:26 -0000 1.23
+++ serendipity_admin_images.inc.php 25 May 2004 16:16:14 -0000 1.24
@@ -24,7 +24,6 @@
$i = serendipity_syncThumbs();
printf(SYNC_DONE, $i);
-
echo '<p><b>' . RESIZING . '</b><br /><br />';
flush();
@@ -62,20 +61,21 @@
case 'rename':
$file = serendipity_fetchImageFromDatabase($serendipity['GET']['fid']);
+ serendipity_uploadSecure($serendipity['GET']['newname']);
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF && $file['authorid'] != '0' && $file['authorid'] != $serendipity['authorid']) {
return;
}
- $newfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['GET']['newname'] . '.' . $file['extension'];
- $oldfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['name'] . '.'. $file['extension'];
+ $newfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $serendipity['GET']['newname'] . '.' . $file['extension'];
+ $oldfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] . '.'. $file['extension'];
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['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'],
+ $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $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)
@@ -115,8 +115,9 @@
$tfile = basename($serendipity['POST']['imageurl']);
}
- $tfile = preg_replace('@[^0-9a-z\._/-]@i', '', $tfile);
- $target = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $tfile;
+ serendipity_uploadSecure($tfile);
+ serendipity_uploadSecure($serendipity['POST']['target_directory'], true);
+ $target = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['POST']['target_directory'] . $tfile;
if (file_exists($target)) {
echo '(' . $target . ') ' . ERROR_FILE_EXISTS_ALREADY;
@@ -132,7 +133,7 @@
printf(FILE_FETCHED . '<br />', $serendipity['POST']['imageurl'], $tfile);
// Create thumbnail
- serendipity_makeThumbnail($tfile, false, $authorid);
+ serendipity_makeThumbnail($tfile, false, $authorid, $serendipity['POST']['target_directory']);
echo THUMB_CREATED_DONE . '<br />';
}
}
@@ -143,8 +144,9 @@
$tfile = $_FILES['userfile']['name'];
}
- $tfile = preg_replace('@[^0-9a-z\._/-]@i', '', $tfile);
- $target = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $tfile;
+ serendipity_uploadSecure($tfile);
+ serendipity_uploadSecure($serendipity['POST']['target_directory'], true);
+ $target = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $serendipity['POST']['target_directory'] . $tfile;
if (file_exists($target)) {
echo '(' . $target . ') ' . ERROR_FILE_EXISTS_ALREADY;
@@ -156,7 +158,7 @@
@chmod($target, 0664);
// Create thumbnail
- serendipity_makeThumbnail($tfile, false, $authorid);
+ serendipity_makeThumbnail($tfile, false, $authorid, $serendipity['POST']['target_directory']);
echo THUMB_CREATED_DONE . '<br />';
} else {
echo ERROR_UNKNOWN_NOUPLOAD . '<br />';
@@ -165,7 +167,117 @@
}
break;
- case "addSelect":
+ case 'directorySelect':
+ if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF) {
+ return;
+ }
+
+?>
+ <br />
+<?php
+ if (!empty($serendipity['POST']['directoryMode']) && !empty($serendipity['POST']['newDirectoryName'])) {
+ serendipity_uploadSecure($serendipity['POST']['newDirectoryName'], true);
+
+ $new_dir = $serendipity['uploadPath'] .
+ $serendipity['POST']['newDirectoryName'];
+
+ switch($serendipity['POST']['directoryMode']) {
+ case 'create':
+ if (@mkdir($serendipity['serendipityPath'] . $new_dir)) {
+ printf(DIRECTORY_CREATED, $new_dir);
+ @umask(0000);
+ @chmod($serendipity['serendipityPath'] . $new_dir, 0777);
+ } else {
+ printf(DIRECTORY_WRITE_ERROR, $new_dir);
+ }
+ echo '<br /><hr />';
+ break;
+
+ case 'delete':
+ $path = $serendipity['serendipityPath'] . $new_dir;
+ if (is_dir($path)) {
+ if (!is_writable($serendipity['serendipityPath'])) {
+ printf(DIRECTORY_WRITE_ERROR, $new_dir);
+ } else {
+ // Directory exists and is writable. Now dive within subdirectories and kill 'em all.
+ serendipity_killPath(
+ $serendipity['serendipityPath'] . $serendipity['uploadPath'],
+ $serendipity['POST']['newDirectoryName'],
+ (isset($serendipity['POST']['forceDelete']) ? true : false)
+ );
+ }
+ } else {
+ printf(ERROR_NO_DIRECTORY, $new_dir);
+ }
+ echo '<br /><hr />';
+ break;
+ }
+ }
+
+ $jscode = "document.getElementById('newDirectory').value = this.title; return false;";
+
+ echo DIRECTORIES_AVAILABLE;
+ echo '<br /><br /><a href="#" onclick="' . $jscode . '" title="">' . PARENT_DIRECTORY . ' (' . $serendipity['uploadPath'] . ')</a>';
+
+ serendipity_traversePath(
+ $out,
+ $serendipity['serendipityPath'] . $serendipity['uploadPath'],
+ $jscode
+ );
+
+ echo $out;
+?>
+ <script type="text/javascript">
+ function verify_submit() {
+ if (document.getElementById('mode_delete').checked) {
+ warnmsg = '<?php echo CONFIRM_DELETE_DIRECTORY; ?>';
+ warnmsg = warnmsg.replace('%s', document.getElementById('newDirectory').value);
+ return confirm(warnmsg);
+ } else {
+ return true;
+ }
+ }
+ </script>
+
+ <form action="?" method="POST" id="directoryform" onsubmit="return verify_submit()">
+ <div>
+ <input type="hidden" name="serendipity[action]" value="admin" />
+ <input type="hidden" name="serendipity[adminModule]" value="images" />
+ <input type="hidden" name="serendipity[adminAction]" value="directorySelect" />
+
+ <table>
+ <tr>
+ <td>
+ <input type="radio" name="serendipity[directoryMode]" value="create" id="mode_create" checked="checked" />
+ <label for="mode_create"><?php echo NEW_DIRECTORY; ?></label>
+ </td>
+ <td rowspan="2"><input type="text" id="newDirectory" name="serendipity[newDirectoryName]" value="" /></td>
+ </tr>
+
+ <tr>
+ <td>
+ <input type="radio" name="serendipity[directoryMode]" value="delete" id="mode_delete" />
+ <label for="mode_delete"><?php echo DELETE_DIRECTORY; ?></label>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+
+ <input type="checkbox" name="serendipity[forceDelete]" value="true" id="forceDelete" />
+ <label for="forceDelete"><?php echo FORCE_DELETE; ?></label>
+ </td>
+ </tr>
+
+ <tr>
+ <td> </td>
+ <td><input type="submit" value="<?php echo GO; ?>"/></td>
+ </tr>
+ </table>
+<?php
+ break;
+
+ case 'addSelect':
?>
<?php echo ADD_IMAGE_BLAHBLAH; ?>
@@ -208,6 +320,16 @@
</tr>
<tr>
+ <td><?php echo STORE_IN_DIRECTORY; ?></td>
+ <td>
+ <select name="serendipity[target_directory]">
+ <option value=""><?php echo PARENT_DIRECTORY; ?></option>
+ <?php serendipity_traversePath($out, $serendipity['serendipityPath'] . $serendipity['uploadPath'], '', '', false, '', 2); echo $out; ?>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
<td align="right" colspan="2"><input type="checkbox" name="serendipity[all_authors]" value="true" checked="checked" id="all_authors" /><label for="all_authors"><?php echo ALL_AUTHORS; ?></label> <input type="submit" value="<?php echo GO; ?>" /></td>
</tr>
</table>
@@ -226,7 +348,7 @@
printf(
SCALING_IMAGE . '<br />',
- $file['name'] .'.'. $file['extension'],
+ $file['path'] . $file['name'] .'.'. $file['extension'],
$serendipity['GET']['width'],
$serendipity['GET']['height']
);
@@ -248,7 +370,7 @@
return;
}
- $s = getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . '/' . $file['name'] .'.'. $file['extension']);
+ $s = getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file['path'] . $file['name'] .'.'. $file['extension']);
?>
<script type="text/javascript" language="javascript">
<!--
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- NEWS 25 May 2004 11:02:19 -0000 1.131
+++ NEWS 25 May 2004 16:16:09 -0000 1.132
@@ -3,7 +3,17 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * When sending trackbacks, the excerpt will now be stripped of HTML
+ code BEFORE selecting the 255 characters to be sent.
+ (garvinhicking)
+
+ * Upgraded image manager to now also accept files (pdf, doc, ...)
+ and manage/upload to/sync/browse subdirectories. Improved SQL-
+ query for fetching list of images.
+ (garvinhicking) [DB Layout change -> 0.6.3]
+
* PHP pre-4.3.0 compatibility: Define PATH_SEPARATOR if not available
+ (garvinhicking)
* Upgraded PEAR::Text_Wiki and serendipity_event_textwiki plugin.
Configuration options for wiki rules, options to use wiki/freelinks.
@@ -74,7 +84,7 @@
* Categories can now have a fixed image which is embedded for
every article. Can be styled via CSS (.serendipity_entryIcon).
Integrated with s9y image manager.
- (Evan Nemerson, garvinhicking)
+ (Evan Nemerson, garvinhicking) [DB Layout change -> 0.6.2]
* Published entries from the future will only be displayed on the
frontend when not in the future. They will get automagically
@@ -109,7 +119,7 @@
author or chief/admin users. Comments can only be toggled on/
off and removed by the author or chief/admin users.
- public/private images
- (garvinhicking)
+ (garvinhicking) [DB Layout change -> 0.6.1]
* Configuration is now language-dependant. (garvinhicking)
|