first commit
71
js/swampy_browser/configs.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
#for kohana
|
||||
session_name('Frisson_session');
|
||||
session_start();
|
||||
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser) config file sample
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
|
||||
$HOST = "/";
|
||||
|
||||
// absolute path to your public_html directory
|
||||
$PUBLIC_HTML_DIR = $_SESSION['tiny_mce_public_html_dir'];
|
||||
|
||||
// valid image extension
|
||||
$IMAGE_EXTENSIONS = array("jpg", "jpeg","png", "gif");
|
||||
|
||||
/*
|
||||
DIRS - directories to use for file and image browsing and uploads
|
||||
title - Custom directory title
|
||||
dir - directory path in public_html ended with slash
|
||||
*/
|
||||
$DIRS = array();
|
||||
foreach($_SESSION['tiny_mce_upload_dirs'] as $dir => $name){
|
||||
$DIRS[] = array('title'=> $name, 'dir'=> $dir .'/');
|
||||
if(!is_dir($PUBLIC_HTML_DIR . $dir)){
|
||||
mkdir($PUBLIC_HTML_DIR . $dir);
|
||||
}
|
||||
}
|
||||
/*
|
||||
IMAGE_FORMATS - custom image formats for uploading images
|
||||
title - format title
|
||||
dir - hidden directory for custom formats must start with dot(for being invisible in SwampyBrowser)
|
||||
ext - image type and extension. Avaliable formats (png,jpg,gif,false) false means image keeps its orginal extension and image type
|
||||
width/height - formated image width/height in pixels. false meens auto count or leaves orginal
|
||||
scale - there are 5 image scale tipes:
|
||||
orginal - leaves image in its orginal size
|
||||
max - fits image to given size
|
||||
addbs - fits image to given size and adds backgroun to keep given size
|
||||
crop - crops image to given size
|
||||
stretch - stretches image to given size
|
||||
|
||||
bg - is user only with addbg scale type, it specifies color of added background in HTML color code format
|
||||
mask - path to mask in public_html dir. It adds mask to the image, can be used to place logos on images,
|
||||
mask file must be png image ant fit exact size of given format
|
||||
*/
|
||||
|
||||
$IMAGE_FORMATS = array
|
||||
(
|
||||
/// DO NOT DELETE THIS (mthumb format is used for generating thumbnails)
|
||||
'mthumb' => array('title'=>"", 'dir' => ".mthumbs/", 'ext'=>"png",'width' => 100,'height' => 100,'mask' => false, 'scale'=>"crop", 'bg'=>"FFFFFF"),
|
||||
//custom user predifined format for uploading and formating images
|
||||
'orginal' => array('title'=>"Orginal", 'dir' => "", 'ext'=>false,'width' => 0, 'height' => 0, 'mask' => false, 'scale'=>"orginal",'bg'=>"FFFFFF"),
|
||||
'gthumb' => array('title'=>"Gallery thumb", 'dir' => ".gthumb/", 'ext'=>"png",'width' => 160,'height' => 100,'mask' => false, 'scale'=>"addbg",'bg'=>"FFFFFF"),
|
||||
);
|
||||
|
||||
/* SwampyBrowser language selection (only English is avalible for now)*/
|
||||
$LANG = "pl";
|
||||
|
||||
if(!$_SESSION['admin'])
|
||||
{
|
||||
header("Location: /admin/login/");
|
||||
}
|
||||
/* You can add here login check becouse every php script is including this file first before any operation */
|
||||
?>
|
||||
61
js/swampy_browser/index.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser) index file
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('configs.php');
|
||||
include("lang/$LANG.php");
|
||||
|
||||
$dir = $DIRS[0]['dir'];
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Swampy File and Image Manager</title>
|
||||
<link href="styles/default.css" rel="stylesheet" type="text/css" media="screen" />
|
||||
|
||||
<script src="js/fim.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var browser = new SwampyBrowser("<?php echo $dir;?>", "");
|
||||
|
||||
<?php echo $JAVA_DLG;?>
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onLoad="browser.init();">
|
||||
<div id="alert" style="display:none;"><p class='error'>testuojamf asdfahsdfkajdhfa sdfkaj</p></div>
|
||||
<div id="left_container">
|
||||
<div id="information"><!-- infomation -->
|
||||
<p><?php echo $DLG['dir'];?>:<br> <label id="label[directory]"></label></p>
|
||||
<p><?php echo $DLG['name'];?>:<br> <label id="label[filename]"></label></p>
|
||||
<p><?php echo $DLG['extension'];?>:<br> <label id="label[extension]"></label></p>
|
||||
<p><?php echo $DLG['size'];?>:<br> <label id="label[filesize]"></label></p>
|
||||
<p><?php echo $DLG['dimentions'];?>:<br> <label id="label[dimentions]"></label></p>
|
||||
</div>
|
||||
<div id="directories"></div>
|
||||
<div id="control">
|
||||
<ul>
|
||||
<li class="upload_image"><a href="javascript:browser.uploadImage();"><?php echo $DLG['upload_image'];?></a></li>
|
||||
<li class="upload_file"><a href="javascript:browser.uploadFile();"><?php echo $DLG['upload_file'];?></a></li>
|
||||
<li class="folder_add"><a href="javascript:browser.addDir();"><?php echo $DLG['add_dir'];?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="right_container">
|
||||
<div id="content"></div>
|
||||
<div id="footer">
|
||||
<div id="path"><?php echo $DLG['path'];?>: <label id="label[path]"></label></div>
|
||||
<div id="vmode"><?php echo $DLG['view_mode'];?>:
|
||||
<img id="view_mode" onclick="browser.toggleViewMode(this);"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
431
js/swampy_browser/js/fim.js
Normal file
@@ -0,0 +1,431 @@
|
||||
/* *
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
* */
|
||||
|
||||
/* Mini config */
|
||||
var viewMode = {thumb:"thumb", row:"row"};
|
||||
var viewModeImg = {thumb:"styles/images/thumb_view.png", row:"styles/images/row_view.png"};
|
||||
var filenameLen = {thumb:10, row:32};
|
||||
var default_view_mode = viewMode.thumb;
|
||||
|
||||
/****************** Some usefull misc functions *******************************/
|
||||
function BBCodeToHTML(str) //replacing <b> tags
|
||||
{
|
||||
return str.replace(/\[b\](.*?)\[\/b\]/, "<b>$1</b>");
|
||||
}
|
||||
|
||||
function getNodeValue(node)
|
||||
{
|
||||
if (window.ActiveXObject)
|
||||
return node.text;
|
||||
else
|
||||
return node.textContent;
|
||||
}
|
||||
/********************* Ajax Class *********************************************/
|
||||
function Ajax()
|
||||
{
|
||||
var STATE =
|
||||
{
|
||||
UNINITIALIZED : 0,
|
||||
LOADING : 1,
|
||||
LOADED : 2,
|
||||
INTERACTIVE : 3,
|
||||
COMPLETE : 4
|
||||
};
|
||||
|
||||
var STATUS = { OK : 200};
|
||||
|
||||
//Creating cross browser AJAX object
|
||||
var XHR = function()
|
||||
{
|
||||
var request = false;
|
||||
try{request = new ActiveXObject('Msxml2.XMLHTTP');}
|
||||
catch (err2)
|
||||
{
|
||||
try{request = new ActiveXObject('Microsoft.XMLHTTP');}
|
||||
catch (err3)
|
||||
{
|
||||
try{request = new XMLHttpRequest();}
|
||||
catch (err1) {request = false;}
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
//Ajax POST Request
|
||||
this.postRequest = function(url, params, opt)
|
||||
{
|
||||
var xhr = XHR();
|
||||
|
||||
xhr.onreadystatechange = function()
|
||||
{
|
||||
switch(xhr.readyState)
|
||||
{
|
||||
case STATE.UNINITIALIZED:
|
||||
if(opt.onFailure) opt.onFailure(xhr, opt);
|
||||
delete(xhr);
|
||||
break;
|
||||
case STATE.LOADING:
|
||||
case STATE.LOADED:
|
||||
case STATE.INTERACTIVE:
|
||||
if(opt.onLoading) opt.onLoading(xhr, opt);
|
||||
break;
|
||||
case STATE.COMPLETE:
|
||||
if(xhr.status == STATUS.OK)
|
||||
{
|
||||
if(opt.onSuccess) opt.onSuccess(xhr, opt);
|
||||
delete(xhr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(opt.onFailure) opt.onFailure(xhr, opt);
|
||||
delete(xhr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xhr.setRequestHeader("Content-length", params.length);
|
||||
xhr.setRequestHeader("Connection", "close");
|
||||
xhr.send(params);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************** HTML Content Class ************************/
|
||||
function Content()
|
||||
{
|
||||
var ajax = new Ajax();
|
||||
var alert_obj = null;
|
||||
var alert_timer = null;
|
||||
var alert_lock = false;
|
||||
|
||||
this.loadHTML = function(url, params, targetID, hideLoading)
|
||||
{
|
||||
var targetObj = document.getElementById(targetID);
|
||||
var cnt = this;
|
||||
cnt.showAlert('loader', Lang.initiating ,60);
|
||||
ajax.postRequest(url, params,
|
||||
{
|
||||
onLoading : function(xhr, opt){cnt.showAlert('loader', Lang.loading, 60);},
|
||||
onFailure : function(xhr, opt){cnt.showAlert('error', Lang.loading_failure, 5);},
|
||||
onSuccess : function(xhr, opt){cnt.showAlert('done', Lang.done , 0.25); targetObj.innerHTML = xhr.responseText;}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.loadXML = function(url, params, onResponse)
|
||||
{
|
||||
var cnt = this;
|
||||
ajax.postRequest(url, params,
|
||||
{
|
||||
onLoading : function(xhr, opt){cnt.showAlert('loader', Lang.loading, 60);},
|
||||
onFailure : function(xhr, opt){cnt.showAlert('error', Lang.loading_failure, 5);},
|
||||
onSuccess : function(xhr, opt)
|
||||
{
|
||||
var rType = xhr.responseXML.documentElement.getAttribute("type");
|
||||
if(!rType)
|
||||
return cnt.showAlert('error', Lang.loading_failure, 5);
|
||||
|
||||
if(rType != "data")
|
||||
cnt.showAlert(rType, BBCodeToHTML( getNodeValue( xhr.responseXML.documentElement)) , 5, true);
|
||||
else
|
||||
cnt.showAlert('done', Lang.done , 0.25);
|
||||
|
||||
onResponse(rType, xhr.responseXML);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
this.updateHTML = function(targetID, html)
|
||||
{
|
||||
var targetObj = document.getElementById(targetID);
|
||||
targetObj.innerHTML = html;
|
||||
}
|
||||
|
||||
this.showAlert = function(aType, msg, sec, lock)
|
||||
{
|
||||
if(alert_lock && !lock) return;
|
||||
if(alert_timer) clearTimeout(alert_timer);
|
||||
if(!alert_obj) alert_obj = document.getElementById('alert');
|
||||
alert_obj.innerHTML = "<p class='"+aType+"'>"+msg+"</p>\n";
|
||||
this.showObject(alert_obj);
|
||||
alert_lock = (lock) ? true : false;
|
||||
alert_obj.onclick = new Function("browser.cnt.hideAlert();");
|
||||
alert_timer = setTimeout (this.hideAlert, sec * 1000);
|
||||
}
|
||||
|
||||
this.hideAlert = function()
|
||||
{
|
||||
alert_lock = false;
|
||||
alert_obj.style.display = "none";
|
||||
}
|
||||
|
||||
this.showObject = function(obj)
|
||||
{
|
||||
obj.style.display = "";
|
||||
}
|
||||
|
||||
this.hideObject = function(obj)
|
||||
{
|
||||
obj.style.display = "none";
|
||||
}
|
||||
|
||||
this.toggleObject = function(obj)
|
||||
{
|
||||
obj.style.display = (obj.style.display == "none") ? "" : "none";
|
||||
}
|
||||
}
|
||||
/************************ Upload Class ****************************************/
|
||||
function Upload(cnt)
|
||||
{
|
||||
var content = cnt;
|
||||
var upload_form_obj = null;
|
||||
var loadin_form_obj = null;
|
||||
|
||||
this.start = function(obj)
|
||||
{
|
||||
upload_form_obj = obj;
|
||||
loadin_form_obj = document.getElementById('loading_form');
|
||||
content.hideObject(upload_form_obj);
|
||||
content.showObject(loadin_form_obj);
|
||||
content.showAlert('loader', Lang.uploading, 60);
|
||||
}
|
||||
|
||||
this.stop = function(rType, rMSG)
|
||||
{
|
||||
content.showObject(upload_form_obj);
|
||||
content.hideObject(loadin_form_obj);
|
||||
content.showAlert(rType, unescape(rMSG), 30, true);
|
||||
}
|
||||
}
|
||||
|
||||
/********************* SwampyBrowser Class ************************************/
|
||||
function SwampyBrowser(dir, file)
|
||||
{
|
||||
/******************* Private members and functions ********************/
|
||||
var current_dir = dir;
|
||||
var current_file = file;
|
||||
var content = new Content();
|
||||
var filesXML = null;
|
||||
var view_mode = default_view_mode;
|
||||
var thumb_obj = null;
|
||||
var options_obj = null;
|
||||
|
||||
var updateInfo = function(dir, file, filename, extension, filesize, dimentions)
|
||||
{
|
||||
content.updateHTML('label[path]', dir+file);
|
||||
content.updateHTML('label[directory]', dir);
|
||||
content.updateHTML('label[filename]', filename);
|
||||
content.updateHTML('label[extension]', extension);
|
||||
content.updateHTML('label[filesize]', filesize);
|
||||
content.updateHTML('label[dimentions]', dimentions);
|
||||
}
|
||||
|
||||
var selectThumb = function(obj)
|
||||
{
|
||||
var opt_obj = obj.getElementsByTagName('div')[0];
|
||||
if(options_obj && opt_obj != options_obj)
|
||||
content.hideObject(options_obj);
|
||||
|
||||
if(thumb_obj) thumb_obj.className = "";// "file-"+view_mode;
|
||||
thumb_obj = obj;
|
||||
obj.className = "selected";//"file-"+view_mode+" selected";
|
||||
}
|
||||
|
||||
var showFiles = function()
|
||||
{
|
||||
if(!filesXML) return;
|
||||
|
||||
var files = filesXML.getElementsByTagName('file');
|
||||
var content = document.getElementById('content');
|
||||
var nameLen = (view_mode == viewMode.thumb) ? filenameLen.thumb : filenameLen.row;
|
||||
content.innerHTML = "";
|
||||
|
||||
for(var i=0; i < files.length; i++)
|
||||
{
|
||||
var fName = getNodeValue(files[i]);
|
||||
var fType = files[i].getAttribute("type");
|
||||
var dir = files[i].getAttribute("dir");
|
||||
var file = files[i].getAttribute("file");
|
||||
var extension = files[i].getAttribute("extension");
|
||||
var size = files[i].getAttribute("size");
|
||||
var dim = files[i].getAttribute("dimentions");
|
||||
var BG = files[i].getAttribute("bg");
|
||||
var cell = document.createElement('div');
|
||||
var iStyle = "";
|
||||
var ext = extension;
|
||||
var displayFilename = (fName.length < nameLen) ? fName : fName.substr(0, nameLen-3)+"...";
|
||||
|
||||
var optDiv = "<div class='options' style='display:none;'>\n";
|
||||
|
||||
switch(fType)
|
||||
{
|
||||
case "parent":
|
||||
ext = fType;
|
||||
cell.ondblclick = new Function("browser.enterDir('"+dir+"');");
|
||||
break;
|
||||
case "dir":
|
||||
ext = fType;
|
||||
cell.ondblclick = new Function("browser.enterDir('"+dir+file+"/');");
|
||||
cell.onclick = new Function("browser.selectFile('"+file+"','"+fName+"','"+extension+"','','', this);");
|
||||
optDiv += "\t<a href=\"javascript:browser.enterDir('"+dir+file+"/');\">"+Lang.opt_enter+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.deleteDir('"+file+"');\">"+Lang.opt_delete+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.renameFile('"+file+"');\">"+Lang.opt_rename+"</a>\n";
|
||||
break;
|
||||
case "file":
|
||||
cell.ondblclick = new Function("browser.insertFile('"+file+"');");
|
||||
cell.onclick = new Function("browser.selectFile('"+file+"','"+fName+"','"+extension+"','"+size+"','', this);");
|
||||
optDiv += "\t<a href=\"javascript:browser.insertFile('"+file+"');\">"+Lang.opt_insert+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.deleteFile('"+file+"');\">"+Lang.opt_delete+"</a>\n";
|
||||
optDiv += "\t<a href='/"+dir+file+"' target='_blank'>"+Lang.opt_download+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.previewFile('"+file+"');\">"+Lang.opt_preview+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.renameFile('"+file+"');\">"+Lang.opt_rename+"</a>\n";
|
||||
break;
|
||||
case "image":
|
||||
cell.ondblclick = new Function("browser.insertImage('"+file+"');");
|
||||
cell.onclick = new Function("browser.selectFile('"+file+"','"+fName+"','"+extension+"','"+size+"','"+dim+"', this);");
|
||||
optDiv += "\t<a href=\"javascript:browser.insertImage('"+file+"');\">"+Lang.opt_insert+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.deleteFile('"+file+"');\">"+Lang.opt_delete+"</a>\n";
|
||||
optDiv += "\t<a href='/"+dir+file+"' target='_blank'>"+Lang.opt_download+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.previewFile('"+file+"');\">"+Lang.opt_preview+"</a>\n";
|
||||
optDiv += "\t<a href=\"javascript:browser.renameFile('"+file+"');\">"+Lang.opt_rename+"</a>\n";
|
||||
if(view_mode == viewMode.thumb) iStyle = "background:url('"+BG+"') no-repeat center;";
|
||||
break;
|
||||
}
|
||||
optDiv += "</div>\n";
|
||||
|
||||
optDiv += "<div class='image ext-"+ext+"' style=\""+iStyle+"\"></div>";
|
||||
optDiv += "<label class='name'>"+displayFilename+"</label>";
|
||||
optDiv += "<label class='size'>"+size+"</label>";
|
||||
optDiv += "<label class='dim'>"+dim+"</label>";
|
||||
if(fType != "parent")
|
||||
optDiv += "<div class='ctrl' onclick=\"browser.toggleOptions(this, '"+file+"');\"></div>";
|
||||
|
||||
cell.innerHTML = optDiv;
|
||||
cell.id = "file-"+view_mode;
|
||||
content.appendChild(cell);
|
||||
}
|
||||
}
|
||||
|
||||
this.upload = new Upload(content);
|
||||
this.cnt = content;
|
||||
|
||||
this.toggleViewMode = function(obj)
|
||||
{
|
||||
obj.src = (view_mode == viewMode.thumb) ? viewModeImg.row : viewModeImg.thumb;
|
||||
view_mode = (view_mode == viewMode.thumb) ? viewMode.row : viewMode.thumb;
|
||||
showFiles();
|
||||
}
|
||||
|
||||
this.toggleOptions = function(obj, file)
|
||||
{
|
||||
var current_obj = obj.parentNode.getElementsByTagName('div')[0];
|
||||
if(options_obj && options_obj != current_obj)
|
||||
content.hideObject(options_obj);
|
||||
|
||||
options_obj = current_obj;
|
||||
content.toggleObject(options_obj);
|
||||
}
|
||||
|
||||
this.enterDir = function(dir)
|
||||
{
|
||||
current_dir = dir;
|
||||
current_file = "";
|
||||
|
||||
content.loadHTML("scripts/dir_listing.php", "&dir="+current_dir, 'directories', true);
|
||||
content.loadXML("scripts/file_listing.php","&dir="+current_dir, function(rType, rXML){ if(rType=='data') {filesXML = rXML; showFiles();}} );
|
||||
updateInfo(current_dir, "", "", "", "", "");
|
||||
}
|
||||
|
||||
this.selectFile = function(file, filename, extension, size, dimentions, obj)
|
||||
{
|
||||
current_file = file;
|
||||
updateInfo(current_dir, current_file, filename, extension, size, dimentions);
|
||||
selectThumb(obj);
|
||||
}
|
||||
|
||||
this.previewFile = function(file)
|
||||
{
|
||||
content.showAlert('alert', Lang.not_supported, 3);
|
||||
}
|
||||
|
||||
this.renameFile = function(file)
|
||||
{
|
||||
content.showAlert('alert', Lang.not_supported, 3);
|
||||
}
|
||||
|
||||
this.deleteFile = function(file)
|
||||
{
|
||||
var br = this;
|
||||
if(confirm(Lang.file_delete_confirm+" '"+file+"'"))
|
||||
content.loadXML
|
||||
(
|
||||
"scripts/delete_file.php",
|
||||
"&dir="+current_dir+"&file="+file+"&confirm=1",
|
||||
function(rType, rXML){ if(rType == "done") br.enterDir(current_dir); }
|
||||
);
|
||||
}
|
||||
|
||||
this.addDir = function()
|
||||
{
|
||||
var br = this;
|
||||
var file = prompt(Lang.folder_name_prompt);
|
||||
if(file)
|
||||
content.loadXML
|
||||
(
|
||||
"scripts/add_dir.php",
|
||||
"&dir="+current_dir+"&file="+file,
|
||||
function(rType, rXML){ if(rType == "done") br.enterDir(current_dir+file+"/"); }
|
||||
);
|
||||
}
|
||||
|
||||
this.deleteDir = function(file)
|
||||
{
|
||||
var br = this;
|
||||
if(confirm(Lang.file_delete_confirm+" '"+file+"'"))
|
||||
content.loadXML
|
||||
(
|
||||
"scripts/delete_dir.php",
|
||||
"&dir="+current_dir+"&file="+file+"&confirm=1",
|
||||
function(rType, rXML){ if(rType == "done") br.enterDir(current_dir); }
|
||||
);
|
||||
}
|
||||
|
||||
this.insertImage = function(file)
|
||||
{
|
||||
content.loadHTML("scripts/format_listing.php", "&dir="+current_dir+"&file="+file, 'content');
|
||||
}
|
||||
|
||||
this.uploadFile = function()
|
||||
{
|
||||
content.loadHTML("scripts/upload_file.php", "&dir="+current_dir, 'content');
|
||||
}
|
||||
|
||||
this.uploadImage = function()
|
||||
{
|
||||
content.loadHTML("scripts/upload_image.php", "&dir="+current_dir, 'content');
|
||||
}
|
||||
|
||||
this.insertFile = function(file)
|
||||
{
|
||||
window.opener.insertURL(current_dir+file);
|
||||
top.window.close();
|
||||
}
|
||||
|
||||
this.init = function()
|
||||
{
|
||||
var vmObj = document.getElementById("view_mode");
|
||||
vmObj.src = (default_view_mode == viewMode.thumb) ? viewModeImg.thumb : viewModeImg.row;
|
||||
|
||||
if(current_dir)
|
||||
this.enterDir(current_dir);
|
||||
}
|
||||
}
|
||||
101
js/swampy_browser/lang/en.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/* Common */
|
||||
$DLG['select_dir'] = "Select folder first!";
|
||||
$DLG['dir_not_found'] = "Directory not found!";
|
||||
$DLG['not_dir'] = "Not a directory!";
|
||||
$DLG['invalid_dir'] = "Directory is not valid!";
|
||||
$DLG['no_permission'] = "No write permission!";
|
||||
|
||||
/* Add Dir */
|
||||
$DLG['invalid_dirname'] = "Invalid folder name!";
|
||||
$DLG['dir_exists'] = "Folder already exists!";
|
||||
$DLG['dir_add_success'] = "Folder created successfuly";
|
||||
$DLG['dir_add_failure'] = "Error adding folder!";
|
||||
|
||||
/* File listing */
|
||||
$DLG['enter'] = "Enter";
|
||||
$DLG['delete'] = "Delete";
|
||||
$DLG['insert'] = "Insert";
|
||||
$DLG['download'] = "Download";
|
||||
$DLG['preview'] = "Preview";
|
||||
$DLG['rename'] = "Rename";
|
||||
$DLG['dir'] = "Directory";
|
||||
$DLG['up'] = "Up";
|
||||
|
||||
/* Uploads */
|
||||
$DLG['select_file'] = "Select file first!";
|
||||
$DLG['invalid_filename'] = "Invalid file name!";
|
||||
$DLG['file_exists'] = "Filename already exists!";
|
||||
$DLG['invalid_img'] = "Invalid image file type!";
|
||||
$DLG['insert_uploaded'] = "Click here to insert uploaded file";
|
||||
$DLG['upload_success'] = "Uploaded successfuly";
|
||||
$DLG['upload_failure'] = "Error upoading file!";
|
||||
|
||||
$DLG['select_to_upload'] = "Select file to upload";
|
||||
$DLG['select_img_format'] = "Select image format(s)";
|
||||
$DLG['file_to_upload'] = "File to upload";
|
||||
$DLG['as_file_name'] = "As file name";
|
||||
$DLG['uploading'] = "Uploading";
|
||||
$DLG['upload'] = "Upload";
|
||||
|
||||
$DLG['format'] = "Format";
|
||||
$DLG['width'] = "Width";
|
||||
$DLG['height'] = "Height";
|
||||
$DLG['scale_type'] = "Scale type";
|
||||
$DLG['bg'] = "Background";
|
||||
$DLG['custom'] = "Custom";
|
||||
|
||||
/* Delete */
|
||||
$DLG['file_not_found'] = "File not found!";
|
||||
$DLG['dir_not_found'] = "Folder not found!";
|
||||
$DLG['not_file'] = "Unable to remove the file, not a file!";
|
||||
$DLG['not_dir'] = "Unable to remove the folder, not a folder";
|
||||
$DLG['file_delete_success'] = "File deleted successfuly";
|
||||
$DLG['file_delete_failure'] = "Unable to remove the file!";
|
||||
$DLG['dir_delete_success'] = "Folder deleted successfuly";
|
||||
$DLG['dir_delete_failure'] = "Unable to remove the folder!";
|
||||
$DLG['dir_not_empty'] = "Unable to remove the folder, folder is not empty";
|
||||
|
||||
/* Index */
|
||||
$DLG['name'] = "Name";
|
||||
$DLG['extension'] = "Extension";
|
||||
$DLG['size'] = "Size";
|
||||
$DLG['dimentions'] = "Dimentions";
|
||||
$DLG['upload_image'] = "Upload image";
|
||||
$DLG['upload_file'] = "Upload file";
|
||||
$DLG['add_dir'] = "Add folder";
|
||||
$DLG['path'] = "Path";
|
||||
$DLG['view_mode'] = "View mode";
|
||||
|
||||
/* format listing */
|
||||
$DLG['select_format'] = "Select image format to insert or download";
|
||||
|
||||
/* Misc */
|
||||
$JAVA_DLG = 'var Lang = {
|
||||
initiating : "Initiating...",
|
||||
loading : "Loading...",
|
||||
done : "Done",
|
||||
uploading : "Uploading...",
|
||||
loading_failure : "Faild to load content",
|
||||
file_delete_confirm : "Are you sure you want to delete",
|
||||
folder_name_prompt : "Insert a name for the folder you wish to add",
|
||||
not_supported : "Operation not suported yet",
|
||||
opt_enter : "Enter",
|
||||
opt_delete : "Delete",
|
||||
opt_insert : "Insert",
|
||||
opt_download : "Download",
|
||||
opt_preview : "Preview",
|
||||
opt_rename : "Rename",
|
||||
dir : "Directory",
|
||||
up : "Up"
|
||||
};';
|
||||
|
||||
$SCALE_TYPES = array
|
||||
(
|
||||
'orginal' => "Orginal size",
|
||||
'max' => "Max fit size",
|
||||
'addbg' => "Add background",
|
||||
'crop' => "Crop to center",
|
||||
'stretch' => "Stretch image",
|
||||
);
|
||||
?>
|
||||
115
js/swampy_browser/lang/pl.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
@author: Michał Myszor michal@mausa.pl
|
||||
@see www.mausa.pl
|
||||
**/
|
||||
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
/* Common */
|
||||
$DLG['select_dir'] = "Najpierw wybierz folder!";
|
||||
$DLG['dir_not_found'] = "Nie znaleziono folderu!";
|
||||
$DLG['not_dir'] = "To nie jest folder!";
|
||||
$DLG['invalid_dir'] = "Zły folder!";
|
||||
$DLG['no_permission'] = "Brak praw dostępu!";
|
||||
|
||||
/* Add Dir */
|
||||
$DLG['invalid_dirname'] = "Zła nazwa folderu!";
|
||||
$DLG['dir_exists'] = "Folder o tej nazwie juz istnieje!";
|
||||
$DLG['dir_add_success'] = "Folder został stworzony";
|
||||
$DLG['dir_add_failure'] = "Błąd tworzenia folderu!";
|
||||
|
||||
/* File listing */
|
||||
$DLG['enter'] = "Wejdź";
|
||||
$DLG['delete'] = "Usuń";
|
||||
$DLG['insert'] = "Wstaw";
|
||||
$DLG['download'] = "Pobierz";
|
||||
$DLG['preview'] = "Pokaż";
|
||||
$DLG['rename'] = "Zmień nazwę";
|
||||
$DLG['dir'] = "Folder";
|
||||
$DLG['up'] = "Do góry";
|
||||
|
||||
/* Uploads */
|
||||
$DLG['select_file'] = "Wybierz najpierw plik!";
|
||||
$DLG['invalid_filename'] = "Zła nazwa pliku!";
|
||||
$DLG['file_exists'] = "Plik o tej nazwie juz istnieje!";
|
||||
$DLG['invalid_img'] = "Zły typ pliku!";
|
||||
$DLG['insert_uploaded'] = "Kliknij aby wstawic wczytany plik";
|
||||
$DLG['upload_success'] = "Wczytywanie plikow zakonczone";
|
||||
$DLG['upload_failure'] = "Błąd przeniesienia pliku na serwer!";
|
||||
|
||||
$DLG['select_to_upload'] = "Wybierz plik do przeniesienia na serwer:";
|
||||
$DLG['select_img_format'] = "Wybierz format pliku";
|
||||
$DLG['file_to_upload'] = "Pliki do wgrania";
|
||||
$DLG['as_file_name'] = "Zmień nazwę na";
|
||||
$DLG['uploading'] = "Przenoszenie";
|
||||
$DLG['upload'] = "Wgraj";
|
||||
|
||||
$DLG['format'] = "Format";
|
||||
$DLG['width'] = "Szerokość";
|
||||
$DLG['height'] = "Wysokość";
|
||||
$DLG['scale_type'] = "Typ skalowania";
|
||||
$DLG['bg'] = "Tło";
|
||||
$DLG['custom'] = "Zwykły";
|
||||
|
||||
/* Delete */
|
||||
$DLG['file_not_found'] = "Pliku nie znaleziono!";
|
||||
$DLG['dir_not_found'] = "Nie znaleziono folderu!";
|
||||
$DLG['not_file'] = "Nie można usunąć pliku!";
|
||||
$DLG['not_dir'] = "Nie można usunąć folderu!";
|
||||
$DLG['file_delete_success'] = "Plik został usunięty";
|
||||
$DLG['file_delete_failure'] = "Nie można usunąć pliku!";
|
||||
$DLG['dir_delete_success'] = "Folder został usunięty";
|
||||
$DLG['dir_delete_failure'] = "Nie można usunąć folderu!";
|
||||
$DLG['dir_not_empty'] = "Nie można usunąc folderu, foder nie jest pusty!";
|
||||
|
||||
/* Index */
|
||||
$DLG['name'] = "Nazwa";
|
||||
$DLG['extension'] = "Typ/Rozszerzenie";
|
||||
$DLG['size'] = "Rozmiar";
|
||||
$DLG['dimentions'] = "Rodzielczość";
|
||||
$DLG['upload_image'] = "Wgraj obraz";
|
||||
$DLG['upload_file'] = "Wgraj plik";
|
||||
$DLG['add_dir'] = "Dodaj folder";
|
||||
$DLG['path'] = "ścieżka";
|
||||
$DLG['view_mode'] = "Wyświetlanie";
|
||||
|
||||
/* format listing */
|
||||
$DLG['select_format'] = "Wybierz format pliku jaki chcesz dodać";
|
||||
|
||||
/* Preview */
|
||||
$DLG['not_supported_format'] = "Nie wspierany typ pliku";
|
||||
|
||||
/* Rename */
|
||||
$DLG['rename_success'] = "zmiana na";
|
||||
$DLG['rename_failure'] = "Błąd zmiany nazwy!";
|
||||
|
||||
/* Misc */
|
||||
$JAVA_DLG = 'var Lang = {
|
||||
initiating : "Initiating...",
|
||||
loading : "Wgrywanie pliku...",
|
||||
done : "Gotowe",
|
||||
uploading: "Pobieranie pliku...",
|
||||
loading_failure : "Błąd wgrywania treści",
|
||||
file_delete_confirm : "Czy na pewno usunąć",
|
||||
folder_name_prompt : "Wpisz nazwę folderu do utworzenia",
|
||||
rename_prompt : "Wpisz nową nazwę folderu",
|
||||
not_supported : "Operacja nieznana",
|
||||
opt_enter : "Wejdź",
|
||||
opt_delete : "Usuń",
|
||||
opt_insert : "Dodaj",
|
||||
opt_download : "Pobierz",
|
||||
opt_preview : "Podgląd",
|
||||
opt_rename : "Zmień",
|
||||
dir : "Katalog",
|
||||
up : "Do góry"
|
||||
};';
|
||||
|
||||
$SCALE_TYPES = array
|
||||
(
|
||||
'orginal' => "Rozmiar oryginalny",
|
||||
'max' => "Rozmiar maksymalny",
|
||||
'addbg' => "Dodaj tło",
|
||||
'crop' => "Wytnij środek",
|
||||
'stretch' => "Rozciągnij obraz",
|
||||
);
|
||||
?>
|
||||
24
js/swampy_browser/license.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
* Copyright (c) 2009, Domas Labokas
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the SwampyFoot nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Domas Labokas ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Domas Labokas BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
26
js/swampy_browser/sb.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var browser_url = "/js/swampy_browser/";
|
||||
|
||||
var fieldName = null;
|
||||
var wind = null;
|
||||
|
||||
function openSwampyBrowser(field_name, url, type, win)
|
||||
{
|
||||
wind = win;
|
||||
fieldName = field_name;
|
||||
|
||||
var height = 555;
|
||||
var width = 850;
|
||||
|
||||
var top=Math.round((screen.height-height)/2);
|
||||
var left=Math.round(screen.width/2);
|
||||
|
||||
var params = "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no";
|
||||
|
||||
var wnd = window.open(browser_url, name, params);
|
||||
wnd.focus();
|
||||
}
|
||||
|
||||
function insertURL(url)
|
||||
{
|
||||
wind.document.getElementById(fieldName).value = url;
|
||||
}
|
||||
42
js/swampy_browser/scripts/add_dir.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$file = $_POST['file'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
$path = $directory.$file;
|
||||
|
||||
if($dir == "")
|
||||
die(xml_response('alert', $DLG['select_dir']));
|
||||
|
||||
if(!is_writable($directory))
|
||||
die(xml_response('error', $DLG['no_permission']));
|
||||
|
||||
if(!validate_path($dir))
|
||||
die(xml_response('error', $DLG['invalid_dir']." [b]($directory)[/b]"));
|
||||
|
||||
//cheking file name
|
||||
if(ereg("[^a-zA-Z0-9._ -]", $file) || substr($file, 0, 1) == ".")
|
||||
die(xml_response('alert', $DLG['invalid_dirname']));
|
||||
|
||||
//check is file name exists
|
||||
if(file_exists($directory.$file))
|
||||
die(xml_response('alert', $DLG['dir_exists']));
|
||||
|
||||
umask(0002);
|
||||
if(mkdir($directory.$file, 0775))
|
||||
die(xml_response('done',"[b]'$file'[/b] ".$DLG['dir_add_success']));
|
||||
|
||||
die(xml_response('error',"[b]'$file'[/b] ".$DLG['dir_add_failure']));
|
||||
?>
|
||||
75
js/swampy_browser/scripts/common.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
|
||||
define("THUMB_FILENAME_LEN", 10);
|
||||
|
||||
function format_filename($filename)
|
||||
{
|
||||
return substr(str_replace(" ", "-", $filename),0,32);
|
||||
}
|
||||
|
||||
function validate_path($path)
|
||||
{
|
||||
global $DIRS;
|
||||
|
||||
if(strstr($path, "./") || strstr($path, "..") || strstr($path, "/."))
|
||||
return false;
|
||||
|
||||
foreach($DIRS as $dir)
|
||||
if(strstr($path , $dir['dir']))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_filename_exists($dir, $filename)
|
||||
{
|
||||
if(shell_exec("ls -l $dir$filename.*") != "")
|
||||
return true;
|
||||
|
||||
else false;
|
||||
}
|
||||
|
||||
function swampy_pathinfo($path)
|
||||
{
|
||||
$info = array();
|
||||
$info['dirname'] = substr($path, 0, strrpos($path, '/'));
|
||||
$info['basename'] = end(explode("/", $path));
|
||||
$info['extension'] = strtolower(ltrim(strrchr($info['basename'], '.'), '.'));
|
||||
$info['filename'] = ($info['extension']) ? substr($info['basename'], 0,strrpos($info['basename'],'.')) : $info['basename'];
|
||||
return $info;
|
||||
}
|
||||
|
||||
function php4_scandir($dir) {
|
||||
$dh = opendir($dir);
|
||||
while( false !== ($filename = readdir($dh)) ) {
|
||||
$files[] = $filename;
|
||||
}
|
||||
sort($files);
|
||||
return($files);
|
||||
}
|
||||
|
||||
function xml_response($type, $data)
|
||||
{
|
||||
header('Content-Type: text/xml');
|
||||
return "<?xml version='1.0' encoding='utf-8'?>\n<response type='$type'>\n$data\n</response>\n";
|
||||
}
|
||||
|
||||
|
||||
function msg($type, $msg)
|
||||
{
|
||||
return "<p class='$type'>$msg</p>";
|
||||
}
|
||||
|
||||
function stopUpload($type, $msg)
|
||||
{
|
||||
return "<script language='javascript' type='text/javascript'>window.top.window.browser.upload.stop(\"$type\", \"$msg\");</script>";
|
||||
}
|
||||
?>
|
||||
66
js/swampy_browser/scripts/delete_dir.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 24
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$file = $_POST['file'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
$path = $directory.$file;
|
||||
|
||||
if($file == "")
|
||||
die(xml_response('alert', $DLG['select_dir']));
|
||||
|
||||
if(!file_exists($path))
|
||||
die(xml_response('error', $DLG['dir_not_found']." [b]($file)[/b]"));
|
||||
|
||||
if(!validate_path($path))
|
||||
die(xml_response('error', $DLG['invalid_dir']." [b]($dir$file)[/b]"));
|
||||
|
||||
if(!is_dir($path))
|
||||
die(xml_response('alert', $DLG['not_dir']." [b]($file)[/b]"));
|
||||
|
||||
if(!is_writable($path))
|
||||
die(xml_response('error', $DLG['no_permission']." [b]($file)[/b]"));
|
||||
|
||||
//reads directories and file in dir
|
||||
$files = function_exists("scandir") ? scandir($path) : php4_scandir($path);
|
||||
|
||||
// Filter hidden dirs starting with . (sample: .thumbs) and parent dirs ..
|
||||
foreach( $files as $key => $f)
|
||||
if(substr($f,0,1) == ".")
|
||||
unset($files[$key]);
|
||||
|
||||
//check is dir empty
|
||||
if(count($files) > 0)
|
||||
die(xml_response('alert', $DLG['dir_not_empty']." [b]($file)[/b]"));
|
||||
|
||||
if($_POST['confirm'])
|
||||
{
|
||||
$info = swampy_pathinfo($path);
|
||||
$delete_ok = true;
|
||||
|
||||
//Deletes all posibal same image formats
|
||||
foreach($IMAGE_FORMATS as $format)
|
||||
{
|
||||
$format_path = $path."/".$format['dir'];
|
||||
if(file_exists($format_path) && $format['dir'] != "")
|
||||
if(!rmdir($format_path))
|
||||
$delete_ok = false;
|
||||
}
|
||||
|
||||
if($delete_ok && rmdir($path))
|
||||
die(xml_response('done',"[b]'$file'[/b] ".$DLG['dir_delete_success']));
|
||||
else
|
||||
die(xml_response('error',"[b]'$file'[/b] ".$DLG['dir_delete_failure']));
|
||||
}
|
||||
?>
|
||||
53
js/swampy_browser/scripts/delete_file.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 24
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$file = $_POST['file'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
$path = $directory.$file;
|
||||
|
||||
if($file == "")
|
||||
die(xml_response('alert', $DLG['select_file']));
|
||||
|
||||
if(!file_exists($path))
|
||||
die(xml_response('error', $DLG['file_not_found']." [b]($file)[/b]"));
|
||||
|
||||
if(!validate_path($path))
|
||||
die(xml_response('error',$DLG['invalid_dir']." [b]($dir$file)[/b]"));
|
||||
|
||||
if(is_dir($path))
|
||||
die(xml_response('alert',$DLG['not_file']." [b]($file)[/b]"));
|
||||
|
||||
if(!is_writable($path))
|
||||
die(xml_response('error', $DLG['no_permission']." [b]($file)[/b]"));
|
||||
|
||||
if($_POST['confirm'])
|
||||
{
|
||||
$info = swampy_pathinfo($path);
|
||||
|
||||
//Deletes all posibal same image formats
|
||||
foreach($IMAGE_FORMATS as $format)
|
||||
{
|
||||
$ext = $format['ext'] ? ".".$format['ext'] : ".".$info['extension'];
|
||||
$format_path = $directory.$format['dir'].$info['filename'].$ext;
|
||||
if(file_exists($format_path))
|
||||
unlink($format_path);
|
||||
}
|
||||
|
||||
if(file_exists($path) && !unlink($path))
|
||||
die(xml_response('error',"[b]'$file'[/b] ".$DLG['file_delete_failure']));
|
||||
|
||||
die(xml_response('done',"[b]'$file'[/b] ".$DLG['file_delete_success']));
|
||||
}
|
||||
?>
|
||||
55
js/swampy_browser/scripts/dir_listing.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 24
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$current_dir = $_POST['dir'];
|
||||
|
||||
foreach($DIRS as $dir)
|
||||
echo "<ul>".fim_dir_tree($PUBLIC_HTML_DIR.$dir['dir'], $script, $dir['title'])."</ul>";
|
||||
|
||||
function fim_dir_tree($directory, $return_link, $title)
|
||||
{
|
||||
global $PUBLIC_HTML_DIR, $current_dir;
|
||||
|
||||
$dir = str_replace($PUBLIC_HTML_DIR, "", $directory);
|
||||
|
||||
if($dir == $current_dir)
|
||||
$html .= "<li><b><a href=\"javascript:browser.enterDir('$dir');\">$title</a></b></li>";
|
||||
else
|
||||
$html .= "<li><a href=\"javascript:browser.enterDir('$dir');\">$title</a></li>";
|
||||
|
||||
// Get and sort directories/files
|
||||
$files = function_exists("scandir") ? scandir($directory) : php4_scandir($directory);
|
||||
natcasesort($files);
|
||||
// filter directories
|
||||
$dirs = array();
|
||||
foreach($files as $file)
|
||||
if( is_dir("$directory$file" ))
|
||||
array_push($dirs, $file);
|
||||
|
||||
// Filter hidden dirs starting with underscore (sample _thumbs)
|
||||
foreach( $dirs as $key => $dir )
|
||||
if(substr($dir,0,1) == ".")
|
||||
unset($dirs[$key]);
|
||||
|
||||
if(count($dirs) > 0)
|
||||
{
|
||||
$html .= "<ul>";
|
||||
foreach($dirs as $dir)
|
||||
$html .= fim_dir_tree($directory.$dir."/", $return_link, $dir);
|
||||
|
||||
$html .= "</ul>";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
93
js/swampy_browser/scripts/file_listing.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 24
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
|
||||
if(!file_exists($directory))
|
||||
die(xml_response('error',$DLG['dir_not_found']." [b]($directory)[/b]"));
|
||||
|
||||
if(!is_dir($directory))
|
||||
die(xml_response('error',$DLG['not_dir']." [b]($directory)[/b]"));
|
||||
|
||||
if(!validate_path($directory))
|
||||
die(xml_response('error',$DLG['invalid_dir']." [b]($directory)[/b]"));
|
||||
|
||||
$files = function_exists("scandir") ? scandir($directory) : php4_scandir($directory);
|
||||
|
||||
/* Make directories first */
|
||||
$ofiles = $odirs = array();
|
||||
foreach($files as $file)
|
||||
if(is_dir($directory.$file))
|
||||
array_push($odirs, $file);
|
||||
else
|
||||
array_push($ofiles, $file);
|
||||
$files = array_merge($odirs, $ofiles);
|
||||
|
||||
/* Parent dir */
|
||||
$parent_dir = str_replace(basename($dir)."/", "", $dir);
|
||||
if(validate_path($parent_dir))
|
||||
$xml = "\t<file type='parent' dir='$parent_dir' file='' extension='' size='' dimentions='' bg=''>{$DLG['up']}</file>\n";
|
||||
// echo "<div onDblClick=\"browser.enterDir('$parent_dir');\" class='fim-thumb'>\n\t<div class='image ext-parent'></div>\n\t<div class='filename'>{$DLG['up']}</div>\n</div>\n";
|
||||
|
||||
/* Prints file thubms */
|
||||
foreach($files as $file)
|
||||
$xml .= fileXML($file);
|
||||
|
||||
die(xml_response('data', $xml));
|
||||
|
||||
function fileXML($file)
|
||||
{
|
||||
global $HOST, $PUBLIC_HTML_DIR, $IMAGE_EXTENSIONS,$IMAGE_FORMATS, $dir, $directory, $DLG;
|
||||
|
||||
if(substr($file,0,1) == ".")
|
||||
return;
|
||||
|
||||
$path = $directory.$file;
|
||||
$pathinfo = swampy_pathinfo($path);
|
||||
|
||||
$size = "";
|
||||
$dimentions = "";
|
||||
|
||||
if(is_dir($path))
|
||||
{
|
||||
$filename = $file;
|
||||
$extension = $DLG['dir'];
|
||||
$ext = "dir";
|
||||
$type = "dir";
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = $pathinfo['filename'];
|
||||
$extension = $ext = $pathinfo['extension'];
|
||||
$size = ceil(filesize($path)/1024)." KB";
|
||||
$type = "file";
|
||||
if(in_array($extension, $IMAGE_EXTENSIONS))
|
||||
{
|
||||
list($width, $height) = getimagesize($path);
|
||||
$dimentions = $width."x".$height." px";
|
||||
|
||||
//if image thumb exists adds it to bacground style
|
||||
if(file_exists($directory.$IMAGE_FORMATS['mthumb']['dir'].$pathinfo['filename'].".".$IMAGE_FORMATS['mthumb']['ext']))
|
||||
{
|
||||
$bg = "/".$dir.$IMAGE_FORMATS['mthumb']['dir'].$pathinfo['filename'].".".$IMAGE_FORMATS['mthumb']['ext'];
|
||||
$type = "image";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "\t<file type='$type' dir='$dir' file='$file' extension='$extension' size='$size' dimentions='$dimentions' bg='$bg'>$filename</file>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
57
js/swampy_browser/scripts/format_listing.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$file = $_POST['file'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
$path = $directory.$file;
|
||||
|
||||
if($file == "")
|
||||
die(msg('alert', $DLG['select_file']));
|
||||
|
||||
if(!file_exists($path))
|
||||
die(msg('error',$DLG['file_not_found']." <b>($path)</b>"));
|
||||
|
||||
if(is_dir($path))
|
||||
die(msg('error',$DLG['not_file']." <b>($path)</b>"));
|
||||
|
||||
if(!validate_path($path))
|
||||
die(msg('error',$DLG['invalid_dir']." <b>($path)</b>"));
|
||||
|
||||
echo "<p class='info'>{$DLG['select_format']}</p>";
|
||||
|
||||
$info = swampy_pathinfo($path);
|
||||
|
||||
echo "<table>\n";
|
||||
|
||||
echo "\t<tr><th>{$DLG['format']}</th><th>{$DLG['dimentions']}</th><th></th><th></th></tr>\n";
|
||||
|
||||
foreach($IMAGE_FORMATS as $format)
|
||||
{
|
||||
$ext = $format['ext'] ? ".".$format['ext'] : ".".$info['extension'];
|
||||
$format_path = $format['dir'].$info['filename'].$ext;
|
||||
|
||||
if(file_exists($directory.$format_path) && $format['title'])
|
||||
{
|
||||
list($width, $height) = getimagesize($directory.$format_path);
|
||||
echo "\t<tr>\n";
|
||||
echo "\t\t<td><b>{$format['title']}</b></td>\n";
|
||||
echo "\t\t<td>{$width}x{$height} px</td>\n";
|
||||
echo "\t\t<td><a href=\"javascript:browser.insertFile('$format_path');\">{$DLG['insert']}</a></td>\n";
|
||||
echo "\t\t<td><a href='$HOST$dir$format_path' target='_blank'>{$DLG['download']}</a></td>\n";
|
||||
echo "\t</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
?>
|
||||
1
js/swampy_browser/scripts/preview.php
Normal file
@@ -0,0 +1 @@
|
||||
in progress
|
||||
1
js/swampy_browser/scripts/rename.php
Normal file
@@ -0,0 +1 @@
|
||||
in progress
|
||||
72
js/swampy_browser/scripts/upload_file.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
|
||||
if($dir == "")
|
||||
die(msg('alert', $DLG['select_dir']));
|
||||
|
||||
if(!is_writable($directory))
|
||||
die(msg('error', $DLG['no_permission']));
|
||||
|
||||
if(!validate_path($dir))
|
||||
die(msg('error', $DLG['invalid_dir']." <b>($directory)</b>"));
|
||||
|
||||
if($_POST['upload'])
|
||||
{
|
||||
//cheking is file selected
|
||||
if($_FILES['file']['name']=="")
|
||||
die(stopUpload('alert', $DLG['select_file']));
|
||||
|
||||
$info = swampy_pathinfo($_FILES['file']['name']);
|
||||
$ext = ($info['extension'] != "") ? ".".$info['extension'] : "";
|
||||
$file = ($_POST['filename'] != "") ? $_POST['filename'].$ext : $info['filename'].$ext;
|
||||
$file = format_filename($file);
|
||||
|
||||
//cheking file name
|
||||
if(ereg("[^a-zA-Z0-9._-]", $file))
|
||||
die(stopUpload('alert',$DLG['invalid_filename']));
|
||||
|
||||
//check is file name exists
|
||||
if(file_exists($directory.$file))
|
||||
die(stopUpload('alert', $DLG['file_exists']));
|
||||
|
||||
umask(0002);
|
||||
//uploadig file
|
||||
if(!copy($_FILES['file']['tmp_name'], $directory.$file))
|
||||
die(stopUpload('error', $DLG['upload_failure']));
|
||||
|
||||
$msg = rawurlencode("<b>'$file'</b> {$DLG['upload_success']}<br><a href=\"javascript:browser.insertFile('$file');\">{$DLG['insert_uploaded']}</a>");
|
||||
die(stopUpload('done', $msg));
|
||||
}
|
||||
?>
|
||||
<iframe id="upload_target" name="upload_target" src="#" style="width:0px;height:0px;border:0px solid #fff;"></iframe>
|
||||
<form id="upload_form" action="scripts/upload_file.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="browser.upload.start(this);" >
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
|
||||
<p class="info" ><?php echo $DLG['select_to_upload']; ?></p>
|
||||
<table>
|
||||
<tr><td colspan="2"></td></tr>
|
||||
<tr><td><?php echo $DLG['dir'];?>: </td><td><input type="input" name="dir" value="<?php echo $dir;?>" readonly/></td></tr>
|
||||
<tr><td><?php echo $DLG['file_to_upload'];?>:</td><td><input class="file_input" type="file" name="file" accept="" /></td></tr>
|
||||
<tr><td><?php echo $DLG['as_file_name'];?>:</td><td><input type="input" name="filename" /></td></tr>
|
||||
</table>
|
||||
<hr>
|
||||
<input type="submit" name="upload" value="<?php echo $DLG['upload'];?>" />
|
||||
<div id="upload_messages"></div>
|
||||
</form>
|
||||
<div id="loading_form" style="text-align:center;display:none;">
|
||||
<p><?php echo $DLG['uploading'];?>...</p>
|
||||
<p><img src='styles/images/file-loader.gif' align='middle'/></p>
|
||||
</div>
|
||||
240
js/swampy_browser/scripts/upload_image.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/**
|
||||
@name Swampy File and Image Manager (SwampyBrowser)
|
||||
@version 1.1
|
||||
@author Domas Labokas domas@htg.lt
|
||||
@date 2009 03 30
|
||||
@see http://www.swampyfoot.com
|
||||
@copyright 2009 SwampyFoot
|
||||
@license BSD
|
||||
**/
|
||||
|
||||
include('../configs.php');
|
||||
include("../lang/$LANG.php");
|
||||
include('common.php');
|
||||
|
||||
$dir = $_POST['dir'];
|
||||
$directory = $PUBLIC_HTML_DIR.$dir;
|
||||
|
||||
if($dir == "")
|
||||
die(msg('alert', $DLG['select_dir']));
|
||||
|
||||
if(!is_writable($directory))
|
||||
die(msg('error', $DLG['no_permission']));
|
||||
|
||||
if(!validate_path($directory))
|
||||
die(msg('error', $DLG['invalid_dir']." <b>($dir)</b>"));
|
||||
|
||||
if($_POST['upload'])
|
||||
{
|
||||
//cheking is file selected
|
||||
if($_FILES['file']['name']=="")
|
||||
die(stopUpload('alert', $DLG['select_file']));
|
||||
|
||||
//geting file/path info
|
||||
$info = swampy_pathinfo($_FILES['file']['name']);
|
||||
$filename = ($_POST['filename'] != "") ? $_POST['filename'] : $info['filename'];
|
||||
$filename = format_filename($filename);
|
||||
|
||||
//cheking file name
|
||||
if(ereg("[^a-zA-Z0-9._-]", $filename))
|
||||
die(stopUpload('alert',$DLG['invalid_filename']));
|
||||
|
||||
//check is file name exists
|
||||
if(is_filename_exists($directory, $filename))
|
||||
die(stopUpload('alert', $DLG['file_exists']));
|
||||
|
||||
$src_path = $_FILES['file']['tmp_name']; // Source image path from uploaded file
|
||||
$image_info = getimagesize($src_path); // Geting source image info width height type
|
||||
|
||||
// Selecting operation to load image by its type
|
||||
switch($image_info[2])
|
||||
{
|
||||
case 1:// GIF
|
||||
$extension = ".gif";
|
||||
$src_image = @ ImageCreateFromGIF ($src_path);
|
||||
break;
|
||||
case 2:// JPEG
|
||||
$extension = ".jpg";
|
||||
$src_image = @ ImageCreateFromJPEG ($src_path);
|
||||
break;
|
||||
case 3:// PNG
|
||||
$extension = ".png";
|
||||
$src_image = @ ImageCreateFromPNG ($src_path);
|
||||
break;
|
||||
default:
|
||||
die(stopUpload('error', $DLG['invalid_img']));
|
||||
break;
|
||||
}
|
||||
|
||||
//checking is image loaded
|
||||
if(!$src_image)
|
||||
die(stopUpload('error', $DLG['invalid_image']));
|
||||
|
||||
|
||||
$IMAGE_FORMATS['custom'] = $_POST['format']; // Adds custom format to IMAGE FORMAT list from configure file
|
||||
array_push($_POST['formats'], "mthumb"); // Adds manager thumb format
|
||||
|
||||
//seting orginal width and height from image info
|
||||
$src_w = $image_info[0]; //width
|
||||
$src_h = $image_info[1]; //height
|
||||
$src_ratio = $src_w / $src_h; //source image width/height ratio
|
||||
|
||||
umask(0002);
|
||||
|
||||
//making images by selected formats
|
||||
foreach($_POST['formats'] as $fid)
|
||||
{
|
||||
$format = $IMAGE_FORMATS[$fid];
|
||||
|
||||
if(!$format['width'] && $format['height'])
|
||||
$format['width'] = round($format['height'] * $src_ratio);
|
||||
|
||||
if($format['width'] && !$format['height'])
|
||||
$format['height'] = round($format['width'] / $src_ratio);
|
||||
|
||||
$width = $format['width'] ? $format['width'] : $src_w;
|
||||
$height = $format['height'] ? $format['height'] : $src_h;
|
||||
$dst_x = $dst_y = $src_x = $src_y = 0;
|
||||
$format_ratio = $width / $height; //image format ratio
|
||||
|
||||
//formating image parameter by scale type
|
||||
switch($format['scale'])
|
||||
{
|
||||
case "crop":
|
||||
$dst_w = ($format_ratio < $src_ratio) ? round($height * $src_ratio) : $width;
|
||||
$dst_h = ($format_ratio > $src_ratio) ? round($width / $src_ratio) : $height;
|
||||
$dst_x = ($width/2) - ($dst_w/2);
|
||||
$dst_y = ($height/2) - ($dst_h/2);
|
||||
break;
|
||||
case "addbg":
|
||||
$dst_w = ($format_ratio > $src_ratio) ? round($height * $src_ratio) : $width;
|
||||
$dst_h = ($format_ratio < $src_ratio) ? round($width / $src_ratio) : $height;
|
||||
$dst_x = ($width/2) - ($dst_w/2);
|
||||
$dst_y = ($height/2) - ($dst_h/2);
|
||||
break;
|
||||
case "max":
|
||||
$width = $dst_w = ($format_ratio > $src_ratio) ? round($height * $src_ratio) : $width;
|
||||
$height = $dst_h = ($format_ratio < $src_ratio) ? round($width / $src_ratio) : $height;
|
||||
break;
|
||||
case "stretch":
|
||||
$dst_w = $width;
|
||||
$dst_h = $height;
|
||||
break;
|
||||
case "orginal":
|
||||
default:
|
||||
$width = $dst_w = $src_w;
|
||||
$height = $dst_h = $src_h;
|
||||
break;
|
||||
}
|
||||
$dst_image = imageCreateTrueColor($width, $height);
|
||||
|
||||
//creates image backgound color
|
||||
if($format['scale'] == "addbg")
|
||||
{
|
||||
$r = hexdec(substr($format['bg'],0,2));
|
||||
$g = hexdec(substr($format['bg'],2,2));
|
||||
$b = hexdec(substr($format['bg'],4,2));
|
||||
$color = imagecolorallocate($dst_image, $r, $g, $b);
|
||||
imagefill($dst_image, 0, 0, $color);
|
||||
}
|
||||
|
||||
imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||
|
||||
//image masking
|
||||
if($format['mask'])
|
||||
{
|
||||
$mask_image = ImageCreateFromPNG($PUBLIC_HTML_DIR.$format['mask']);
|
||||
imagealphablending($mask_image, 1);
|
||||
imagecopy($dst_image, $mask_image, 0, 0, 0, 0, $dst_w, $dst_h);
|
||||
}
|
||||
|
||||
if(!file_exists($directory.$format['dir'])) //Creating directory if needed
|
||||
mkdir($directory.$format['dir'], 0775);
|
||||
|
||||
$ext = $format['ext'] ? ".".$format['ext'] : $extension; //seting extension format
|
||||
$file = $filename.$ext; //seting full file name
|
||||
$dst_path = $directory.$format['dir'].$file; //image destination path
|
||||
|
||||
switch($ext) //creating image by selected extension format
|
||||
{
|
||||
case ".jpg":
|
||||
imagejpeg($dst_image, $dst_path);
|
||||
break;
|
||||
case ".png":
|
||||
imagepng($dst_image, $dst_path, 9);
|
||||
break;
|
||||
case ".gif":
|
||||
imagegif($dst_image, $dst_path);
|
||||
break;
|
||||
}
|
||||
imagedestroy($dst_image); //frees any memory associated with destination image image
|
||||
}
|
||||
|
||||
$file = $filename.$extension;
|
||||
$msg = rawurlencode("<b>'$filename'</b> {$DLG['upload_success']}<br><a href=\"javascript:browser.insertImage('$file');\">{$DLG['insert_uploaded']}</a>");
|
||||
die(stopUpload('done', $msg));
|
||||
}
|
||||
?>
|
||||
<iframe id="upload_target" name="upload_target" src="#" style="width:0px;height:0px;border:0px solid #fff;"></iframe>
|
||||
|
||||
<form id="upload_form" action="scripts/upload_image.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="browser.upload.start(this);" >
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<p class="info" ><?php echo $DLG['select_to_upload']; ?></p>
|
||||
<table>
|
||||
<tr><td><?php echo $DLG['dir'];?>: </td><td><input type="input" name="dir" value="<?php echo $dir;?>" readonly/></td></tr>
|
||||
<tr><td><?php echo $DLG['file_to_upload'];?>:</td><td><input class="file_input" type="file" name="file" accept="image/*,image/jpg,image/png,image/gif" /></td></tr>
|
||||
<tr><td><?php echo $DLG['as_file_name'];?>:</td><td><input type="input" name="filename" /></td></tr>
|
||||
</table>
|
||||
<hr>
|
||||
<p class="info" ><?php echo $DLG['select_img_format'];?></p>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><?php echo $DLG['format'];?></th>
|
||||
<th><?php echo $DLG['width'];?></th>
|
||||
<th><?php echo $DLG['height'];?></th>
|
||||
<th><?php echo $DLG['scale_type'];?></th>
|
||||
<th><?php echo $DLG['bg'];?></th>
|
||||
<tr>
|
||||
<tr>
|
||||
<td><input type="radio" name="formats[]" value="custom"/></td>
|
||||
<td><?php echo $DLG['custom'];?></td>
|
||||
<td><input type="text" name="format[width]" size="4" value="0"/>px</td>
|
||||
<td><input type="text" name="format[height]" size="4" value="0"/>px</td>
|
||||
<td>
|
||||
<select name="format[scale]">
|
||||
<?php
|
||||
foreach($SCALE_TYPES as $type => $title)
|
||||
echo "<option value='$type'>$title</option>";
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>#<input type="text" name="format[bg]" size="5" value="FFFFFF"/></td>
|
||||
</tr>
|
||||
<?php
|
||||
array_shift($IMAGE_FORMATS);
|
||||
|
||||
foreach($IMAGE_FORMATS as $id => $format)
|
||||
{
|
||||
$options = ($id == "orginal") ? "type='radio' checked" : "type='checkbox'";
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td><input $options name='formats[]' value='$id'/></td>";
|
||||
echo "<td>{$format['title']}</td>";
|
||||
echo "<td>{$format['width']}</td>";
|
||||
echo "<td>{$format['height']}</td>";
|
||||
echo "<td>".$SCALE_TYPES[$format['scale']]."</td>";
|
||||
echo "<td><div style='background:#{$format['bg']};border:1px solid black;width:16px;height:16px;'></div></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<hr>
|
||||
<input type="submit" name="upload" value="<?php echo $DLG['upload'];?>" />
|
||||
<div id="upload_messages"></div>
|
||||
</form>
|
||||
<div id="loading_form" style="text-align:center;display:none;">
|
||||
<p><?php echo $DLG['uploading'];?>...</p>
|
||||
<p><img src='styles/images/file-loader.gif' align='middle'/></p>
|
||||
</div>
|
||||
140
js/swampy_browser/styles/default.css
Normal file
@@ -0,0 +1,140 @@
|
||||
body {margin:0;padding:0;font: 13px/1.4 sans-serif;background:#404049;}
|
||||
html, body {height:100%;}
|
||||
|
||||
p.loader,p.alert,p.error,p.info,p.done {padding-left:20px;margin:5px;line-height:16px;}
|
||||
p.loader{background:url('images/loader.gif') no-repeat;}
|
||||
p.alert {background:url('images/alert.png') no-repeat;}
|
||||
p.error {background:url('images/error.png') no-repeat;}
|
||||
p.info {background:url('images/info.png') no-repeat;}
|
||||
p.done {background:url('images/done.png') no-repeat;}
|
||||
|
||||
a {text-decoration:none;color:#191970;}
|
||||
a:hover {color:#1F3F3F;}
|
||||
|
||||
#alert {width:400px;margin-left:-200px;padding:5px 20px;position:absolute;left:50%;z-index:100;border:1px solid black;border-top:none;background:white;opacity:0.9;filter:alpha(opacity = 90);}
|
||||
|
||||
#left_container,#right_container {height:550px;float:left;display:inline;}
|
||||
#left_container {width:250px;}
|
||||
#right_container {width:580px;}
|
||||
|
||||
#directories,#control,#information,#footer,#content {border:1px solid #AFCFCF;float:left;background:white;display:inline;}
|
||||
#directories,#control,#information{width:218px;margin:5px;padding:10px;}
|
||||
#directories {height:214px;overflow:auto;}
|
||||
#control {height:80px;}
|
||||
#information {height:160px;}
|
||||
#information label{font-weight:bold;}
|
||||
#information p{margin:0px 0px 0px 10px;font-size:11px;}
|
||||
|
||||
#footer,#content {width:558px;margin:5px;padding:5px;font-size:12px;display:inline;}
|
||||
#footer {height:16px;}
|
||||
#content {height:490px;overflow:auto;position:relative;}
|
||||
|
||||
#path {float:left;}
|
||||
#vmode {float:right;}
|
||||
|
||||
/* Directories tree */
|
||||
#directories ul {padding:0px;margin:0 0 5px 24px;}
|
||||
#directories li, #control li{margin:0;padding:0 0 2px 4px;line-height: 14px;height:16px;font-size:12px;list-style-image: url('images/directory.png');}
|
||||
#directories a:hover, #control a:hover{color:red;}
|
||||
|
||||
/* Control/Options menu */
|
||||
#control ul{margin:0;padding:0;margin-left:24px;}
|
||||
#control li {height:22px;}
|
||||
#control li.folder_add {list-style-image:url('images/folder_add.png');}
|
||||
#control li.upload_file {list-style-image:url('images/upload_file.png');}
|
||||
#control li.upload_image {list-style-image:url('images/upload_image.png');}
|
||||
|
||||
#vmode img{cursor:pointer;vertical-align:middle;}
|
||||
|
||||
/* THUMB STYLE */
|
||||
#file-thumb {width:112px;height:139px;float:left;margin:10px;padding:0;background:#F5F5DC;border:1px solid #b5a69c;position:relative;}
|
||||
#file-thumb.selected{background:#CDBA92;}
|
||||
#file-thumb:hover{color:red;}
|
||||
|
||||
#file-thumb .options {width:112px;height:100px;position:absolute;left:0;top:0;z-index:20;padding:6px 0;background:black;opacity:0.7;filter:alpha(opacity = 70);}
|
||||
#file-thumb .options a{margin:0 10px;display:block;padding:2px 2px;color:white;font-size:10px;}
|
||||
#file-thumb .options a:hover{background:white;color:black;}
|
||||
|
||||
#file-thumb .image {width:100px;height:100px;float:left;display:inline;margin:5px;cursor:pointer;border:1px solid #b5a69c;background:url('images/file.png') center no-repeat white;}
|
||||
#file-thumb .name {width:76px; height:16px; float:left;display:inline;margin:5px;}
|
||||
#file-thumb .size {display:none;}
|
||||
#file-thumb .dim {display:none;}
|
||||
#file-thumb .ctrl {width:16px; height:16px; float:left;display:inline;margin:5px;cursor:pointer;background:url('images/options.png') center no-repeat;}
|
||||
|
||||
|
||||
#file-row {width:500px;height:18px;margin:5px auto;padding:0;position:relative;border-bottom:1px solid #AAA;}
|
||||
#file-row.selected{font-weight:bold;border-bottom:1px solid black;}
|
||||
#file-row:hover{color:red;}
|
||||
|
||||
#file-row .options {width:auto;height:18px;position:absolute;right:20px;top:0;z-index:20;padding:0;opacity:0.9;filter:alpha(opacity = 90);}
|
||||
#file-row .options a{margin:0;display:block;float:right;padding:2px 10px;color:white;font-size:10px;background:black;}
|
||||
#file-row .options a:hover{background:white;color:black;}
|
||||
|
||||
#file-row .image {width:20px;height:18px;float:left;display:inline;background:url('images/file.png') center no-repeat white;}
|
||||
#file-row .name {width:250px;height:18px;float:left;display:inline;cursor:pointer;}
|
||||
#file-row .size {width:100px;height:18px;float:left;display:inline;text-align:right;}
|
||||
#file-row .dim {width:100px;height:18px;float:left;display:inline;text-align:right;}
|
||||
#file-row .ctrl {width:20px; height:16px;float:right;display:inline;cursor:pointer;background:url('images/options.png') center no-repeat;}
|
||||
|
||||
|
||||
#content .ext-parent{background:url('images/parent.png') center no-repeat white;}
|
||||
#content .ext-dir{background:url('images/directory.png') center no-repeat white;}
|
||||
#content .ext-3gp { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-afp { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-afpa { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-asp { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-aspx { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-avi { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-bat { background: url('images/application.png') no-repeat center white; }
|
||||
#content .ext-bmp { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-c { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-cfm { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-cgi { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-com { background: url('images/application.png') no-repeat center white; }
|
||||
#content .ext-cpp { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-css { background: url('images/css.png') no-repeat center white; }
|
||||
#content .ext-doc { background: url('images/doc.png') no-repeat center white; }
|
||||
#content .ext-exe { background: url('images/application.png') no-repeat center white; }
|
||||
#content .ext-gif { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-fla { background: url('images/flash.png') no-repeat center white; }
|
||||
#content .ext-h { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-htm { background: url('images/html.png') no-repeat center white; }
|
||||
#content .ext-html { background: url('images/html.png') no-repeat center white; }
|
||||
#content .ext-jar { background: url('images/java.png') no-repeat center white; }
|
||||
#content .ext-jpg { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-jpeg { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-js { background: url('images/script.png') no-repeat center white; }
|
||||
#content .ext-lasso { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-log { background: url('images/txt.png') no-repeat center white; }
|
||||
#content .ext-m4p { background: url('images/music.png') no-repeat center white; }
|
||||
#content .ext-mov { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-mp3 { background: url('images/music.png') no-repeat center white; }
|
||||
#content .ext-mp4 { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-mpg { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-mpeg { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-ogg { background: url('images/music.png') no-repeat center white; }
|
||||
#content .ext-pcx { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-pdf { background: url('images/pdf.png') no-repeat center white; }
|
||||
#content .ext-php { background: url('images/php.png') no-repeat center white; }
|
||||
#content .ext-png { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-ppt { background: url('images/ppt.png') no-repeat center white; }
|
||||
#content .ext-psd { background: url('images/psd.png') no-repeat center white; }
|
||||
#content .ext-pl { background: url('images/script.png') no-repeat center white; }
|
||||
#content .ext-py { background: url('images/script.png') no-repeat center white; }
|
||||
#content .ext-rb { background: url('images/ruby.png') no-repeat center white; }
|
||||
#content .ext-rbx { background: url('images/ruby.png') no-repeat center white; }
|
||||
#content .ext-rhtml { background: url('images/ruby.png') no-repeat center white; }
|
||||
#content .ext-rpm { background: url('images/linux.png') no-repeat center white; }
|
||||
#content .ext-ruby { background: url('images/ruby.png') no-repeat center white; }
|
||||
#content .ext-sql { background: url('images/db.png') no-repeat center white; }
|
||||
#content .ext-swf { background: url('images/flash.png') no-repeat center white; }
|
||||
#content .ext-tif { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-tiff { background: url('images/picture.png') no-repeat center white; }
|
||||
#content .ext-txt { background: url('images/txt.png') no-repeat center white; }
|
||||
#content .ext-vb { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-wav { background: url('images/music.png') no-repeat center white; }
|
||||
#content .ext-wmv { background: url('images/film.png') no-repeat center white; }
|
||||
#content .ext-xls { background: url('images/xls.png') no-repeat center white; }
|
||||
#content .ext-xml { background: url('images/code.png') no-repeat center white; }
|
||||
#content .ext-zip { background: url('images/zip.png') no-repeat center white; }
|
||||
#content .ext-rar { background: url('images/zip.png') no-repeat center white; }
|
||||
BIN
js/swampy_browser/styles/images/alert.png
Normal file
|
After Width: | Height: | Size: 682 B |
BIN
js/swampy_browser/styles/images/application.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
js/swampy_browser/styles/images/code.png
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
js/swampy_browser/styles/images/css.png
Normal file
|
After Width: | Height: | Size: 618 B |
BIN
js/swampy_browser/styles/images/db.png
Normal file
|
After Width: | Height: | Size: 579 B |
BIN
js/swampy_browser/styles/images/delete.png
Normal file
|
After Width: | Height: | Size: 370 B |
BIN
js/swampy_browser/styles/images/directory.png
Normal file
|
After Width: | Height: | Size: 505 B |
BIN
js/swampy_browser/styles/images/doc.png
Normal file
|
After Width: | Height: | Size: 651 B |
BIN
js/swampy_browser/styles/images/done.png
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
js/swampy_browser/styles/images/download.png
Normal file
|
After Width: | Height: | Size: 461 B |
BIN
js/swampy_browser/styles/images/error.png
Normal file
|
After Width: | Height: | Size: 805 B |
BIN
js/swampy_browser/styles/images/file-loader.gif
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
js/swampy_browser/styles/images/file.png
Normal file
|
After Width: | Height: | Size: 249 B |
BIN
js/swampy_browser/styles/images/film.png
Normal file
|
After Width: | Height: | Size: 653 B |
BIN
js/swampy_browser/styles/images/flash.png
Normal file
|
After Width: | Height: | Size: 582 B |
BIN
js/swampy_browser/styles/images/folder_add.png
Normal file
|
After Width: | Height: | Size: 631 B |
BIN
js/swampy_browser/styles/images/folder_delete.png
Normal file
|
After Width: | Height: | Size: 666 B |
BIN
js/swampy_browser/styles/images/html.png
Normal file
|
After Width: | Height: | Size: 734 B |
BIN
js/swampy_browser/styles/images/info.png
Normal file
|
After Width: | Height: | Size: 796 B |
BIN
js/swampy_browser/styles/images/java.png
Normal file
|
After Width: | Height: | Size: 633 B |
BIN
js/swampy_browser/styles/images/linux.png
Normal file
|
After Width: | Height: | Size: 668 B |
BIN
js/swampy_browser/styles/images/loader.gif
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
js/swampy_browser/styles/images/music.png
Normal file
|
After Width: | Height: | Size: 385 B |
BIN
js/swampy_browser/styles/images/options.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
js/swampy_browser/styles/images/parent.png
Normal file
|
After Width: | Height: | Size: 694 B |
BIN
js/swampy_browser/styles/images/pdf.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
js/swampy_browser/styles/images/php.png
Normal file
|
After Width: | Height: | Size: 538 B |
BIN
js/swampy_browser/styles/images/picture.png
Normal file
|
After Width: | Height: | Size: 606 B |
BIN
js/swampy_browser/styles/images/ppt.png
Normal file
|
After Width: | Height: | Size: 588 B |
BIN
js/swampy_browser/styles/images/psd.png
Normal file
|
After Width: | Height: | Size: 856 B |
BIN
js/swampy_browser/styles/images/row_view.png
Normal file
|
After Width: | Height: | Size: 307 B |
BIN
js/swampy_browser/styles/images/ruby.png
Normal file
|
After Width: | Height: | Size: 626 B |
BIN
js/swampy_browser/styles/images/script.png
Normal file
|
After Width: | Height: | Size: 859 B |
BIN
js/swampy_browser/styles/images/thumb_view.png
Normal file
|
After Width: | Height: | Size: 732 B |
BIN
js/swampy_browser/styles/images/txt.png
Normal file
|
After Width: | Height: | Size: 342 B |
BIN
js/swampy_browser/styles/images/upload_file.png
Normal file
|
After Width: | Height: | Size: 561 B |
BIN
js/swampy_browser/styles/images/upload_image.png
Normal file
|
After Width: | Height: | Size: 735 B |
BIN
js/swampy_browser/styles/images/xls.png
Normal file
|
After Width: | Height: | Size: 663 B |
BIN
js/swampy_browser/styles/images/zip.png
Normal file
|
After Width: | Height: | Size: 386 B |