Changeset 524
- Timestamp:
- 07/04/06 14:20:38 (7 years ago)
- Location:
- trunk/plugins
- Files:
-
- 1 added
- 8 modified
-
ExtendedFileManager/Classes/ExtendedFileManager.php (modified) (2 diffs)
-
ExtendedFileManager/assets/imagelist.css (modified) (1 diff)
-
ExtendedFileManager/assets/images.js (modified) (2 diffs)
-
ExtendedFileManager/config.inc.php (modified) (2 diffs)
-
ExtendedFileManager/images.php (modified) (7 diffs)
-
ExtendedFileManager/img/edit_rename.gif (added)
-
ExtendedFileManager/lang/pl.js (modified) (1 diff)
-
ImageManager/Classes/Files.php (modified) (2 diffs)
-
ImageManager/manager.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/ExtendedFileManager/Classes/ExtendedFileManager.php
r521 r524 4 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz7 * Package: ExtendedFileManager (EFM 1.1. 1)6 * Version: Updated on 04-07-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1.2) 8 8 * http://www.afrusoft.com/htmlarea 9 9 */ … … 747 747 } 748 748 } 749 750 /** 751 * Renames files if certain GET variables are set 752 * @return bool 753 */ 754 function processRenames() 755 { 756 if(!empty($_GET['rename']) && !empty($_GET['renameTo'])) 757 { 758 // new file name (without path and extension) 759 $newName = Files::escape(rawurldecode($_GET['renameTo'])); 760 $newName = str_replace('.', '', $newName); 761 762 // path to file (from base images directory) 763 $oldName = rawurldecode($_GET['rename']); 764 765 // strip parent dir ("..") to avoid escaping from base directiory 766 $oldName = preg_replace('#\.\.#', '', $oldName); 767 768 // path to old file 769 $oldPath = Files::makeFile($this->getImagesDir(), $oldName); 770 771 $ret = Files::renameFile($oldPath, $newName); 772 if ($ret === true) { 773 // delete old thumbnail 774 Files::delFile($this->getThumbname($oldPath)); 775 } 776 return $ret; 777 } 778 779 return null; 780 } 781 749 782 } 750 783 -
trunk/plugins/ExtendedFileManager/assets/imagelist.css
r521 r524 1 1 body { margin: 0; padding: 0;} 2 2 .edit { font-size: 8pt; font-family: small-caption, sans-serif; padding-top: 3px;} 3 .edit a { border: none; padding: 3px; text-decoration:none; }3 .edit a { border: none; padding: 0; text-decoration:none; } 4 4 .edit a:hover { background-color: ButtonHighlight; } 5 5 .edit a img { border: none; vertical-align: bottom; } -
trunk/plugins/ExtendedFileManager/assets/images.js
r521 r524 3 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz6 * Package: ExtendedFileManager (EFM 1.1. 1)5 * Version: Updated on 04-07-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1.2) 7 7 * http://www.afrusoft.com/htmlarea 8 8 */ 9 9 10 10 function i18n(str) { 11 return HTMLArea._lc(str, ' ImageManager');11 return HTMLArea._lc(str, 'ExtendedFileManager'); 12 12 } 13 13 … … 27 27 var viewtype = selection.options[selection.selectedIndex].value; 28 28 location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&newDir="+newDir+"&viewtype="+viewtype; 29 } 30 31 function renameFile(oldPath) { 32 // strip directory and extension 33 var oldName=oldPath.replace(/.*%2F/,'').replace(/\..*$/,''); 34 var newName = prompt(i18n('Please enter new name for this file...'), oldName); 35 36 if(newName == '' || newName == null || newName == oldName) 37 { 38 alert(i18n('Cancelled rename.')); 39 return false; 40 } 41 var mode=window.top.document.getElementById('manager_mode').value; 42 var selection = window.top.document.getElementById('dirPath'); 43 var dir = selection.options[selection.selectedIndex].value; 44 selection = window.top.document.getElementById('viewtype'); 45 var viewtype = selection.options[selection.selectedIndex].value; 46 location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&rename="+oldPath+"&renameTo="+newName+"&viewtype="+viewtype; 29 47 } 30 48 -
trunk/plugins/ExtendedFileManager/config.inc.php
r521 r524 4 4 * Authors: Wei Zhuo, Afru 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Version 1.1. 1: Updated on 21-06-2006 by Krzysztof Kotowicz <koto@webworkers.pl>6 * Version 1.1.2: Updated on 04-07-2006 by Krzysztof Kotowicz <koto@webworkers.pl> 7 7 * Package: ExtendedFileManager 8 8 * http://www.afrusoft.com/htmlarea … … 184 184 $IMConfig['allow_edit_image'] = true; 185 185 186 /* 187 Possible values: true, false 188 189 TRUE - Allow the user to rename files. 190 191 FALSE - No rename icon will be displayed. 192 193 */ 194 $IMConfig['allow_rename'] = true; 186 195 187 196 /* -
trunk/plugins/ExtendedFileManager/images.php
r521 r524 4 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Version: Updated on 21-06-2006 by Krzysztof Kotowicz7 * Package: ExtendedFileManager (EFM 1.1. 1)6 * Version: Updated on 04-07-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1.2) 8 8 * http://www.afrusoft.com/htmlarea 9 9 */ … … 21 21 //process any file uploads 22 22 $uploadStatus=$manager->processUploads(); 23 24 //process any file renames 25 $renameStatus=$manager->processRenames(); 23 26 24 27 if ($manager->deleteFiles()) … … 105 108 <tr> 106 109 <td><img src="<?php print $IMConfig['base_url']; if(is_file('icons/'.$file['ext'].'_small.gif')) echo "icons/".$file['ext']."_small.gif"; else echo $IMConfig['default_listicon']; ?>" alt="" /></td> 107 <th><a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" <?php if ($insertMode == 'image') { ?> onmouseover="showPreview('<?php echo $file['relative'];?>')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" <?php } ?> >110 <th><a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo preg_replace('#\..{3,4}$#', '', $entry); ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" <?php if ($insertMode == 'image') { ?> onmouseover="showPreview('<?php echo $file['relative'];?>')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" <?php } ?> > 108 111 <?php 109 112 if(strlen($entry)>$maxNameLength) echo substr($entry,0,$maxNameLength)."..."; else echo $entry; … … 115 118 <td class="actions"> 116 119 <a href="<?php print $IMConfig['backend_url']; ?>__function=images&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&mode=<?php echo $insertMode;?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a> 120 <?php if ($IMConfig['allow_rename']) { ?> 121 <a href="#" title="Rename" onclick="renameFile('<?php echo rawurlencode($file['relative']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" border="0" /></a> 122 <?php } ?> 117 123 <?php if($IMConfig['img_library'] && $IMConfig['allow_edit_image'] && $file['image'][0] > 0) { ?> 118 124 <a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" border="0" /></a> … … 129 135 case 'thumbview': // thumbview is default 130 136 default: 131 $maxFileNameLength=1 0;137 $maxFileNameLength=11; 132 138 $maxFolderNameLength=13; 133 139 // start of foreach for draw thumbview folders. … … 153 159 { 154 160 $afruimgdimensions=$manager->checkImageSize($file['relative']); 161 $thisFileNameLength = $maxFileNameLength; 155 162 ?> 156 163 <div class="thumb_holder" id="holder_<?php echo asc2hex($entry) ?>"> 157 <a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>">164 <a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo preg_replace('#\..{3,4}$#', '', $entry); ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);return false;" title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"> 158 165 <img src="<?php print $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" /> 159 166 </a> 160 167 <div class="edit"> 161 168 <a href="<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&delf=<?php echo rawurlencode($file['relative']);?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a> 162 169 <?php if ($IMConfig['allow_rename']) { ?> 170 <a href="#" title="Rename" onclick="renameFile('<?php echo rawurlencode($file['relative']);?>'); return false;"><img src="<?php print $IMConfig['base_url'];?>img/edit_rename.gif" height="15" width="15" alt="Rename" /></a> 171 <?php $thisFileNameLength -= 3; } ?> 163 172 <?php if($IMConfig['img_library'] && $IMConfig['allow_edit_image'] && $file['image'][0] > 0 ) 164 173 { ?> 165 174 <a href="javascript:;" title="Edit" onclick="editImage('<?php echo rawurlencode($file['relative']);?>');"><img src="<?php print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit" /></a> 166 <?php $maxFileName2=$maxFileNameLength-3;} 167 else $maxFileName2=$maxFileNameLength; ?> 175 <?php $thisFileNameLength -= 3; } ?> 168 176 169 177 <?php 170 if(strlen($entry) >$maxFileName2) echo strtolower(substr($entry,0,$maxFileName2))."..."; else echo $entry;178 if(strlen($entry) > $thisFileNameLength + 3) echo strtolower(substr($entry,0,$thisFileNameLength))."..."; else echo $entry; 171 179 ?> 172 180 </div> … … 241 249 <?php 242 250 if(isset($uploadStatus) && !is_numeric($uploadStatus) && !is_bool($uploadStatus)) 243 echo 'alert( "'.$uploadStatus.'");';251 echo 'alert(i18n("'.$uploadStatus.'"));'; 244 252 else if(isset($uploadStatus) && $uploadStatus==false) 245 253 echo 'alert("Unable to upload File. \nEither Maximum file size ['.($insertMode == 'image' ? $IMConfig['max_filesize_kb_image'] : $IMConfig['max_filesize_kb_link'] ).'Kb] exceeded or\nFolder doesn\'t have write permission.");'; 246 254 ?> 247 255 256 <?php 257 if(isset($renameStatus) && !is_numeric($renameStatus) && !is_bool($renameStatus)) 258 echo 'alert(i18n("'.$renameStatus.'"));'; 259 else if(isset($renameStatus) && $renameStatus===false) 260 echo 'alert(i18n("Unable to rename file. File of the same name already exists or\nfolder doesn\'t have write permission."));'; 261 ?> 248 262 249 263 var topDoc = window.top.document; -
trunk/plugins/ExtendedFileManager/lang/pl.js
r521 r524 95 95 "Folder is not empty. Please delete all Files and Subfolders inside.": "Folder nie jest pusty. Najpierw usuÅ wszystkie pliki i podfoldery tego folderu.", 96 96 "Image Size": "Wymiary", 97 "Other" : "Inne..." 97 "Other" : "Inne...", 98 "Rename": "ZmieÅ nazwÄ", 99 "Please enter new name for this file...": "Podaj nowÄ 100 nazwÄ dla tego pliku...", 101 "Unable to rename file. File of the same name already exists or\nfolder doesn't have write permission.": "Nie mogÅem zmieniÄ nazwy pliku. Plik o nowej nazwie juÅŒ istnieje\nlub prak praw zapisu do katalogu.", 102 "Cancelled rename.": "Anulowano zmianÄ nazwy pliku." 98 103 }; -
trunk/plugins/ImageManager/Classes/Files.php
r521 r524 90 90 * @return string the escaped safe filename 91 91 */ 92 function escape($filename) 92 function escape($filename) 93 93 { 94 94 Return preg_replace('/[^\w\._]/', '_', $filename); … … 239 239 return $size; 240 240 } 241 242 /** 243 * Renames file, preserving its directory and extension 244 * @param string $oldPath path to the old existing file 245 * @param string new filename (just the name, without path or extension) 246 * @author Krzysztof Kotowicz <koto@webworkers.pl> 247 */ 248 function renameFile($oldPath, $newName) { 249 250 if(!(file_exists($oldPath) && is_file($oldPath))) 251 return FILE_ERROR_NO_SOURCE; 252 253 $oldFileParts = pathinfo($oldPath); 254 255 $newPath = $oldFileParts['dirname'] . '/' 256 . $newName 257 . (!empty($oldFileParts['extension']) ? '.' . $oldFileParts['extension'] : ''); 258 259 if (file_exists($newPath)) 260 return false; 261 262 if (!rename($oldPath, $newPath)) 263 return FILE_ERROR_COPY_FAILED; 264 265 } 241 266 242 267 } -
trunk/plugins/ImageManager/manager.php
r493 r524 151 151 152 152 <tr> 153 <th align="left">Align :</th>153 <th align="left">Alignment:</th> 154 154 <td colspan="2"> 155 155 <select size="1" id="f_align" title="Positioning of this image">
