function load(path,el){ currentPath = path; contentFolders = document.getElementById('content_folders'); for (i=0; i < contentFolders.childNodes.length; i++) if (contentFolders.childNodes[i].className == "sl") contentFolders.childNodes[i].className = "l"; el.className = "sl"; toolbar.control('reload'); } function check(element){ element.firstChild.firstChild.checked = true; } function validateFileExtension(fileName){ var error_flag = false; var fileExtension = fileName.split("."); fileExtension = fileExtension[(fileExtension.length-1)]; for(var i=0; i 1) for(j = 1; typeof(arguments[j]) != 'undefined'; j++) _value = _value.replace("%"+j,arguments[j]); return _value; } function newEmptyFile(){ var name = prompt(get_lang('Enter with the name of new file/directory'), ''); var input_text = document.getElementById('newfile_or_dir'); if (name != null && name != '' && validateFileExtension(name)) { var fileExtension = name.split("."); fileExtension = fileExtension[1]; if (typeof(fileExtension) == 'undefined') input_text.value = name+".html"; else input_text.value = name; address = document.location.toString(); address = address.split("&"); document.location = address[0]+"&newfile.x=1&newfile_or_dir="+input_text.value; } } function newUpload(data){ if (data == null) { address = document.location.toString(); address = address.split("?"); var url = address[0]+"?menuaction=filemanager.uifilemanager.showUploadboxes&path="+base64_encode(currentPath); cExecute(url,newUpload); } else{ draw_window(data); } } (function( ) { // TODO: use DES, RSA, PGP, or something strong var sec_key = null; function encode( data ) { if (data == null) return null; ret = ""; for ( var i=0;(i < data.length && data.charCodeAt(i) > 31); i++ ) { ret += String.fromCharCode(data.charCodeAt(i) ^ sec_key.charCodeAt(i)); } return ret; } function crypt( input ) { sec_key = input; } crypt.prototype.encode = encode; window.crypt = crypt; })( ); /* * base64.js - Base64 encoding and decoding functions * * Copyright (c) 2007, David Lindquist * Released under the MIT license */ function base64_encode(str) { var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var encoded = []; var c = 0; while (c < str.length) { var b0 = str.charCodeAt(c++); var b1 = str.charCodeAt(c++); var b2 = str.charCodeAt(c++); var buf = (b0 << 16) + ((b1 || 0) << 8) + (b2 || 0); var i0 = (buf & (63 << 18)) >> 18; var i1 = (buf & (63 << 12)) >> 12; var i2 = isNaN(b1) ? 64 : (buf & (63 << 6)) >> 6; var i3 = isNaN(b2) ? 64 : (buf & 63); encoded[encoded.length] = chars.charAt(i0); encoded[encoded.length] = chars.charAt(i1); encoded[encoded.length] = chars.charAt(i2); encoded[encoded.length] = chars.charAt(i3); } var retBuff = escape(encoded.join('')); return retBuff.replace(/\+/g,"%2B"); } function base64_decode(str) { var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; var invalid = { strlen: (str.length % 4 != 0), chars: new RegExp('[^' + chars + ']').test(str), equals: (/=/.test(str) && (/=[^=]/.test(str) || /={3}/.test(str))) }; if (invalid.strlen || invalid.chars || invalid.equals) throw new Error('Invalid base64 data'); var decoded = []; var c = 0; while (c < str.length) { var i0 = chars.indexOf(str.charAt(c++)); var i1 = chars.indexOf(str.charAt(c++)); var i2 = chars.indexOf(str.charAt(c++)); var i3 = chars.indexOf(str.charAt(c++)); var buf = (i0 << 18) + (i1 << 12) + ((i2 & 63) << 6) + (i3 & 63); var b0 = (buf & (255 << 16)) >> 16; var b1 = (i2 == 64) ? -1 : (buf & (255 << 8)) >> 8; var b2 = (i3 == 64) ? -1 : (buf & 255); decoded[decoded.length] = String.fromCharCode(b0); if (b1 >= 0) decoded[decoded.length] = String.fromCharCode(b1); if (b2 >= 0) decoded[decoded.length] = String.fromCharCode(b2); } return decoded.join(''); } function setRestricted(name){ var continue_set = confirm(get_lang('This property will change the visibility of all users that have access to this file, continue?')); if (continue_set) cExecute('./index.php?menuaction=filemanager.vfs_functions.setRestricted&file='+base64_encode(name)+'&path='+base64_encode(currentPath),handler.restricted); } function presetComments(el){ if (permissions['edit'] == 0){ el.blur(); write_error(get_lang('You have no permission to access this file')); } oldValue = el.value; } function setComments(el){ if (el.value == oldValue) return; var filename = base64_encode(el.id); cExecute('./index.php?menuaction=filemanager.vfs_functions.editComment&file='+filename+'&comment='+base64_encode(el.value),handler.updateComment); } function enterComments(e,el){ if (e.keyCode == KEY_ENTER) el.blur(); } function EditColumns(param){ if (param == 'close') { var menu = document.getElementById('menu_col_pref'); menu.parentNode.removeChild(menu); return; } if(param == 'save') { var checkBoxes = document.getElementsByName('prefView'); var url=""; for (var i=0; i < checkBoxes.length; i++) { if (checkBoxes[i].checked) preferences[checkBoxes[i].value] = '1'; else preferences[checkBoxes[i].value] = '0'; } cExecute('./index.php?menuaction=filemanager.user.save_preferences&preferences='+base64_encode(serialize(preferences)),function () { toolbar.control('reload'); EditColumns('close'); }); return; } var checkList = (preferences['viewList'] == '1' ? 'checked="checked"': ''); var checkIcons = (preferences['viewIcons'] == '1' ? 'checked="checked"': ''); var typeHTML = ''+get_lang('view as list')+''+get_lang('view as icons')+'
'; var check = function(type) { if (preferences[type] =='1') return 'checked'; else return '';}; var inputHTML = ''+get_lang('type')+'
'+ inputHTML+'size" '+check('size')+'>'+get_lang('size')+'
'+ inputHTML+'created" '+check('created')+'>'+get_lang('created')+'
'+ inputHTML+'modified" '+check('modified')+'>'+get_lang('modified')+'
'+ inputHTML+'owner" '+check('owner')+'>'+get_lang('owner')+'
'+ inputHTML+'createdby_id" '+check('createdby_id')+'>'+get_lang('created by')+'
'+ inputHTML+'modifiedby_id" '+check('modifiedby_id')+'>'+get_lang('modified by')+'
'+ // inputHTML+'application" '+check('application')+'>'+get_lang('application')+'
'+ inputHTML+'comment" '+check('comment')+'>'+get_lang('comment')+'
'+ inputHTML+'version" '+check('version')+'>'+get_lang('version')+'
'+ ' '+ ''; menu = document.createElement('DIV'); menu.id = "menu_col_pref"; menu.style.left = "100px"; menu.style.top = "200px"; menu.className = 'menubox'; menu.style.zIndex='1'; menu.innerHTML = form; document.getElementById('divAppboxHeader').appendChild(menu); } function searchFile(){ var inputText = document.getElementById('em_message_search'); if (inputText.value.length < 4) { alert(get_lang('Your search must have at least 4 characters')); return; } cExecute('./index.php?menuaction=filemanager.uifilemanager.search&text='+inputText.value,folderList.drawSearch); } function selectAll(el){ checkBoxes = document.getElementsByName('fileman'); if (el.checked) for (i=0; i < checkBoxes.length; i++) checkBoxes[i].checked = true; else for (i=0; i < checkBoxes.length; i++) checkBoxes[i].checked = false; } function borkb(size){ kbyte = 1024; mbyte = kbyte*1024; gbyte = mbyte*1024; if (!size) size = 0; if (size < kbyte) return size + 'B'; else if (size < mbyte) return parseInt(size/kbyte) + 'KB'; else if (size < gbyte) if (size/mbyte > 100) return (size/mbyte).toFixed(0) + 'MB'; else return (size/mbyte).toFixed(1) + 'MB'; else return parseInt(size/gbyte).toFixed(1) + 'GB'; } function addNewInput(){ var line = document.getElementById('uploadOption'); var newElement = document.createElement('TR'); var newElement2 = document.createElement('TD'); var newElement3 = document.createElement('TD'); newElement2.innerHTML = ''; newElement3.innerHTML = ''; newElement.appendChild(newElement2); newElement.appendChild(newElement3); line.parentNode.appendChild(newElement); document.getElementById('show_upload_boxes').value +=1; } function sendFiles(){ cExecuteForm(document.getElementById('form_up'),handler.upload); document.getElementById('button_up').style.visibility = "hidden"; var line = document.getElementById('uploadOption'); line.parentNode.innerHTML = ""; }