Ticket #811: diff.diff
| File diff.diff, 106.8 kB (added by koto@…, 7 years ago) |
|---|
-
assets/editor.js
diff -u -r 10/assets/editor.js 11/assets/editor.js
10 11 1 1 /** 2 2 * Functions for the ImageEditor interface, used by editor.php only 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 … … 166 167 var bottom = document.getElementById('bottom'); 167 168 if(window.opener) 168 169 { 169 __dlg_init( bottom);170 __dlg_translate( I18N);170 __dlg_init(null, {width: 673, height: 531}); 171 __dlg_translate('ExtendedFileManager'); 171 172 } 172 173 } 173 174 -
assets/EditorContent.js
diff -u -r 10/assets/EditorContent.js 11/assets/EditorContent.js
10 11 1 1 /** 2 2 * ImageEditor Interface file. 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 -
assets/editorFrame.js
diff -u -r 10/assets/editorFrame.js 11/assets/editorFrame.js
10 11 1 1 /** 2 2 * Javascript used by the editorFrame.php, it basically initializes the frame. 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 … … 31 32 { 32 33 if (action == 'crop') 33 34 { 34 var url = "editorFrame.php?img="+currentImageFile+"&action=crop¶ms="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value);35 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=crop¶ms="+parseInt(t_cx.value)+','+parseInt(t_cy.value)+','+ parseInt(t_cw.value)+','+parseInt(t_ch.value); 35 36 36 37 //alert(url); 37 38 location.href = url; … … 40 41 } 41 42 else if (action == 'scale') 42 43 { 43 var url = "editorFrame.php?img="+currentImageFile+"&action=scale¶ms="+parseInt(s_sw.value)+','+parseInt(s_sh.value);44 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=scale¶ms="+parseInt(s_sw.value)+','+parseInt(s_sh.value); 44 45 //alert(url); 45 46 location.href = url; 46 47 … … 50 51 var flip = topDoc.getElementById('flip'); 51 52 52 53 if(flip.value == 'hoz' || flip.value == 'ver') 53 location.href = "editorFrame.php?img="+currentImageFile+"&action=flip¶ms="+flip.value;54 location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=flip¶ms="+flip.value; 54 55 else if (isNaN(parseFloat(r_ra.value))==false) 55 location.href = "editorFrame.php?img="+currentImageFile+"&action=rotate¶ms="+parseFloat(r_ra.value);56 location.href = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=rotate¶ms="+parseFloat(r_ra.value); 56 57 } 57 58 else if(action == 'save') { 58 59 var s_file = topDoc.getElementById('save_filename'); … … 68 69 { 69 70 var filename = encodeURI(s_file.value); 70 71 var quality = parseInt(s_quality.value); 71 var url = "editorFrame.php?img="+currentImageFile+"&action=save¶ms="+format[0]+","+quality+"&file="+filename;72 var url = _backend_url + "__function=editorFrame&img="+currentImageFile+"&action=save¶ms="+format[0]+","+quality+"&file="+filename; 72 73 //alert(url); 73 74 location.href = url; 74 75 } -
assets/imagelist.css
diff -u -r 10/assets/imagelist.css 11/assets/imagelist.css
10 11 1 body { margin: 0px; padding: 0px;} 2 .block { border: 1px solid threedface; text-align: center; behavior: url(hover.htc ); vertical-align:middle;} 3 .block a img { border: 0 none; } 4 .block:hover, .block.hover{ background-color: #f8f8f8; } 5 .lsviewheader {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;} 6 .lsviewpanel{padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;} 7 .lsviewpanel a, .lsviewpanel a:visited { text-decoration: none; color: #000; border:0px; padding:2px; padding-left:5px; padding-right:10px;} 8 .lsviewpanel a:hover { background-color:#0B256B; color:#fff;} 9 .edit { font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif; padding-top:2px; padding-bottom: 2px; } 10 .edit a { border: 1px solid white; padding-bottom: 1px; } 11 .edit a:hover { background-color: #e4e0d8; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;} 12 .edit a img { border: 0 none; vertical-align: bottom; } 1 body { margin: 0; padding: 0;} 2 .edit { font-size: 8pt; font-family: small-caption, sans-serif; padding-top: 3px;} 3 .edit a { border: none; padding: 3px; text-decoration:none; } 4 .edit a:hover { background-color: ButtonHighlight; } 5 .edit a img { border: none; vertical-align: bottom; } 13 6 .noResult { font-size:large; font-weight:bold; color:#ccc; font-family: Helvetica, sans-serif; text-align: center; padding-top: 60px; } 14 .error { color:#c00; font-weight:bold; font-size: medium; font-family: Helvetica, sans-serif; text-align: center; padding-top: 65px;} 15 No newline at end of file 7 .error { color:#c00; font-weight:bold; font-size: medium; font-family: Helvetica, sans-serif; text-align: center; padding-top: 65px;} 8 9 .dir_holder, .thumb_holder 10 { 11 width:106px; height:132px; 12 float:left; 13 margin:6px 4px; 14 background-color:ButtonFace; 15 border: 1px outset; 16 } 17 18 .thumb_holder.active 19 { 20 background:Highlight; 21 color:HighlightText; 22 border:1px dashed Highlight; 23 } 24 25 .dir_holder a.dir, .thumb_holder a.thumb 26 { 27 height:100px; 28 display:block; 29 text-align:center; 30 padding:5px; 31 text-decoration:none; 32 } 33 34 .thumb_holder a.thumb img 35 { 36 border:1px solid black; 37 } 38 39 .dir_holder a.dir img 40 { 41 border:none; 42 } 43 44 .listview { width:100% } 45 .listview td, .listview th { text-align:left; font-size:small; } 46 .listview td.actions { text-align: left; } 47 .listview td.actions img { border:0; } 48 49 .listview thead th {background-color: ButtonFace; border: 1px solid threedface; border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; padding-top:2px; padding-bottom:2px; padding-left: 5px; padding-right: 5px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;} 50 .listview tbody td, .listview tbody th {padding-top:2px; padding-left: 3px; font-size: 9pt; font-family: "MS Sans Serif", Geneva, sans-serif;} 51 .listview tbody a, listview tbody a:visited { font-weight: normal; text-decoration: none; color: #000; border:0px; padding:2px;} 52 .listview tbody a:hover { background-color:#0B256B; color:#fff;} -
assets/images.js
diff -u -r 10/assets/images.js 11/assets/images.js
10 11 1 1 /** 2 2 * Functions for the image listing, used by images.php only 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 9 function i18n(str) { 10 if(I18N) 11 return (I18N[str] || str); 12 else 13 return str; 14 }; 10 function i18n(str) { 11 return HTMLArea._lc(str, 'ImageManager'); 12 } 15 13 16 14 function changeDir(newDir) 17 15 { … … 19 17 var mode=window.top.document.getElementById('manager_mode').value; 20 18 var selection = window.top.document.getElementById('viewtype'); 21 19 var viewtype = selection.options[selection.selectedIndex].value; 22 location.href = "images.php?mode="+mode+"&dir="+newDir+"&viewtype="+viewtype;20 location.href = _backend_url + "__function=images&mode="+mode+"&dir="+newDir+"&viewtype="+viewtype; 23 21 } 24 22 25 23 function newFolder(dir, newDir) … … 27 25 var mode=window.top.document.getElementById('manager_mode').value; 28 26 var selection = window.top.document.getElementById('viewtype'); 29 27 var viewtype = selection.options[selection.selectedIndex].value; 30 location.href = "images.php?mode="+mode+"&dir="+dir+"&newDir="+newDir+"&viewtype="+viewtype;28 location.href = _backend_url + "__function=images&mode="+mode+"&dir="+dir+"&newDir="+newDir+"&viewtype="+viewtype; 31 29 } 32 30 33 31 //update the dir list in the parent window. … … 100 98 var obj = topDoc.getElementById('f_height'); obj.value = height; 101 99 var obj = topDoc.getElementById('orginal_width'); obj.value = width; 102 100 var obj = topDoc.getElementById('orginal_height'); obj.value = height; 101 update_selected(); 103 102 } 104 103 } 105 104 else if (topDoc.getElementById('manager_mode').value=="link") … … 111 110 return false; 112 111 } 113 112 114 function showMessage(newMessage) 113 var _current_selected = null; 114 function update_selected() 115 { 116 var topDoc = window.top.document; 117 if(_current_selected) 118 { 119 _current_selected.className = _current_selected.className.replace(/(^| )active( |$)/, '$1$2'); 120 _current_selected = null; 121 } 122 // Grab the current file, and highlight it if we have it 123 var c_file = topDoc.getElementById('f_url').value; 124 var selection = topDoc.getElementById('dirPath'); 125 var currentDir = selection.options[selection.selectedIndex].text; 126 var dRe = new RegExp('^(' + currentDir.replace(/([\/\^$*+?.()|{}[\]])/g, '\\$1') + ')([^/]*)$'); 127 if(dRe.test(c_file)) 128 { 129 var holder = document.getElementById('holder_' + asc2hex(RegExp.$2)); 130 if(holder) 131 { 132 _current_selected = holder; 133 holder.className += ' active'; 134 } 135 } 136 showPreview(c_file); 137 } 138 139 function asc2hex(str) 140 { 141 var hexstr = ''; 142 for(var i = 0; i < str.length; i++) 143 { 144 var hex = (str.charCodeAt(i)).toString(16); 145 if(hex.length == 1) hex = '0' + hex; 146 hexstr += hex; 147 } 148 return hexstr; 149 } 150 151 function showMessage(newMessage) 115 152 { 116 153 var topDoc = window.top.document; 117 154 … … 153 190 154 191 function confirmDeleteFile(file) 155 192 { 156 if(confirm( i18n("Delete "+file+"?")))193 if(confirm(file + "\n\n" + i18n("Delete file?"))) 157 194 return true; 158 195 159 196 return false; … … 163 200 { 164 201 if(count > 0) 165 202 { 166 alert(i18n("Folder is not Empty. Please delete all Files and Sub Folders inside."));203 alert(i18n("Folder is not empty. Please delete all Files and Subfolders inside.")); 167 204 return false; 168 205 } 169 206 170 if(confirm(i18n( "Delete folder "+dir+" ?")))207 if(confirm(i18n(dir + "\n\n" + i18n("Delete folder?")))) 171 208 return true; 172 209 173 210 return false; 174 211 } 175 212 213 function showPreview(f_url) 214 { 215 window.parent.document.getElementById('f_preview').src = 216 f_url ? window.parent._backend_url + '__function=thumbs&img=' + f_url : ""; 217 } 218 219 176 220 addEvent(window, 'load', init); 221 No newline at end of file -
assets/manager.css
diff -u -r 10/assets/manager.css 11/assets/manager.css
10 11 2 2 body { padding: 5px; } 3 3 fieldset { padding: 0;} 4 4 .title { background-color: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px; border-bottom: 1px solid black; letter-spacing: 2px;} 5 form { padding: 0px; margin: 0 auto; width: 550px;}6 .dirWidth { width: 60%; } 5 form { padding: 0px; margin: 0 auto; width: 100%;} 6 /*.dirWidth { width: 60%; }*/ 7 7 a { padding: 5px; border: 1px solid ButtonFace; } 8 8 a img { border: 0; } 9 9 a:hover { border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; } 10 10 .dirs { padding: 1em; } 11 11 12 .imageFrame { overflow-x:hidden; width: 525px; height: 145px; margin:0px; background-color: #fff;}12 .imageFrame { overflow-x:hidden; width: 100%; height: 145px; margin:0px; background-color: #fff;} 13 13 .smallWidth{ width: 4em; } 14 .largelWidth{ width: 22em; }14 .largelWidth{ width: 30em; } 15 15 .extralargelWidth{ width: 100%; } 16 .inputTable { margin: 1em auto ;}16 .inputTable { margin: 1em auto 1em 0;} 17 17 select, input, button { font: 11px Tahoma,Verdana,sans-serif; } 18 18 .buttons { width: 70px; text-align: center; } 19 19 .clearboth{ clear: both; } 20 20 #messages { position: relative; left: 175px; top: 115px; background-color: white; width:200px; float: left; margin-top: -52px; border: 1px solid #ccc; text-align: center; padding: 15px; } 21 21 #message { font-size: 15px; font-weight: bold; color: #69c; } 22 iframe { border:1px inset; border-right:none; border-left:none; border-bottom:none; } 23 24 table { margin-top:10px; } 25 th, td { padding-right:3px; text-align:left; font-family:small-caption,helvetica,sans-serif; } 26 .dirWidth {width: 60%} 27 No newline at end of file -
assets/manager.js
diff -u -r 10/assets/manager.js 11/assets/manager.js
10 11 1 1 /** 2 2 * Functions for the ExtendedFileManager, used by manager.php only 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 … … 18 19 19 20 //Translation 20 21 function i18n(str) { 21 if(I18N) 22 return (I18N[str] || str); 23 else 24 return str; 25 }; 26 22 return HTMLArea._lc(str, 'ExtendedFileManager'); 23 } 27 24 28 25 //set the alignment options 29 26 function setAlign(align) … … 52 49 //initialise the form 53 50 init = function () 54 51 { 55 __dlg_init(); 52 if (manager_mode == "link") 53 __dlg_init(null, {width:650,height:500}); 54 else 55 __dlg_init(null, {width:650,height:550}); 56 56 57 57 if(I18N) 58 __dlg_translate(I18N); 58 __dlg_translate('ExtendedFileManager'); 59 59 60 60 var uploadForm = document.getElementById('uploadForm'); 61 61 if(uploadForm) uploadForm.target = 'imgManager'; … … 63 63 var param = window.dialogArguments; 64 64 if(manager_mode=="image" && param) 65 65 { 66 var image_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') ); 67 param.f_url = param.f_url.replace( image_regex, "" ); 68 69 // The image URL may reference one of the automatically resized images 70 // (when the user alters the dimensions in the picker), clean that up 71 // so it looks right and we get back to a normal f_url 72 var rd = _resized_dir.replace(HTMLArea.RE_Specials, '\\$1'); 73 var rp = _resized_prefix.replace(HTMLArea.RE_Specials, '\\$1'); 74 var dreg = new RegExp('^(.*/)' + rd + '/' + rp + '_([0-9]+)x([0-9]+)_([^/]+)$'); 75 76 if(dreg.test(param.f_url)) 77 { 78 param.f_url = RegExp.$1 + RegExp.$4; 79 param.f_width = RegExp.$2; 80 param.f_height = RegExp.$3; 81 } 82 66 83 document.getElementById("f_url").value = param["f_url"]; 67 84 document.getElementById("f_alt").value = param["f_alt"]; 68 85 document.getElementById("f_border").value = param["f_border"]; … … 72 89 document.getElementById("f_height").value = param["f_height"]; 73 90 setAlign(param["f_align"]); 74 91 document.getElementById("f_url").focus(); 92 93 document.getElementById("orginal_width").value = param["f_width"]; 94 document.getElementById("orginal_height").value = param["f_height"]; 95 setAlign(param["f_align"]); 96 97 // Locate to the correct directory 98 var dreg = new RegExp('^(.*/)([^/]+)$'); 99 if (dreg.test(param['f_url'])) 100 { 101 changeDir(RegExp.$1); 102 var dirPath = document.getElementById('dirPath'); 103 for(var i = 0; i < dirPath.options.length; i++) 104 { 105 if(dirPath.options[i].value == encodeURIComponent(RegExp.$1)) 106 { 107 dirPath.options[i].selected = true; 108 break; 109 } 110 } 111 } 112 113 document.getElementById('f_preview').src = _backend_url + '__function=thumbs&img=' + param.f_url; 114 75 115 } 76 116 77 117 else if(manager_mode=="link" && param) … … 79 119 var target_select = document.getElementById("f_target"); 80 120 var use_target = true; 81 121 122 var href_regex = new RegExp( '(https?://[^/]*)?' + base_url.replace(/\/$/, '') ); 123 param.f_href = param.f_href.replace( href_regex, "" ); 124 125 // Locate to the correct directory 126 var dreg = new RegExp('^(.*/)([^/]+)$'); 127 if (dreg.test(param['f_href'])) 128 { 129 changeDir(RegExp.$1); 130 var dirPath = document.getElementById('dirPath'); 131 for(var i = 0; i < dirPath.options.length; i++) 132 { 133 if(dirPath.options[i].value == encodeURIComponent(RegExp.$1)) 134 { 135 dirPath.options[i].selected = true; 136 break; 137 } 138 } 139 } 140 82 141 if (param) 83 142 { 84 143 if ( typeof param["f_usetarget"] != "undefined" ) … … 114 173 target_select.onchange = onTargetChanged; 115 174 document.getElementById("f_href").focus(); 116 175 } 117 118 119 120 176 } 121 177 122 178 … … 142 198 else 143 199 param[id] = el.value; 144 200 } 201 202 // See if we need to resize the image 203 var origsize = 204 { 205 w:document.getElementById('orginal_width').value, 206 h:document.getElementById('orginal_height').value 207 } 208 209 if( (origsize.w != param.f_width) 210 || (origsize.h != param.f_height) ) 211 { 212 // Yup, need to resize 213 var resized = HTMLArea._geturlcontent(window.opener._editor_url + 'plugins/ExtendedFileManager/' + _backend_url + '&__function=resizer&img=' + encodeURIComponent(document.getElementById('f_url').value) + '&width=' + param.f_width + '&height=' + param.f_height); 214 215 // alert(resized); 216 resized = eval(resized); 217 if(resized) 218 { 219 param.f_url = makeURL(base_url, resized); 220 } 221 } 222 145 223 __dlg_close(param); 146 224 return false; 147 225 } … … 313 391 314 392 function doUpload() 315 393 { 316 317 394 var uploadForm = document.getElementById('uploadForm'); 318 395 if(uploadForm) 319 396 showMessage('Uploading'); … … 326 403 } 327 404 328 405 329 function newFolder() 406 function newFolder() 330 407 { 408 var folder = prompt(i18n('Please enter name for new folder...'), i18n('Untitled')); 331 409 var selection = document.getElementById('dirPath'); 332 410 var dir = selection.options[selection.selectedIndex].value; 333 411 334 Dialog("newFolder.html", function(param)335 {336 if (!param) // user must have pressed Cancel337 return false;338 else339 {340 var folder = param['f_foldername'];341 412 if(folder == thumbdir) 342 413 { 343 414 alert(i18n('Invalid folder name, please choose another folder name.')); 344 415 return false; 345 416 } 346 417 347 if (folder && folder != '' && typeof imgManager != 'undefined') 348 imgManager.newFolder(dir, encodeURI(folder)); 349 } 350 }, null); 351 } 418 if (folder && folder != '' && typeof imgManager != 'undefined') 419 imgManager.newFolder(dir, encodeURI(folder)); 420 } 352 421 353 422 addEvent(window, 'load', init); -
assets/popup.js
diff -u -r 10/assets/popup.js 11/assets/popup.js
10 11 11 11 // 12 12 // $Id: popup.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 13 13 14 // Slightly modified for the ExtendedFileManager, window resizing is done only15 // by each window's script. Added translation for a few other HTML elements.16 17 function getAbsolutePos(el) {18 var r = { x: el.offsetLeft, y: el.offsetTop };19 if (el.offsetParent) {20 var tmp = getAbsolutePos(el.offsetParent);21 r.x += tmp.x;22 r.y += tmp.y;23 }24 return r;25 };26 27 function comboSelectValue(c, val) {28 var ops = c.getElementsByTagName("option");29 for (var i = ops.length; --i >= 0;) {30 var op = ops[i];31 op.selected = (op.value == val);32 }33 c.value = val;34 };35 36 14 function __dlg_onclose() { 37 15 if(opener.Dialog._return) 38 16 opener.Dialog._return(null); 39 17 }; 40 18 41 function __dlg_init(bottom) { 42 var body = document.body; 43 var body_height = 0; 44 if (typeof bottom == "undefined") { 45 var div = document.createElement("div"); 46 body.appendChild(div); 47 var pos = getAbsolutePos(div); 48 body_height = pos.y; 49 } else { 50 var pos = getAbsolutePos(bottom); 51 body_height = pos.y + bottom.offsetHeight; 52 } 53 if(opener && opener.Dialog && opener.Dialog._arguments) 54 window.dialogArguments = opener.Dialog._arguments; 55 if (!document.all) { 56 //window.sizeToContent(); 57 //window.sizeToContent(); // for reasons beyond understanding, 58 // only if we call it twice we get the 59 // correct size. 60 window.addEventListener("unload", __dlg_onclose, true); 61 // center on parent 62 var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2; 63 var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2; 64 window.moveTo(x, y); 65 //window.innerWidth = body.offsetWidth + 5; 66 //window.innerHeight = body_height + 2; 67 } else { 68 // window.dialogHeight = body.offsetHeight + 50 + "px"; 69 // window.dialogWidth = body.offsetWidth + "px"; 70 //window.resizeTo(body.offsetWidth, body_height); 71 var ch = body.clientHeight; 72 var cw = body.clientWidth; 73 //window.resizeBy(body.offsetWidth - cw, body_height - ch); 74 var W = body.offsetWidth; 75 var H = 2 * body_height - ch; 76 if(ch <= 0) H = body_height; 77 var x = (screen.availWidth - W) / 2; 78 var y = (screen.availHeight - H) / 2; 79 80 window.moveTo(x, y); 81 } 82 document.body.onkeypress = __dlg_close_on_esc; 83 }; 84 85 function __dlg_translate(i18n) { 86 var types = ["span", "option", "td", "button", "div", "label", "a","img", "legend"]; 87 for (var type in types) { 88 var spans = document.getElementsByTagName(types[type]); 89 for (var i = spans.length; --i >= 0;) { 90 var span = spans[i]; 91 if (span.firstChild && span.firstChild.data) { 92 var txt = i18n[span.firstChild.data]; 93 if (txt) span.firstChild.data = txt; 94 } 95 if(span.title){ 96 var txt = i18n[span.title]; 97 if(txt) span.title = txt; 98 } 99 if(span.alt){ 100 var txt = i18n[span.alt]; 101 if(txt) span.alt = txt; 102 } 103 } 104 } 105 var txt = i18n[document.title]; 106 if (txt) 107 document.title = txt; 108 }; 19 function __dlg_translate(context) { 20 var types = ["span", "option", "td", "th", "button", "div", "label", "a","img", "legend"]; 21 for (var type = 0; type < types.length; type++) { 22 var spans = document.getElementsByTagName(types[type]); 23 for (var i = spans.length; --i >= 0;) { 24 var span = spans[i]; 25 if (span.firstChild && span.firstChild.data) { 26 var txt = HTMLArea._lc(span.firstChild.data, context); 27 if (txt) 28 span.firstChild.data = txt; 29 } 30 if (span.title) { 31 var txt = HTMLArea._lc(span.title, context); 32 if (txt) 33 span.title = txt; 34 } 35 if (span.alt) { 36 var txt = HTMLArea._lc(span.alt, context); 37 if (txt) 38 span.alt = txt; 39 } 40 } 41 } 42 document.title = HTMLArea._lc(document.title, context); 43 } 109 44 110 45 // closes the dialog and passes the return info upper. 111 46 function __dlg_close(val) { 112 47 opener.Dialog._return(val); 113 48 window.close(); 114 49 }; 115 116 function __dlg_close_on_esc(ev) {117 ev || (ev = window.event);118 if (ev.keyCode == 27) {119 window.close();120 return false;121 }122 return true;123 }; -
assets/slider.js
diff -u -r 10/assets/slider.js 11/assets/slider.js
10 11 1 1 /** 2 2 * ImageEditor slider file. 3 * Authors: Wei Zhuo, Afru 3 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 4 4 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 5 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 6 * Package: ExtendedFileManager (EFM 1.1) 6 7 * http://www.afrusoft.com/htmlarea 7 8 */ 8 9 -
Classes/ExtendedFileManager.php
Only in 11: backend.php diff -u -r 10/Classes/ExtendedFileManager.php 11/Classes/ExtendedFileManager.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * ExtendedFileManager, list images, directories, and thumbnails. 4 * Authors: Wei Zhuo, Afru 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 9 10 10 require_once('Files.php'); 11 /** 12 * We use classes from ImageManager to avoid code duplication 13 */ 14 require_once '../ImageManager/Classes/Files.php'; 11 15 12 16 /** 13 17 * ExtendedFileManager Class. 14 18 * @author $Author: Wei Zhuo $ 19 * @author $Author: Krzysztof Kotowicz $ 15 20 * @version $Id: ExtendedFileManager.php 27 2004-04-01 08:31:57Z Wei Zhuo $ 16 21 */ 17 22 class ExtendedFileManager … … 25 30 * Array of directory information. 26 31 */ 27 32 var $dirs; 33 34 /** 35 * Manager mode - image | link 36 */ 37 var $mode; 28 38 29 39 /** 30 40 * Constructor. Create a new Image Manager instance. 31 41 * @param array $config configuration array, see config.inc.php 32 42 */ 33 function ExtendedFileManager($config )43 function ExtendedFileManager($config, $mode = null) 34 44 { 35 45 $this->config = $config; 46 47 $this->mode = empty($mode) ? (empty($config['insert_mode']) ? 'image' : $config['insert_mode']): $mode; 36 48 } 37 49 38 50 /** 39 51 * Get the base directory. 40 52 * @return string base dir, see config.inc.php 41 53 */ 42 function get BaseDir()54 function getImagesDir() 43 55 { 44 Return $this->config[' base_dir'];56 Return $this->config['images_dir']; 45 57 } 46 58 47 59 /** 48 60 * Get the base URL. 49 61 * @return string base url, see config.inc.php 50 62 */ 51 function get BaseURL()63 function getImagesURL() 52 64 { 53 Return $this->config[' base_url'];65 Return $this->config['images_url']; 54 66 } 55 67 56 68 function isValidBase() 57 69 { 58 return is_dir($this->get BaseDir());70 return is_dir($this->getImagesDir()); 59 71 } 60 72 61 73 /** … … 79 91 { 80 92 if(is_null($this->dirs)) 81 93 { 82 $dirs = $this->_dirs($this->get BaseDir(),'/');94 $dirs = $this->_dirs($this->getImagesDir(),'/'); 83 95 ksort($dirs); 84 96 $this->dirs = $dirs; 85 97 } … … 139 151 $files = array(); 140 152 $dirs = array(); 141 153 154 $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; 155 142 156 if($this->isValidBase() == false) 143 157 return array($files,$dirs); 144 158 145 159 $path = Files::fixPath($path); 146 $base = Files::fixPath($this->get BaseDir());160 $base = Files::fixPath($this->getImagesDir()); 147 161 $fullpath = Files::makePath($base,$path); 148 162 149 163 … … 167 181 { 168 182 $afruext = strtolower(substr(strrchr($entry, "."), 1)); 169 183 170 if(in_array($afruext,$this->config['allowed_extensions']))184 if(in_array($afruext,$valid_extensions)) 171 185 { 172 186 173 187 $file['url'] = Files::makePath($this->config['base_url'],$path).$entry; … … 321 335 if($this->config['safe_mode'] == true 322 336 || strlen(trim($this->config['thumbnail_dir'])) == 0) 323 337 { 324 Return Files::makeFile($this->get BaseURL(),$thumbnail);338 Return Files::makeFile($this->getImagesURL(),$thumbnail); 325 339 } 326 340 else 327 341 { 328 342 if(strlen(trim($this->config['thumbnail_dir'])) > 0) 329 343 { 330 344 $path = Files::makePath($path_parts['dirname'],$this->config['thumbnail_dir']); 331 $url_path = Files::makePath($this->get BaseURL(), $path);345 $url_path = Files::makePath($this->getImagesURL(), $path); 332 346 Return Files::makeFile($url_path,$thumbnail); 333 347 } 334 348 else //should this ever happen? … … 339 353 } 340 354 } 341 355 356 /** 357 * For a given image file, get the respective resized filename 358 * no file existence check is done. 359 * @param string $fullpathfile the full path to the image file 360 * @param integer $width the intended width 361 * @param integer $height the intended height 362 * @param boolean $mkDir whether to attempt to make the resized_dir if it doesn't exist 363 * @return string of the resized filename 364 */ 365 function getResizedName($fullpathfile, $width, $height, $mkDir = TRUE) 366 { 367 $path_parts = pathinfo($fullpathfile); 368 369 $thumbnail = $this->config['resized_prefix']."_{$width}x{$height}_{$path_parts['basename']}"; 370 371 if( strlen(trim($this->config['resized_dir'])) == 0 || $this->config['safe_mode'] == true ) 372 { 373 Return Files::makeFile($path_parts['dirname'],$thumbnail); 374 } 375 else 376 { 377 $path = Files::makePath($path_parts['dirname'],$this->config['resized_dir']); 378 if($mkDir && !is_dir($path)) 379 Files::createFolder($path); 380 Return Files::makeFile($path,$thumbnail); 381 } 382 } 383 342 384 /** 343 385 * Check if the given path is part of the subdirectories 344 386 * under the base_dir. … … 419 461 Return false; 420 462 } 421 463 422 423 464 $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; 465 $max_size = $this->mode == 'image' ? $this->config['max_filesize_kb_image'] : $this->config['max_filesize_kb_link']; 424 466 $afruext = strtolower(substr(strrchr($file['name'], "."), 1)); 425 467 426 if(!in_array($afruext, $this->config['allowed_extensions']))468 if(!in_array($afruext, $valid_extensions)) 427 469 { 428 470 Files::delFile($file['tmp_name']); 429 471 Return "Cannot upload .".$afruext." Files. Permission denied."; 430 472 } 431 473 432 if($file['size']>($ this->config['max_filesize_kb']*1024))474 if($file['size']>($max_size*1024)) 433 475 { 434 476 Files::delFile($file['tmp_name']); 435 Return "Unble to upload file. Maximum file size [".$ this->config['max_filesize_kb']."Kb] exceeded.";477 Return "Unble to upload file. Maximum file size [".$max_size."Kb] exceeded."; 436 478 } 437 479 438 if( (Files::dirSize($this->getBaseDir()))+$file['size']> ($this->config['max_foldersize_mb']*1048576))480 if(!empty($this->config['max_foldersize_mb']) && (Files::dirSize($this->getImagesDir()))+$file['size']> ($this->config['max_foldersize_mb']*1048576)) 439 481 { 440 482 Files::delFile($file['tmp_name']); 441 483 Return ("Cannot upload. Maximum folder size reached. Delete unwanted files and try again."); 442 484 } 443 485 444 486 //now copy the file 445 $path = Files::makePath($this->get BaseDir(),$relative);487 $path = Files::makePath($this->getImagesDir(),$relative); 446 488 $result = Files::copyFile($file['tmp_name'], $path, $file['name']); 447 489 448 490 //no copy error … … 461 503 462 504 function getDiskInfo() 463 505 { 464 $tmpFreeSize=($this->config['max_foldersize_mb']*1048576)-Files::dirSize($this->getBaseDir()); 506 if (empty($this->config['max_foldersize_mb'])) 507 return ''; 508 509 $tmpFreeSize=($this->config['max_foldersize_mb']*1048576)-Files::dirSize($this->getImagesDir()); 465 510 466 511 if(!is_numeric($tmpFreeSize) || $tmpFreeSize<0) $tmpFreeSize=0; 467 468 Return 'Total Size : '.$this->config['max_foldersize_mb'].' Mb , Free Space : '.Files::formatSize($tmpFreeSize);512 513 Return 'Total Size : '.$this->config['max_foldersize_mb'].' Mb , Free Space: '.Files::formatSize($tmpFreeSize); 469 514 } 470 515 471 516 … … 479 524 */ 480 525 function getFileURL($relative) 481 526 { 482 Return Files::makeFile($this->get BaseURL(),$relative);527 Return Files::makeFile($this->getImagesURL(),$relative); 483 528 } 484 529 485 530 /** … … 489 534 */ 490 535 function getFullPath($relative) 491 536 { 492 Return Files::makeFile($this->get BaseDir(),$relative);;537 Return Files::makeFile($this->getImagesDir(),$relative);; 493 538 } 494 539 495 540 /** … … 512 557 */ 513 558 function checkImageSize($relative) 514 559 { 515 $fullpath = Files::makeFile($this->get BaseDir(),$relative);560 $fullpath = Files::makeFile($this->getImagesDir(),$relative); 516 561 517 562 $afruext = strtolower(substr(strrchr($relative, "."), 1)); 518 563 … … 564 609 */ 565 610 function getThumbnail($relative) 566 611 { 567 $fullpath = Files::makeFile($this->getBaseDir(),$relative); 612 global $IMConfig; 613 614 $fullpath = Files::makeFile($this->getImagesDir(),$relative); 568 615 569 616 //not a file??? 570 617 if(!is_file($fullpath)) … … 609 656 610 657 //well, no thumbnail was found, so ask the thumbs.php 611 658 //to generate the thumbnail on the fly. 612 Return 'thumbs.php?img='.rawurlencode($relative);659 Return $IMConfig['backend_url'] . '__function=thumbs&img='.rawurlencode($relative); 613 660 } 614 661 615 662 /** … … 619 666 function deleteFiles() 620 667 { 621 668 if(isset($_GET['delf'])) 622 $this->_delFile(rawurldecode($_GET['delf'])); 669 return $this->_delFile(rawurldecode($_GET['delf'])); 670 return false; 623 671 } 624 672 625 673 /** … … 641 689 */ 642 690 function _delFile($relative) 643 691 { 644 $fullpath = Files::makeFile($this->get BaseDir(),$relative);692 $fullpath = Files::makeFile($this->getImagesDir(),$relative); 645 693 646 694 $afruext = strtolower(substr(strrchr($relative, "."), 1)); 647 695 648 if(!in_array($afruext,$this->config['allowed_extensions'])) 696 $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions']; 697 698 if(!in_array($afruext,$valid_extensions)) 649 699 { 650 700 return false; 651 701 } … … 667 717 */ 668 718 function _delDir($relative) 669 719 { 670 $fullpath = Files::makePath($this->get BaseDir(),$relative);720 $fullpath = Files::makePath($this->getImagesDir(),$relative); 671 721 if($this->countFiles($fullpath) <= 0) 672 722 return Files::delFolder($fullpath,true); //delete recursively. 673 723 else … … 688 738 { 689 739 $newDir = rawurldecode($_GET['newDir']); 690 740 $dir = rawurldecode($_GET['dir']); 691 $path = Files::makePath($this->get BaseDir(),$dir);741 $path = Files::makePath($this->getImagesDir(),$dir); 692 742 $fullpath = Files::makePath($path, Files::escape($newDir)); 693 743 if(is_dir($fullpath)) 694 744 Return false; -
config.inc.php
Only in 10/Classes: Files.php Only in 10/Classes: GD.php Only in 10/Classes: IM.php Only in 10/Classes: ImageEditor.php Only in 10/Classes: NetPBM.php Only in 10/Classes: Thumbnail.php Only in 10/Classes: Transform.php diff -u -r 10/config.inc.php 11/config.inc.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * ExtendedFileManager configuration file. 4 4 * Authors: Wei Zhuo, Afru 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Version 1.1: Updated on 20-06-2006 by Krzysztof Kotowicz <koto@webworkers.pl> 6 7 * Package: ExtendedFileManager 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 9 10 10 11 /* Configuration file usage: 11 * There are two insertModes for this filemanager. One is "image" and another is "link". 12 * There are two insertModes for this filemanager. 13 * One is "image" and another is "link". 12 14 * So you can assign config values as below 13 15 * 14 16 * if($insertMode=="image") $IMConfig['property']=somevalueforimagemode; 15 17 * else if($insertMode=="link") $IMConfig['property']=somevalueforlinkmode; 16 18 * 17 * (or) you can directly as s$IMConfig['property']=somevalueforbothmodes;19 * (or) you can directly as $IMConfig['property']=somevalueforbothmodes; 18 20 * 19 21 * Best of Luck :) Afru. 20 22 */ 21 23 22 /* 24 /** 25 * Default backend URL 26 * 27 * URL to use for unified backend. 28 * 29 * The ?__plugin=ExtendedFileManager& is required. 30 */ 31 32 $IMConfig['backend_url'] = "backend.php?__plugin=ExtendedFileManager&"; 33 34 /** 35 * Backend Installation Directory 36 * 37 * location of backend install; these are used to link to css and js 38 * assets because we may have the front end installed in a different 39 * directory than the backend. (i.e. nothing assumes that the frontend 40 * and the backend are in the same directory) 41 */ 42 $IMConfig['base_dir'] = getcwd(); 43 $IMConfig['base_url'] = ''; 44 45 46 /* 23 47 File system path to the directory you want to manage the images 24 48 for multiple user systems, set it dynamically. 25 49 26 NOTE: This directory requires write access by PHP. That is, 50 NOTE: This directory requires write access by PHP. That is, 27 51 PHP must be able to create files in this directory. 28 52 Able to create directories is nice, but not necessary. 29 53 */ 30 $IMConfig['base_dir'] = $_SERVER['DOCUMENT_ROOT'].'/htmlarea/resources/'; 31 54 $IMConfig['images_dir'] = 'demo_images'; 32 55 33 56 /* 34 57 The URL to the above path, the web browser needs to be able to see it. … … 38 61 for this directory (i.e. disable PHP, Perl, CGI). We only want to store assets 39 62 in this directory and its subdirectories. 40 63 */ 41 $IMConfig[' base_url'] = 'http://www.afrusoft.com/htmlarea/resources/';64 $IMConfig['images_url'] = str_replace( "backend.php", "", $_SERVER["PHP_SELF"] ) . "demo_images"; 42 65 43 66 /* 44 67 Possible values: true, false … … 52 75 */ 53 76 $IMConfig['safe_mode'] = false; 54 77 55 56 78 /* 57 This sepcifies whether any image library is available to resize and edit images. 58 TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown. 79 This specifies whether any image library is available to resize and edit images.TRUE - Thumbnails will be resized by image libraries and if there is no library, default thumbnail will be shown. 59 80 FALSE - Thumbnails will be resized by browser ignoring image libraries. 60 81 */ 61 $IMConfig['img_library'] = false;82 $IMConfig['img_library'] = true; 62 83 63 84 64 85 /* 65 86 View type when the File manager is in insert image mode. 66 Valid values are "thumbview" and "listview". Default is thumbview.87 Valid values are "thumbview" and "listview". 67 88 */ 68 if($insertMode=="image") 89 90 if(empty($insertMode)) 91 $insertMode="image"; 92 93 if ($insertMode == 'image') 69 94 $IMConfig['view_type'] = "thumbview"; 70 else if($insertMode=="link") 95 96 else if($insertMode == "link") 71 97 $IMConfig['view_type'] = "listview"; 72 98 73 74 /* 75 View type when the File manager is in insert link mode. 76 Valid values are "thumbview" and "listview". Default is listview. 77 78 $IMConfig['linkmode_view_type'] = "listview"; 79 */ 99 $IMConfig['insert_mode'] = $insertMode; 80 100 81 101 /* 82 102 Possible values: 'GD', 'IM', or 'NetPBM' … … 85 105 If you have safe mode ON, or don't have the binaries to other packages, 86 106 your choice is 'GD' only. Other packages require Safe Mode to be off. 87 107 */ 88 define('IMAGE_CLASS', ' IM');108 define('IMAGE_CLASS', 'GD'); 89 109 90 110 91 111 /* … … 102 122 thumbnails files will be named as "prefix_imagefile.ext", that is, 103 123 prefix + orginal filename. 104 124 */ 105 $IMConfig['thumbnail_prefix'] = ' .';125 $IMConfig['thumbnail_prefix'] = 't_'; 106 126 107 127 108 128 /* 109 129 Thumbnail can also be stored in a directory, this directory 110 130 will be created by PHP. If PHP is in safe mode, this parameter 111 is ignored, you can not create directories. 131 is ignored, you can not create directories. 112 132 113 133 If you do not want to store thumbnails in a directory, set this 114 134 to false or empty string ''; 115 135 */ 116 $IMConfig['thumbnail_dir'] = '.thumbs'; 136 $IMConfig['thumbnail_dir'] = 't'; 137 138 /** 139 * Resized prefix 140 * 141 * The prefix for resized files, something like .resized will do. The 142 * resized files will be named <prefix>_<width>x<height>_<original> 143 * resized files are created when one changes the dimensions of an image 144 * in the image manager selection dialog - the image is scaled when the 145 * user clicks the ok button. 146 */ 147 148 $IMConfig['resized_prefix'] = '.resized'; 149 150 // ------------------------------------------------------------------------- 151 152 /** 153 * Resized Directory 154 * 155 * Resized images may also be stored in a directory, except in safe mode. 156 */ 117 157 158 $IMConfig['resized_dir'] = ''; 118 159 119 160 /* 120 161 Possible values: true, false … … 140 181 NOTE: If $IMConfig['img_library'] = false, this parameter 141 182 is ignored, you can not edit images. 142 183 */ 143 $IMConfig['allow_edit_image'] = false;184 $IMConfig['allow_edit_image'] = true; 144 185 145 186 146 187 /* … … 153 194 $IMConfig['allow_upload'] = true; 154 195 155 196 /* Maximum upload file size in Kilobytes */ 156 $IMConfig['max_filesize_kb'] = 50; 197 $IMConfig['max_filesize_kb_image'] = 2000; 198 199 $IMConfig['max_filesize_kb_link'] = 5000; 157 200 158 /* Maximum upload folder size in Megabytes */159 $IMConfig['max_foldersize_mb'] = 1;201 /* Maximum upload folder size in Megabytes. Use 0 to disable limit */ 202 $IMConfig['max_foldersize_mb'] = 0; 160 203 161 204 /* 162 205 Allowed extensions that can be shown and allowed to upload. … … 164 207 -Changed by AFRU. 165 208 */ 166 209 167 if($insertMode=="image") 168 $IMConfig['allowed_extensions'] = array("jpg","gif","png","bmp"); 169 else if($insertMode=="link") 170 $IMConfig['allowed_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf"); 171 210 $IMConfig['allowed_image_extensions'] = array("jpg","gif","png","bmp"); 211 $IMConfig['allowed_link_extensions'] = array("jpg","gif","js","php","pdf","zip","txt","psd","png","html","swf","xml","xls"); 172 212 173 213 174 214 /* … … 193 233 Image Editor temporary filename prefix. 194 234 */ 195 235 $IMConfig['tmp_prefix'] = '.editor_'; 236 237 238 // If config specified from front end, merge it 239 if(isset($_REQUEST['backend_config'])) 240 { 241 if(get_magic_quotes_gpc()) { 242 $_REQUEST['backend_config'] = stripslashes($_REQUEST['backend_config']); 243 } 244 245 // Config specified from front end, check that it's valid 246 session_start(); 247 $secret = $_SESSION[$_REQUEST['backend_config_secret_key_location']]; 248 249 if($_REQUEST['backend_config_hash'] !== sha1($_REQUEST['backend_config'] . $secret)) 250 { 251 die("Backend security error."); 252 } 253 254 $to_merge = unserialize($_REQUEST['backend_config']); 255 if(!is_array($to_merge)) 256 { 257 die("Backend config syntax error."); 258 } 259 260 $IMConfig = array_merge($IMConfig, $to_merge); 261 262 // changed config settings keys in relation to ImageManager 263 $IMConfig['backend_url'] .= "backend_config=" . rawurlencode($_REQUEST['backend_config']) . '&'; 264 $IMConfig['backend_url'] .= "backend_config_hash=" . rawurlencode($_REQUEST['backend_config_hash']) . '&'; 265 $IMConfig['backend_url'] .= "backend_config_secret_key_location=" . rawurlencode($_REQUEST['backend_config_secret_key_location']) . '&'; 266 267 } 268 269 // END 270 196 271 ?> 272 No newline at end of file -
editor.php
diff -u -r 10/editor.php 11/editor.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * ExtendedFileManager editor.php file. 4 * Authors: Wei Zhuo, Afru 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 9 10 10 11 require_once('config.inc.php'); 11 12 require_once('Classes/ExtendedFileManager.php'); 12 require_once(' Classes/ImageEditor.php');13 require_once('../ImageManager/Classes/ImageEditor.php'); 13 14 14 15 $manager = new ExtendedFileManager($IMConfig); 15 16 $editor = new ImageEditor($manager); … … 20 21 <html> 21 22 <head> 22 23 <title></title> 23 <link href="assets/editor.css" rel="stylesheet" type="text/css" /> 24 <script type="text/javascript" src="assets/slider.js"></script> 25 <script type="text/javascript" src="assets/popup.js"></script> 24 <link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" /> 25 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script> 26 <script type="text/javascript" src="../../popups/popup.js"></script> 27 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> 26 28 <script type="text/javascript"> 27 29 /*<![CDATA[*/ 28 window.resizeTo(673, 531); 30 31 var _backend_url = "<?php print $IMConfig['backend_url']; ?>"; 32 29 33 if(window.opener) 30 I18N = window.opener.I18N;34 HTMLArea = window.opener.HTMLArea; 31 35 /*]]>*/ 32 36 </script> 33 <script type="text/javascript" src=" assets/editor.js"></script>37 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script> 34 38 </head> 35 39 36 40 <body> 37 41 <div id="indicator"> 38 <img src=" img/spacer.gif" id="indicator_image" height="20" width="20" alt="" />42 <img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" /> 39 43 </div> 40 44 <div id="tools"> 41 45 <div id="tools_crop" style="display:none;"> … … 43 47 <label for="cx">Start X:</label><input type="text" id="cx" class="textInput" onchange="updateMarker('crop')"/> 44 48 <label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/> 45 49 <label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/> 46 <label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> 47 <img src="img/div.gif" height="30" width="2" class="div" alt="|" /> 50 <label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 48 51 </div> 49 <a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src=" img/btn_ok.gif" height="30" width="30" alt="OK" /></a>50 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src=" img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>52 <a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 53 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 51 54 </div> 52 55 <div id="tools_scale" style="display:none;"> 53 56 <div id="tool_inputs"> 54 57 <label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/> 55 <a href="javascript:toggleConstraints();" title="Lock"><img src=" img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label>58 <a href="javascript:toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label> 56 59 <input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/> 57 60 <input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/> 58 61 <label for="constProp">Constrain Proportions</label> 59 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />62 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 60 63 </div> 61 <a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src=" img/btn_ok.gif" height="30" width="30" alt="OK" /></a>62 <a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src=" img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>64 <a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 65 <a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 63 66 </div> 64 67 <div id="tools_rotate" style="display:none;"> 65 68 <div id="tool_inputs"> … … 78 81 <option value="-90">Rotate 90 ° CCW</option> 79 82 </select> 80 83 <label for="ra">Angle:</label><input type="text" id="ra" class="textInput" /> 81 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />84 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 82 85 </div> 83 <a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src=" img/btn_ok.gif" height="30" width="30" alt="OK" /></a>84 <a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src=" img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>86 <a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 87 <a href="javascript: editor.reset();" class="buttons" title="Cancle"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 85 88 </div> 86 89 <div id="tools_measure" style="display:none;"> 87 90 <div id="tool_inputs"> 88 91 <label>X:</label><input type="text" class="measureStats" id="sx" /> 89 92 <label>Y:</label><input type="text" class="measureStats" id="sy" /> 90 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />93 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 91 94 <label>W:</label><input type="text" class="measureStats" id="mw" /> 92 95 <label>H:</label><input type="text" class="measureStats" id="mh" /> 93 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />96 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 94 97 <label>A:</label><input type="text" class="measureStats" id="ma" /> 95 98 <label>D:</label><input type="text" class="measureStats" id="md" /> 96 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />99 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 97 100 <button type="button" onclick="editor.reset();" >Clear</button> 98 101 </div> 99 102 </div> 100 103 <div id="tools_save" style="display:none;"> 101 104 <div id="tool_inputs"> 102 <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<? echo $editor->getDefaultSaveFile();?>"/>105 <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/> 103 106 <select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)"> 104 107 <option value="" selected>Image Format</option> 105 108 <option value="">---------------------</option> … … 107 110 <option value="jpeg,60">JPEG Medium</option> 108 111 <option value="jpeg,35">JPEG Low</option> 109 112 <option value="png">PNG</option> 110 <? if($editor->isGDGIFAble() != -1) { ?>113 <?php if($editor->isGDGIFAble() != -1) { ?> 111 114 <option value="gif">GIF</option> 112 <? } ?>115 <?php } ?> 113 116 </select> 114 117 <label>Quality:</label> 115 118 <table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0"> 116 119 <tr> 117 120 <td> 118 121 <div id="slidercasing"> 119 <div id="slidertrack" style="width:100px"><img src=" img/spacer.gif" width="1" height="1" border="0" alt="track"></div>120 <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src=" img/spacer.gif" width="1" height="1" border="0" alt="track"></div>122 <div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> 123 <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> 121 124 </div> 122 125 </td> 123 126 </tr> 124 127 </table> 125 128 <input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/> 126 <img src=" img/div.gif" height="30" width="2" class="div" alt="|" />129 <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> 127 130 </div> 128 <a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src=" img/btn_ok.gif" height="30" width="30" alt="OK" /></a>129 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src=" img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a>131 <a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> 132 <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> 130 133 </div> 131 134 </div> 132 135 <div id="toolbar"> 133 <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src=" img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a>134 <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src=" img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a>135 <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src=" img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a>136 <a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src=" img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a>137 <a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src=" img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a>138 <a href="javascript:toggle('save')" id="icon_save" title="Save"><img src=" img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a>136 <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a> 137 <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a> 138 <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a> 139 <a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a> 140 <a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a> 141 <a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a> 139 142 </div> 140 143 <div id="contents"> 141 <iframe src=" editorFrame.php?img=<?if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe>144 <iframe src="<?php print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?php if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe> 142 145 </div> 143 146 <div id="bottom"></div> 144 147 </body> -
editorFrame.php
diff -u -r 10/editorFrame.php 11/editorFrame.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * ExtendedFileManager editorframe.php file. 4 * Authors: Wei Zhuo, Afru 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 9 10 10 11 require_once('config.inc.php'); 11 12 require_once('Classes/ExtendedFileManager.php'); 12 require_once(' Classes/ImageEditor.php');13 require_once('../ImageManager/Classes/ImageEditor.php'); 13 14 14 15 $manager = new ExtendedFileManager($IMConfig); 15 16 $editor = new ImageEditor($manager); … … 20 21 <html> 21 22 <head> 22 23 <title></title> 23 <link href=" assets/editorFrame.css" rel="stylesheet" type="text/css" />24 <script type="text/javascript" src=" assets/wz_jsgraphics.js"></script>25 <script type="text/javascript" src=" assets/EditorContent.js"></script>24 <link href="<?php print $IMConfig['base_url'];?>assets/editorFrame.css" rel="stylesheet" type="text/css" /> 25 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/wz_jsgraphics.js"></script> 26 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/EditorContent.js"></script> 26 27 <script type="text/javascript"> 27 if(window.top) 28 I18N = window.top.I18N; 28 var _backend_url = "<?php print $IMConfig['backend_url']; ?>"; 29 29 30 function i18n(str) { 31 if(I18N) 32 return (I18N[str] || str); 33 else 34 return str; 35 }; 36 37 var mode = "<? echo $editor->getAction(); ?>" //crop, scale, measure 30 if(window.top) 31 HTMLArea = window.top.HTMLArea; 38 32 39 var currentImageFile = "<? if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>"; 33 function i18n(str) { 34 return HTMLArea._lc(str, 'ImageManager'); 35 } 40 36 41 <? if ($editor->isFileSaved() == 1) { ?> 37 var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure 38 39 var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>"; 40 41 <?php if ($editor->isFileSaved() == 1) { ?> 42 42 alert(i18n('File saved.')); 43 <? } else if ($editor->isFileSaved() == -1) { ?> 43 44 window.parent.opener.parent.refresh(); 45 window.parent.opener.selectImage 46 ( 47 '<?php echo $imageInfo['saveFile'] ?>', 48 '<?php echo $imageInfo['saveFile'] ?>'.replace(/^.*\/?([^\/]*)$/, '$1'), 49 <?php echo $imageInfo['width'] ?>, 50 <?php echo $imageInfo['height'] ?> 51 ); 52 window.parent.close(); 53 54 <?php } else if ($editor->isFileSaved() == -1) { ?> 44 55 alert(i18n('File was not saved.')); 45 <? } ?>56 <?php } ?> 46 57 47 58 </script> 48 <script type="text/javascript" src=" assets/editorFrame.js"></script>59 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editorFrame.js"></script> 49 60 </head> 50 61 51 62 <body> 52 63 <div id="status"></div> 53 <div id="ant" class="selection" style="visibility:hidden"><img src=" img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>54 <? if ($editor->isGDEditable() == -1) { ?>64 <div id="ant" class="selection" style="visibility:hidden"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div> 65 <?php if ($editor->isGDEditable() == -1) { ?> 55 66 <div style="text-align:center; padding:10px;"><span class="error">GIF format is not supported, image editing not supported.</span></div> 56 <? } ?>67 <?php } ?> 57 68 <table height="100%" width="100%"> 58 69 <tr> 59 70 <td> 60 <? if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?>61 <span id="imgCanvas" class="crop"><img src="<? echo $imageInfo['src']; ?>" <?echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span>62 <? } else { ?>71 <?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?> 72 <span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span> 73 <?php } else { ?> 63 74 <span class="error">No Image Available</span> 64 <? } ?>75 <?php } ?> 65 76 </td> 66 77 </tr> 67 78 </table> -
extended-file-manager.js
diff -u -r 10/extended-file-manager.js 11/extended-file-manager.js
10 11 1 1 /** 2 2 * ExtendedFileManager extended-file-manager.js file. 3 3 * Authors: Wei Zhuo, Afru 4 * Modified by: Krzysztof Kotowicz <koto@webworkers.pl> 4 5 * Version: Updated on 08-01-2005 by Afru 5 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Modified on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 6 8 * http://www.afrusoft.com/htmlarea 7 9 */ 8 10 … … 32 34 33 35 function ExtendedFileManager(editor) 34 36 { 35 var tt = ExtendedFileManager.I18N;36 37 37 38 this.editor = editor; 38 39 39 40 var cfg = editor.config; 40 41 var toolbar = cfg.toolbar; 41 42 var self = this; 43 42 44 cfg.registerButton({ 43 45 id : "linkfile", 44 tooltip : "Insert File Link",46 tooltip : HTMLArea._lc("Insert File Link",'ExtendedFileManager'), 45 47 image : _editor_url + 'plugins/ExtendedFileManager/img/ed_linkfile.gif', 46 48 textMode : false, 47 49 action : function(editor) { … … 53 55 54 56 ExtendedFileManager._pluginInfo = { 55 57 name : "ExtendedFileManager", 56 version : "1. 0 beta",57 developer : "Afru ",58 version : "1.1", 59 developer : "Afru, Krzysztof Kotowicz", 58 60 developer_url : "http://www.afrusoft.com/htmlarea/", 59 61 license : "htmlArea" 60 62 }; 61 63 64 HTMLArea.Config.prototype.ExtendedFileManager = 65 { 66 'backend' : _editor_url + 'plugins/ExtendedFileManager/backend.php?__plugin=ExtendedFileManager&', 67 'backend_config' : null, 68 'backend_config_hash': null, 69 'backend_config_secret_key_location': 'Xinha:ImageManager' 70 }; 62 71 63 72 // Over ride the _insertImage function in htmlarea.js. 64 73 // Open up the ExtendedFileManger script instead. … … 82 91 f_height : image.height 83 92 }; 84 93 85 var manager = _editor_url + 'plugins/ExtendedFileManager/manager.php?mode=image'; 94 var manager = editor.config.ExtendedFileManager.backend + '__function=manager'; 95 if(editor.config.ExtendedFileManager.backend_config != null) 96 { 97 manager += '&backend_config=' 98 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); 99 manager += '&backend_config_hash=' 100 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); 101 manager += '&backend_config_secret_key_location=' 102 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); 103 } 86 104 87 105 Dialog(manager, function(param){ 88 106 if (!param) … … 91 109 } 92 110 93 111 var img = image; 94 if (!img) 95 { 96 var sel = editor._getSelection(); 97 var range = editor._createRange(sel); 98 editor._doc.execCommand("insertimage", false, param.f_url); 99 if (HTMLArea.is_ie) 100 { 112 if (!img) { 113 if (HTMLArea.is_ie) { 114 var sel = editor._getSelection(); 115 var range = editor._createRange(sel); 116 editor._doc.execCommand("insertimage", false, param.f_url); 101 117 img = range.parentElement(); 102 118 // wonder if this works... 103 if (img.tagName.toLowerCase() != "img") 104 { 119 if (img.tagName.toLowerCase() != "img") { 105 120 img = img.previousSibling; 106 121 } 122 123 } else { 124 img = document.createElement('img'); 125 img.src = param.f_url; 126 editor.insertNodeAtSelection(img); 107 127 } 108 else 109 { 110 img = range.startContainer.previousSibling; 111 } 112 } 113 else 114 { 128 129 } else { 115 130 img.src = param.f_url; 116 131 } 117 132 … … 137 152 138 153 }; 139 154 140 141 142 143 155 HTMLArea.prototype._linkFile = function(link) { 144 156 145 157 var editor = this; … … 163 175 compare = range.compareBoundaryPoints(range.START_TO_END, range); 164 176 } 165 177 if (compare == 0) { 166 alert( "Please select some text to link to.");178 alert(HTMLArea._lc("You must select some text before making a new link.", 'ExtendedFileManager')); 167 179 return; 168 180 } 169 181 outparam = { … … 182 194 183 195 184 196 var manager = _editor_url + 'plugins/ExtendedFileManager/manager.php?mode=link'; 197 if(editor.config.ExtendedFileManager.backend_config != null) 198 { 199 manager += '&backend_config=' 200 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config); 201 manager += '&backend_config_hash=' 202 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_hash); 203 manager += '&backend_config_secret_key_location=' 204 + encodeURIComponent(editor.config.ExtendedFileManager.backend_config_secret_key_location); 205 } 185 206 186 207 Dialog(manager, function(param){ 187 208 if (!param) … … 221 242 editor.updateToolbar(); 222 243 }, outparam); 223 244 224 } 225 245 } 246 No newline at end of file -
images.php
Only in 11: ExtendedFileManager.tgz diff -u -r 10/images.php 11/images.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * ExtendedFileManager images.php file. Shows folders and files. 4 * Authors: Wei Zhuo, Afru 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 10 9 11 if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode']; 10 12 if(!isset($insertMode)) $insertMode="image"; 11 13 … … 14 16 15 17 //default path is / 16 18 $relative = '/'; 17 $manager = new ExtendedFileManager($IMConfig );19 $manager = new ExtendedFileManager($IMConfig, $insertMode); 18 20 19 21 //process any file uploads 20 22 $uploadStatus=$manager->processUploads(); 21 23 22 $manager->deleteFiles(); 23 24 if ($manager->deleteFiles()) 25 $refreshFile = true; 24 26 25 27 $refreshDir = false; 26 28 //process any directory functions … … 47 49 $afruViewType=$_REQUEST['viewtype']; 48 50 } 49 51 if($afruViewType!="thumbview" && $afruViewType!="listview") 50 $afruViewType=$IMConfig['view_type'];51 52 53 54 $manager = new ExtendedFileManager($IMConfig);55 52 53 $afruViewType=$IMConfig['view_type']; 56 54 57 55 //get the list of files and directories 58 56 $list = $manager->getFiles($relative); … … 68 66 { 69 67 global $relative, $afruViewType, $IMConfig, $insertMode; 70 68 69 switch ($afruViewType) { 70 case 'listview': 71 $maxNameLength = 30; 72 ?> 73 <table class="listview"> 74 <thead> 75 <tr><th colspan="2">Name</th><th>Size</th><th>Image Size</th><th>Date Modified</th><th> </th></tr></thead> 76 <tbody> 77 <?php 78 // start of foreach for draw listview folders . 79 foreach($list[0] as $path => $dir) 80 { ?> 81 <tr> 82 <td><img src="<?php print $IMConfig['base_url'];?>icons/folder_small.gif" alt="" /></td> 83 <th nowrap><a href="<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"> 84 <?php 85 if(strlen($dir['entry'])>$maxNameLength) echo substr($dir['entry'],0,$maxNameLength)."..."; else echo $dir['entry']; 86 ?> 87 </a></th> 88 <td colspan="2" nowrap>Folder</td> 89 90 <td nowrap><?php echo date("d.m.y H:i",$dir['stat']['mtime']); ?></td> 91 92 <td class="actions" nowrap> 93 <a href="<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);" style="border:0px;"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a> 94 </td> 95 </tr> 96 <?php 97 } // end of foreach for draw listview folders . 98 99 clearstatcache(); 100 101 // start of foreach for draw listview files . 102 foreach($list[1] as $entry => $file) 103 { 104 ?> 105 <tr> 106 <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 } ?> > 108 <?php 109 if(strlen($entry)>$maxNameLength) echo substr($entry,0,$maxNameLength)."..."; else echo $entry; 110 ?> 111 </a></th> 112 <td><?php echo Files::formatSize($file['stat']['size']); ?></td> 113 <td><?php if($file['image'][0] > 0){ echo $file['image'][0].'x'.$file['image'][1]; } ?></td> 114 <td nowrap><?php echo date("d.m.y H:i",$file['stat']['mtime']); ?></td> 115 <td class="actions"> 116 <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> 117 <?php if($IMConfig['img_library'] && $IMConfig['allow_edit_image'] && $file['image'][0] > 0) { ?> 118 <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> 119 <?php } ?> 120 </td> 121 </tr> 122 <?php 123 }//end of foreach of draw listview files 124 ?> 125 </tbody> 126 </table> 127 <?php 128 break; 129 case 'thumbview': // thumbview is default 130 default: 131 $maxFileNameLength=10; 132 $maxFolderNameLength=13; 133 // start of foreach for draw thumbview folders. 134 foreach($list[0] as $path => $dir) 135 { ?> 136 <div class="dir_holder"> 137 <a class="dir" href="<?php print $IMConfig['backend_url'];?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" onclick="updateDir('<?php echo $path; ?>')" title="<?php echo $dir['entry']; ?>"><img src="<?php print $IMConfig['base_url'];?>img/folder.gif" height="80" width="80" alt="<?php echo $dir['entry']; ?>" /></a> 138 139 <div class="edit"> 140 <a href="<?php print $IMConfig['backend_url'];?>__function=images&mode=<?php echo $insertMode;?>&dir=<?php echo $relative; ?>&deld=<?php echo rawurlencode($path); ?>&viewtype=<?php echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<?php echo $dir['entry']; ?>', <?php echo $dir['count']; ?>);"><img src="<?php print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash" /></a> 141 <?php if(strlen($dir['entry']) > $maxFolderNameLength) 142 echo substr($dir['entry'], 0, $maxFolderNameLength) . "..."; 143 else 144 echo $dir['entry']; ?> 145 </div> 146 </div> 147 <?php 148 } // end of foreach for draw thumbview folders. 149 150 151 // start of foreach for draw thumbview files. 152 foreach($list[1] as $entry => $file) 153 { 154 $afruimgdimensions=$manager->checkImageSize($file['relative']); 155 ?> 156 <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']); ?>"> 158 <img src="<?php print $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>" /> 159 </a> 160 <div class="edit"> 161 <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 163 <?php if($IMConfig['img_library'] && $IMConfig['allow_edit_image'] && $file['image'][0] > 0 ) 164 { ?> 165 <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; ?> 168 169 <?php 170 if(strlen($entry)>$maxFileName2) echo strtolower(substr($entry,0,$maxFileName2))."..."; else echo $entry; 171 ?> 172 </div> 173 </div> 174 <?php 175 }//end of foreach of draw thumbview files 71 176 72 if($afruViewType!="thumbview" && $afruViewType!="listview") 73 $afruViewType="thumbview"; 74 75 if($afruViewType=="thumbview") 76 { 77 78 $maxFileNameLength=10; 79 $maxFolderNameLength=13; 80 $numCols=5; 81 $cnt=1; 82 // start of foreach for draw thumbview folders. 83 foreach($list[0] as $path => $dir) 84 { ?> 85 <td style="padding:6px;"><table cellpadding="0" cellspacing="0"><tr> 86 <td class="block" style="<? echo 'width:'.$IMConfig['thumbnail_width'].'px; height:'.$IMConfig['thumbnail_height'].'px;'; 87 ?> cursor:pointer; padding:1px;"><a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo rawurlencode($path); ?>&viewtype=<? echo $afruViewType; ?>" onclick="updateDir('<? echo $path; ?>')" title="<? echo $dir['entry']; ?>"><img src="img/folder.gif" alt="<? echo $dir['entry']; ?>" /></a> 88 </td></tr><tr> 89 <td class="edit" nowrap> 90 <a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo $relative; ?>&deld=<? echo rawurlencode($path); ?>&viewtype=<? echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<? echo $dir['entry']; ?>', <? echo $dir['count']; ?>);"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> 91 92 <? if(strlen($dir['entry'])>$maxFolderNameLength) echo substr($dir['entry'],0,$maxFolderNameLength)."..."; else echo $dir['entry']; ?> 93 94 95 </td> 96 </tr></table></td> 97 <? 98 $cnt++; 99 if($cnt%$numCols==1) echo "</tr><tr>"; 100 } // end of foreach for draw thumbview folders. 101 102 103 // start of foreach for draw thumbview files. 104 foreach($list[1] as $entry => $file) 105 { 106 $afruimgdimensions=$manager->checkImageSize($file['relative']); 107 ?> 108 <td style="padding:6px;"><table cellpadding="0" cellspacing="0"> 109 <tr><td class="block" style="<? echo 'width:'.$IMConfig['thumbnail_width'].'px; height:'.$IMConfig['thumbnail_height'].'px;'; 110 ?> cursor:pointer; padding:1px;" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);" title="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"> 111 <img src="<? echo $manager->getThumbnail($file['relative']); ?>" alt="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>" <? if($afruimgdimensions[0]) echo 'width="'.$afruimgdimensions[0].'"'; ?> <? if($afruimgdimensions[1]) echo 'height="'.$afruimgdimensions[1].'"'; ?> /> 112 </td></tr> 113 114 <tr><td class="edit" nowrap> 115 <a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo $relative; ?>&delf=<? echo rawurlencode($file['relative']);?>&viewtype=<? echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a> 116 117 <? if($IMConfig['img_library'] && $IMConfig['allow_edit_image']) 118 { ?> <a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a> 119 <?$maxFileName2=$maxFileNameLength-3;} 120 else $maxFileName2=$maxFileNameLength; ?> 121 122 123 <? 124 if(strlen($entry)>$maxFileName2) echo strtolower(substr($entry,0,$maxFileName2))."..."; else echo $entry; 125 ?> 126 127 </td></tr></table> 128 </td> 129 <? 130 $cnt++; 131 if($cnt%$numCols==1) echo "</tr><tr>"; 132 }//end of foreach of draw thumbview files 133 $cnt--; 134 135 //Calculate empty colums at the end of display and add them as empty <TD></TD>. 136 $emptyTDs=($numCols-($cnt%$numCols)); 137 for($i=0;$i<$emptyTDs;$i++) echo"<td></td>"; 138 }//end of thumbview 139 140 141 else if($afruViewType=="listview") 142 { 143 $maxNameLength=50; 144 ?> 145 146 <td class="lsviewheader"> </td><td class="lsviewheader" width="100%">Name</td> <td class="lsviewheader">Size</td><td class="lsviewheader" nowrap>Date Modified</td> 147 <td class="lsviewheader"> </td> 148 </tr> 149 <? 150 // start of foreach for draw listview folders . 151 foreach($list[0] as $path => $dir) 152 { ?> 153 <tr> 154 <td class="lsviewpanel"><img src="icons/folder_small.gif"></td> 155 156 <td class="lsviewpanel" nowrap><a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo rawurlencode($path); ?>&viewtype=<? echo $afruViewType; ?>" onclick="updateDir('<? echo $path; ?>')" title="<? echo $dir['entry']; ?>"> 157 <? 158 if(strlen($dir['entry'])>$maxNameLength) echo substr($dir['entry'],0,$maxNameLength)."..."; else echo $dir['entry']; 159 ?> 160 </a></td> 161 162 <td class="lsviewpanel" nowrap style="padding-right:20px;">Folder</td> 163 164 <td class="lsviewpanel" nowrap style="padding-right:20px;"><? echo date("d.m.y H:i",$dir['stat']['mtime']); ?></td> 165 166 <td class="edit" nowrap style="padding-right:20px;"> 167 <a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo $relative; ?>&deld=<? echo rawurlencode($path); ?>&viewtype=<? echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteDir('<? echo $dir['entry']; ?>', <? echo $dir['count']; ?>);" style="border:0px;"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash" border="0"/></a> 168 </td> 169 </tr> 170 <? 171 } // end of foreach for draw listview folders . 172 173 clearstatcache(); 174 // start of foreach for draw listview files . 175 foreach($list[1] as $entry => $file) 176 { 177 ?> 178 <tr> 179 <td class="lsviewpanel"><img src="<? if(is_file('icons/'.$file['ext'].'_small.gif')) echo "icons/".$file['ext']."_small.gif"; else echo $IMConfig['default_listicon']; ?>"></td> 180 181 <td class="lsviewpanel" nowrap> <a href="#" onclick="return selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);" title="<? echo $entry; ?>" > 182 <? 183 if(strlen($entry)>$maxNameLength) echo substr($entry,0,$maxNameLength)."..."; else echo $entry; 184 ?> 185 </a></td> 186 187 <td class="lsviewpanel" nowrap style="padding-right:20px;"><? echo Files::formatSize($file['stat']['size']); ?></td> 188 189 <td class="lsviewpanel" nowrap style="padding-right:20px;"><? echo date("d.m.y H:i",$file['stat']['mtime']); ?></td> 190 191 <td class="edit" nowrap style="padding-right:20px;"><a href="images.php?mode=<?echo $insertMode;?>&dir=<? echo $relative; ?>&delf=<? echo rawurlencode($file['relative']);?>&viewtype=<? echo $afruViewType; ?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash" border=0/></a> 192 193 <? if($IMConfig['img_library'] && $IMConfig['allow_edit_image']) 194 { ?> <a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/ border=0></a> <? }?> 195 </td> 196 </tr> 197 198 <? 199 }//end of foreach of draw listview files 200 201 202 203 }// end of listview 204 177 } 205 178 }//end of function drawDirs_Files 206 179 207 180 … … 211 184 function drawNoResults() 212 185 { 213 186 ?> 214 <table width="100%"> 215 <tr> 216 <td class="noResult">No Files Found</td> 217 </tr> 218 </table> 219 <? 187 <div class="noResult">No Files Found</div> 188 <?php 220 189 } 221 190 222 191 /** … … 225 194 function drawErrorBase(&$manager) 226 195 { 227 196 ?> 228 <table width="100%"> 229 <tr> 230 <td class="error">Invalid base directory: <? echo $manager->config['base_dir']; ?></td> 231 </tr> 232 </table> 233 <? 197 <div class="error"><span>Invalid base directory:</span> <?php echo $manager->config['images_dir']; ?></div> 198 <?php 234 199 } 235 200 236 ?> 237 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 201 /** 202 * Utility to convert ascii string to hex 203 */ 204 function asc2hex ($temp) 205 { 206 $data = ''; 207 $len = strlen($temp); 208 for ($i=0; $i<$len; $i++) $data.=sprintf("%02x",ord(substr($temp,$i,1))); 209 return $data; 210 } 238 211 212 ?> 239 213 <html> 240 214 <head> 241 215 <title>File List</title> 242 216 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 243 <link href=" assets/imagelist.css" rel="stylesheet" type="text/css" />244 <script type="text/javascript" src=" assets/dialog.js"></script>217 <link href="<?php print $IMConfig['base_url'];?>assets/imagelist.css" rel="stylesheet" type="text/css" /> 218 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script> 245 219 <script type="text/javascript"> 246 220 /*<![CDATA[*/ 247 221 222 var _backend_url = "<?php print $IMConfig['backend_url']; ?>"; 223 248 224 if(window.top) 249 I18N = window.top.I18N;225 HTMLArea = window.top.HTMLArea; 250 226 251 227 function hideMessage() 252 228 { … … 258 234 259 235 init = function() 260 236 { 237 __dlg_translate('ExtendedFileManager'); 238 261 239 hideMessage(); 262 240 263 <? 241 <?php 264 242 if(isset($uploadStatus) && !is_numeric($uploadStatus) && !is_bool($uploadStatus)) 265 243 echo 'alert("'.$uploadStatus.'");'; 266 244 else if(isset($uploadStatus) && $uploadStatus==false) 267 echo 'alert("Unable to upload File. \nEither Maximum file size ['. $IMConfig['max_filesize_kb'].'Kb] exceeded or\nFolder doesn\'t have write permission.");';245 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.");'; 268 246 ?> 269 247 270 248 271 249 var topDoc = window.top.document; 272 250 273 <? 251 <?php 274 252 //we need to refesh the drop directory list 275 253 //save the current dir, delete all select options 276 254 //add the new list, re-select the saved dir. … … 284 262 while(selection.length > 0) 285 263 { selection.remove(0); } 286 264 287 selection.options[selection.length] = new Option("/","<? echo rawurlencode('/'); ?>");288 <? foreach($dirs as $relative=>$fullpath) { ?>289 selection.options[selection.length] = new Option("<? echo $relative; ?>","<? echo rawurlencode($relative); ?>");290 <? } ?>265 selection.options[selection.length] = new Option("/","<?php echo rawurlencode('/'); ?>"); 266 <?php foreach($dirs as $relative=>$fullpath) { ?> 267 selection.options[selection.length] = new Option("<?php echo $relative; ?>","<?php echo rawurlencode($relative); ?>"); 268 <?php } ?> 291 269 292 270 for(var i = 0; i < selection.length; i++) 293 271 { … … 298 276 break; 299 277 } 300 278 } 301 <? } ?>302 } 303 279 <?php } ?> 280 } 281 304 282 function editImage(image) 305 283 { 306 var url = " editor.php?img="+image;307 Dialog(url, function(param) 284 var url = "<?php print $IMConfig['backend_url']; ?>__function=editor&img="+image; 285 Dialog(url, function(param) 308 286 { 309 if (!param) // user must have pressed Cancel287 if (!param) { // user must have pressed Cancel 310 288 return false; 311 else289 } else 312 290 { 313 291 return true; 314 292 } 315 }, null); 293 }, null); 316 294 } 317 295 318 296 /*]]>*/ 319 297 </script> 320 <script type="text/javascript" src=" assets/images.js"></script>321 322 < SCRIPT LANGUAGE="JavaScript">298 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/images.js"></script> 299 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> 300 <script type="text/javascript"> 323 301 <!-- 324 if(window.top.document.getElementById('manager_mode').value=="image") 325 emptyProperties(); 326 <? if(isset($diskInfo)) echo 'updateDiskMesg("'.$diskInfo.'");'; ?> 302 // Koto: why emptying? commented out 303 //if(window.top.document.getElementById('manager_mode').value=="image") 304 //emptyProperties(); 305 <?php if(isset($diskInfo)) echo 'updateDiskMesg("'.$diskInfo.'");'; ?> 327 306 //--> 328 </ SCRIPT>307 </script> 329 308 330 309 </head> 331 310 332 <body wrap="off">333 <? if ($manager->isValidBase() == false) { drawErrorBase($manager); }311 <body> 312 <?php if ($manager->isValidBase() == false) { drawErrorBase($manager); } 334 313 elseif(count($list[0]) > 0 || count($list[1]) > 0) { ?> 335 336 337 338 339 <TABLE border=0 cellpadding=0 cellspacing=0> 340 <tr> 341 <? drawDirs_Files($list, $manager); ?> 342 </tr> 343 </table> 344 <? } else { drawNoResults(); } ?> 314 <?php drawDirs_Files($list, $manager); ?> 315 <?php } else { drawNoResults(); } ?> 345 316 </body> 346 317 </html> -
manager.php
Only in 10/img: Thumbs.db Only in 10/lang: en.js Only in 11/lang: pl.js diff -u -r 10/manager.php 11/manager.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * The main GUI for the ExtendedFileManager. 4 * Authors: Wei Zhuo, Afru 4 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 5 5 * Version: Updated on 08-01-2005 by Afru 6 * Package: ExtendedFileManager (EFM 1.0 beta) 6 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 7 * Package: ExtendedFileManager (EFM 1.1) 7 8 * http://www.afrusoft.com/htmlarea 8 9 */ 9 10 … … 18 19 19 20 ?> 20 21 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 21 22 22 <html> 23 23 <head> 24 24 <title>Insert File</title> 25 25 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 26 <link href="assets/manager.css" rel="stylesheet" type="text/css" /> 27 <script type="text/javascript" src="assets/popup.js"></script> 28 <script type="text/javascript" src="assets/dialog.js"></script> 26 <link href="<?php print $IMConfig['base_url'];?>assets/manager.css" rel="stylesheet" type="text/css" /> 27 <script type="text/javascript" src="../../popups/popup.js"></script> 28 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> 29 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/dialog.js"></script> 29 30 <script type="text/javascript"> 30 /*<![CDATA[*/ 31 window.resizeTo(600, 460); 31 /* <![CDATA[ */ 32 32 33 33 if(window.opener) 34 I18N = window.opener.ExtendedFileManager.I18N; 35 36 var thumbdir = "<? echo $IMConfig['thumbnail_dir']; ?>"; 37 var base_url = "<? echo $manager->getBaseURL(); ?>"; 38 39 <? 34 HTMLArea = window.opener.HTMLArea; 35 36 var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>"; 37 var base_url = "<?php echo $manager->getImagesURL(); ?>"; 38 var _backend_url = "<?php print $IMConfig['backend_url']; ?>"; 39 var _resized_prefix = "<?php echo $IMConfig['resized_prefix']; ?>"; 40 var _resized_dir = "<?php echo $IMConfig['resized_dir']; ?>"; 41 <?php 40 42 if(isset($_REQUEST['mode'])) 41 43 { 42 44 echo 'var manager_mode="'.$_REQUEST['mode'].'";'; … … 46 48 echo 'var manager_mode="image";'; 47 49 } 48 50 ?> 49 /*]]>*/ 51 52 /* ]]> */ 50 53 </script> 51 <script type="text/javascript" src=" assets/manager.js"></script>54 <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/manager.js"></script> 52 55 </head> 53 56 <body> 54 57 <div class="title">File Manager</div> 55 <form action="images.php?mode=<?echo $insertMode;?>" id="uploadForm" method="post" enctype="multipart/form-data"> 58 <form action="<?php print $IMConfig['backend_url']; ?>" id="uploadForm" method="post" enctype="multipart/form-data"> 59 <input type="hidden" name="__plugin" value="ExtendedFileManager" /> 60 <input type="hidden" name="__function" value="images" /> 61 <input type="hidden" name="mode" value="<?php echo $insertMode; ?>" /> 62 <input type="hidden" id="manager_mode" value="<?php echo $insertMode;?>" /> 56 63 <fieldset><legend>File Manager</legend> 57 58 59 <TABLE border=0 cellpadding=0 cellspacing=0> 60 <TR> 61 <TD nowrap style="padding:10px;"> 64 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 65 <tr> 66 <td nowrap style="padding:10px;"> 62 67 63 68 <label for="dirPath">Directory</label> 64 69 <select name="dir" class="dirWidth" id="dirPath" onchange="updateDir(this)"> 65 70 <option value="/">/</option> 66 <? foreach($dirs as $relative=>$fullpath) { ?>67 <option value="<? echo rawurlencode($relative); ?>"><?echo $relative; ?></option>68 <? } ?>71 <?php foreach($dirs as $relative=>$fullpath) { ?> 72 <option value="<?php echo rawurlencode($relative); ?>"><?php echo $relative; ?></option> 73 <?php } ?> 69 74 </select> 70 75 71 <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src=" img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a>76 <a href="#" onclick="javascript: goUpDir();" title="Directory Up"><img src="<?php print $IMConfig['base_url'];?>img/btnFolderUp.gif" height="15" width="15" alt="Directory Up" /></a> 72 77 73 78 74 <? if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?>75 <a href="#" onclick="newFolder();" title="New Folder"><img src=" img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a>76 <? } ?>79 <?php if($IMConfig['safe_mode'] == false && $IMConfig['allow_new_dir']) { ?> 80 <a href="#" onclick="newFolder();" title="New Folder"><img src="<?php print $IMConfig['base_url'];?>img/btnFolderNew.gif" height="15" width="15" alt="New Folder" /></a> 81 <?php } ?> 77 82 78 83 <select name="viewtype" id="viewtype" onChange="updateView()"> 79 <option value="thumbview" <? if($IMConfig['view_type']=="thumbview") echo "selected";?> >Thumbnail View</option>80 <option value="listview" <? if($IMConfig['view_type']=="listview") echo "selected";?> >List View</option>84 <option value="thumbview" <?php if($IMConfig['view_type']=="thumbview") echo "selected";?> >Thumbnail View</option> 85 <option value="listview" <?php if($IMConfig['view_type']=="listview") echo "selected";?> >List View</option> 81 86 </select> 82 83 84 </TD> 85 </TR> 86 87 <TR><TD style="padding:10px; padding-top:0px;"> 88 89 <div id="messages" style="display: none;"><span id="message"></span><img SRC="img/dots.gif" width="22" height="12" alt="..." /></div> 90 <iframe src="images.php?mode=<?echo $insertMode;?>" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> 91 92 </TD></TR> 93 94 </TABLE> 87 </td> 88 </tr> 89 <tr><td style="padding:10px; padding-top:0px;"> 90 <div id="messages" style="display: none;"><span id="message"></span><img src="<?php print $IMConfig['base_url'];?>img/dots.gif" width="22" height="12" alt="..." /></div> 91 <iframe src="<?php print $IMConfig['backend_url']; ?>__function=images&mode=<?php echo $insertMode;?>&viewtype=<?php echo $IMConfig['view_type'] ?>" name="imgManager" id="imgManager" class="imageFrame" scrolling="auto" title="Image Selection" frameborder="0"></iframe> 92 </td></tr> 93 </table> 95 94 </fieldset> 95 <!-- temp --> 96 <!-- /temp --> 96 97 <!-- image properties --> 97 98 <table class="inputTable"> 98 99 <tr> 99 <td align="right" nowrap><label for="f_url"><?if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td> 100 <td><input type="text" id="<?if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td> 101 <td rowspan="3" align="right"><input type="hidden" id="manager_mode" value="<?echo $insertMode;?>"> </td> 102 103 <td align="right"><? if($insertMode=='image') { ?> <label for="f_width">Width</label><?}?></td> 104 105 <td><? if($insertMode=='image') { ?> <input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/><?} else echo "        ";?></td> 106 107 <td rowspan="2" align="right"><? if($insertMode=='image') { ?><img src="img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /><?}?></td> 108 109 <td rowspan="3" align="right"> </td> 110 111 <td align="right"><? if($insertMode=='image') { ?><label for="f_vert">V Space</label><?}?></td> 112 113 <td><?if($insertMode=='image') { ?><input type="text" id="f_vert" class="smallWidth" value="" /><?} else if($insertMode=="link") {?><label for="f_align">Target Window</label><?}?></td> 114 </tr> 115 <tr> 116 <td align="right"><label for="f_alt"><?if($insertMode=='image') echo 'Alt'; else echo 'Title (tooltip)';?></label></td> 117 <td><input type="text" id="<?if($insertMode=='image') echo 'f_alt'; else echo 'f_title';?>" class="largelWidth" value="" /></td> 118 119 <td align="right"><?if($insertMode=='image') { ?><label for="f_height">Height</label><?}?></td> 120 121 <td><?if($insertMode=='image') { ?><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/><?}?></td> 122 123 <td align="right"><?if($insertMode=='image') { ?><label for="f_horiz">H Space</label><?}?></td> 124 125 <td><?if($insertMode=='image') { ?><input type="text" id="f_horiz" class="smallWidth" value="" /><?}else if($insertMode=='link') { ?> 100 <td align="right" nowrap><label for="f_url"><?php if($insertMode=='image') echo 'File Name'; else echo 'URL';?></label></td> 101 <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_url'; else echo 'f_href';?>" class="largelWidth" value="" /></td> 102 <td rowspan="7" valign="top"><?php if($insertMode=='image') { ?> 103 <div style="padding:4px;background-color:#CCC;border:1px inset;width: 100px; height: 100px;"> 104 <img src="" id="f_preview" /> 105 </div> 106 <?php } else if($insertMode=="link") {?><label for="f_align">Target Window</label> 126 107 <select id="f_target" style="width:125px;"> 127 108 <option value="">None (use implicit)</option> 128 109 <option value="_blank">New window (_blank)</option> 129 110 <option value="_self">Same frame (_self)</option> 130 111 <option value="_top">Top frame (_top)</option> 131 </select> 132 <?}?></td> 112 </select><br /><br /> 113 <input type="text" name="f_other_target" id="f_other_target" style="visibility:hidden; width:120px;" /> 114 <?php } ?></td> 133 115 </tr> 134 116 <tr> 135 <? 136 if(Files::dirSize($manager->getBaseDir())>($IMConfig['max_foldersize_mb']*1048576)) 117 <td align="right"><label for="f_alt"><?php if($insertMode=='image') echo 'Alt'; else echo 'Title (tooltip)';?></label></td> 118 <td colspan="5"><input type="text" id="<?php if($insertMode=='image') echo 'f_alt'; else echo 'f_title';?>" class="largelWidth" value="" /></td> 119 </tr> 120 <tr> 121 <?php 122 if (!empty($IMConfig['max_foldersize_mb']) && Files::dirSize($manager->getImagesDir()) > ($IMConfig['max_foldersize_mb']*1048576)) 137 123 { ?> 138 <td colspan=" 2" align="right">Maximum folder size limit reached. Upload disabled.</td>139 <? }140 else if($IMConfig['allow_upload'] == true) { ?>124 <td colspan="6" align="right">Maximum folder size limit reached. Upload disabled.</td> 125 <?php } 126 else if($IMConfig['allow_upload']) { ?> 141 127 <td align="right"><label for="upload">Upload</label></td> 142 <td >128 <td colspan="5"> 143 129 <table cellpadding="0" cellspacing="0" border="0"> 144 130 <tr> 145 <td><input type="hidden" name="MAX_FILE_SIZE" value="<? echo ($IMConfig['max_filesize_kb']*1024); ?>" />146 <input type="file" name="upload" id="upload" /></td>147 <td> <button type="submit" name="submit" onclick="doUpload();"/>Upload</button></td>131 <td><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo (($insertMode == 'image' ? $IMConfig['max_filesize_kb_image'] : $IMConfig['max_filesize_kb_link'] )*1024); ?>" /> 132 <input type="file" name="upload" id="upload" /></td> 133 <td><button type="submit" name="submit" onclick="doUpload();">Upload</button></td> 148 134 </tr> 149 135 </table> 150 136 </td> 151 <? } else { ?> 152 <td colspan="2"></td> 153 <? } ?> 154 <td align="right"><?if($insertMode=='image') { ?><label for="f_align">Align</label><?}?></td> 137 <?php } else { ?> 138 <td colspan="6"></td> 139 <?php } ?> 140 </tr> 141 <tr> 142 <td></td> 143 <td colspan="5"> <span id="diskmesg"></span></td> 144 </tr> 145 <tr> 146 <td align="right"><?php if($insertMode=='image') { ?> <label for="f_width">Width</label><?php }?></td> 147 148 <td><?php if($insertMode=='image') { ?> <input type="text" id="f_width" class="smallWidth" value="" onchange="javascript:checkConstrains('width');"/><?php } else echo "        ";?></td> 149 150 <td rowspan="2"><?php if($insertMode=='image') { ?><img src="<?php print $IMConfig['base_url'];?>img/locked.gif" id="imgLock" width="25" height="32" alt="Constrained Proportions" /> 151 <input type="hidden" id="orginal_width" /> 152 <input type="hidden" id="orginal_height" /> 153 <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" /><br /> 154 <label for="constrain_prop">Constrain Proportions</label><?php }?> 155 </td> 156 157 <td rowspan="3" align="right"></td> 158 159 <td align="right"><?php if($insertMode=='image') { ?><label for="f_vert">V Space</label><?php }?></td> 155 160 156 <td colspan="2"><?if($insertMode=='image') { ?> 161 <td><?php if($insertMode=='image') { ?><input type="text" id="f_vert" class="smallWidth" value="" /><?php } ?></td> 162 </tr> 163 <tr> 164 <td align="right"><?php if($insertMode=='image') { ?><label for="f_height">Height</label><?php }?></td> 165 166 <td><?php if($insertMode=='image') { ?><input type="text" id="f_height" class="smallWidth" value="" onchange="javascript:checkConstrains('height');"/><?php }?></td> 167 168 <td align="right"><?php if($insertMode=='image') { ?><label for="f_horiz">H Space</label><?php }?></td> 169 170 <td><?php if($insertMode=='image') { ?><input type="text" id="f_horiz" class="smallWidth" value="" /> 171 <?php }?></td> 172 </tr> 173 <tr> 174 <td align="right"><?php if($insertMode=='image') { ?><label for="f_align">Align</label><?php }?></td> 175 176 <td colspan="2"><?php if($insertMode=='image') { ?> 157 177 <select size="1" id="f_align" title="Positioning of this image"> 158 <option value="" >Not Set</option>178 <option value="" >Not set</option> 159 179 <option value="left" >Left</option> 160 180 <option value="right" >Right</option> 161 181 <option value="texttop" >Texttop</option> … … 165 185 <option value="bottom" >Bottom</option> 166 186 <option value="middle" >Middle</option> 167 187 <option value="top" >Top</option> 168 </select><? }?>188 </select><?php } ?> 169 189 </td> 170 190 171 <td align="right"><?if($insertMode=='image') { ?><label for="f_border">Border</label><?}?></td> 172 <td><?if($insertMode=='image') { ?><input type="text" id="f_border" class="smallWidth" value="" /><?}else if($insertMode=='link') { ?><input type="text" name="f_other_target" id="f_other_target" style="visibility:hidden; width:120px;" /><?}?></td> 173 </tr> 174 <tr> 175 <td></td> 176 <td> <span id="diskmesg"></span><? 177 /* 178 */ 191 <td align="right"><?php if($insertMode=='image') { ?><label for="f_border">Border</label><?php }?></td> 192 <td><?php if($insertMode=='image') { ?><input type="text" id="f_border" class="smallWidth" value="" /><?php }?></td> 193 194 </tr> 195 </table> 179 196 180 ?></td>181 <td colspan="2" align="right"><?if($insertMode=='image') { ?>182 <input type="hidden" id="orginal_width" />183 <input type="hidden" id="orginal_height" />184 <input type="checkbox" id="constrain_prop" checked="checked" onclick="javascript:toggleConstrains(this);" /><?}?>185 </td>186 <td colspan="5"><?if($insertMode=='image') { ?><label for="constrain_prop">Constrain Proportions</label><?}?></td>187 </tr>188 </table>189 197 <!--// image properties --> 190 198 <div style="text-align: right;"> 191 199 <hr /> -
Readme.txt
Only in 10: newFolder.html diff -u -r 10/Readme.txt 11/Readme.txt
10 11 1 Package : Extended File Manager EFM 1. 0 Beta1 Package : Extended File Manager EFM 1.1 2 2 Plugin url : http://www.afrusoft.com/htmlarea 3 Version 1.1 created from 1.0 beta by Krzysztof Kotowicz <koto@webworkers.pl> 3 4 4 5 Overview : 5 6 ---------- … … 38 39 Installation : 39 40 -------------- 40 41 41 Installing EFM is very easy to implement. Unzip htmlArea_EFM1_0b.zip and copy ExtendedFileManager fodler to plugins directory. 42 Installing involves extracting the archive to 'plugins' subdirectory of Xinha 43 and selecting the plugin in appropriate xinha_plugins list. 42 44 43 To enable Insert Image Mode, just load the plugin into your HtmlArea. By default, if you just load the plugin without registering it, EFM will enable only Insert Image Mode. 44 45 HTMLArea.loadPlugin("ExtendedFileManager"); 46 HTMLArea.onload = function() { 47 var editor = new HTMLArea("textarea_id"); 48 editor.generate(); 49 }; 50 HTMLArea.init(); 51 52 53 To enable Insert File Link Mode, load the plugin as said above and also register the plugin as per the example below. 54 55 HTMLArea.loadPlugin("ExtendedFileManager"); 56 HTMLArea.onload = function() { 57 var editor = new HTMLArea("textarea_id"); 58 editor.registerPlugin(ExtendedFileManager); //Enables Inser File Link Mode. 59 editor.generate(); 60 }; 61 HTMLArea.init(); 62 63 64 Note : If you enable Insert File Link Mode, Insert Image Mode will also be enabled automatically. 65 66 67 Open and edit config.inc.php file as per your needs. Thats all. 68 69 Have a nice day :) 70 71 72 Thanking you, 73 74 Afru. 75 afrusoft@gmail.com 45 Plugin may be configured via xinha_config.ExtendedFileManager object. 46 Look into ImageManager plugin documentation as this plugin uses almost identical 47 settings. 48 49 The plugin may share the same config array as ImageManager plugin - just specify 50 the same storage location like this: 51 52 // only snippets of code from initializing file shown below 53 54 <?php 55 56 // define backend configuration for both plugins 57 58 $IMConfig = array(); 59 $IMConfig['images_dir'] = '<images dir>'; 60 $IMConfig['images_url'] = '<images url>'; 61 $IMConfig['thumbnail_prefix'] = 't_'; 62 $IMConfig['thumbnail_dir'] = 't'; 63 $IMConfig['resized_prefix'] = 'resized_'; 64 $IMConfig['resized_dir'] = ''; 65 $IMConfig['tmp_prefix'] = '_tmp'; 66 $IMConfig['max_filesize_kb_image'] = 2000; 67 // maximum size for uploading files in 'insert image' mode (2000 kB here) 68 69 $IMConfig['max_filesize_kb_link'] = 5000; 70 // maximum size for uploading files in 'insert link' mode (2000 kB here) 71 72 // Maximum upload folder size in Megabytes. 73 // Use 0 to disable limit 74 75 $IMConfig['max_foldersize_mb'] = 0; 76 $IMConfig['allowed_image_extensions'] = array("jpg","gif","png"); 77 $IMConfig['allowed_link_extensions'] = array("jpg","gif","pdf","ip","txt", 78 "psd","png","html","swf", 79 "xml","xls"); 80 81 $IMConfig = serialize($IMConfig); 82 if(!isset($_SESSION['Xinha:ImageManager'])) 83 { 84 $_SESSION['Xinha:ImageManager'] = uniqid('secret_code'); 85 } 86 87 ?> 88 89 xinha_plugins = xinha_plugins ? xinha_plugins : 90 [ 91 'ContextMenu', 92 'SuperClean', 93 'CharacterMap', 94 'GetHtml', 95 'ExtendedFileManager', 96 /*'ImageManager',*/ // replace image manager with EFM 97 'Linker' 98 ]; 99 100 ... 101 102 // pass the configuration to plugins 103 if (xinha_config.ImageManager) { 104 xinha_config.ImageManager.backend_config = '<?php echo jsaddslashes($IMConfig)?>'; 105 xinha_config.ImageManager.backend_config_hash = '<?php echo sha1($IMConfig . $_SESSION['Xinha:ImageManager'])?>'; 106 } 107 108 if (xinha_config.ExtendedFileManager) { 109 xinha_config.ExtendedFileManager.backend_config = '<?php echo jsaddslashes($IMConfig)?>'; 110 xinha_config.ExtendedFileManager.backend_config_hash = '<?php echo sha1($IMConfig . $_SESSION['Xinha:ImageManager'])?>'; 111 } 112 113 114 ===== 115 afrusoft@gmail.com - author of EFM 1.0 beta 116 koto@webworkers.pl - EFM 1.1 (most of the code taken from Xinha codebase) 117 No newline at end of file -
thumbs.php
Only in 11: resizer.php diff -u -r 10/thumbs.php 11/thumbs.php
10 11 1 <? 1 <?php 2 2 /** 3 3 * On the fly Thumbnail generation. 4 4 * Creates thumbnails given by thumbs.php?img=/relative/path/to/image.jpg 5 5 * relative to the base_dir given in config.inc.php 6 * Authors: Wei Zhuo, Afru 6 * Authors: Wei Zhuo, Afru, Krzysztof Kotowicz 7 7 * Version: Updated on 08-01-2005 by Afru 8 * Package: ExtendedFileManager (EFM 1.0 beta) 8 * Version: Updated on 20-06-2006 by Krzysztof Kotowicz 9 * Package: ExtendedFileManager (EFM 1.1) 9 10 * http://www.afrusoft.com/htmlarea 10 11 */ 11 12 12 13 require_once('config.inc.php'); 13 14 require_once('Classes/ExtendedFileManager.php'); 14 require_once(' Classes/Thumbnail.php');15 require_once('../ImageManager/Classes/Thumbnail.php'); 15 16 16 17 //check for img parameter in the url 17 18 if(!isset($_GET['img'])) … … 22 23 23 24 //get the image and the full path to the image 24 25 $image = rawurldecode($_GET['img']); 25 $fullpath = Files::makeFile($manager->get BaseDir(),$image);26 $fullpath = Files::makeFile($manager->getImagesDir(),$image); 26 27 27 28 //not a file, so exit 28 29 if(!is_file($fullpath))
