pushed some changes made a long time ago
This commit is contained in:
parent
d4b2373574
commit
08f0a94787
@ -169,6 +169,7 @@ SQL;
|
|||||||
echo apiDokumentation();
|
echo apiDokumentation();
|
||||||
}
|
}
|
||||||
if ($out) {
|
if ($out) {
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
|
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
|
||||||
$length = strlen($strout);
|
$length = strlen($strout);
|
||||||
|
@ -153,8 +153,10 @@ from (`mt_skins`
|
|||||||
left join (`mt_skins_tag_map`
|
left join (`mt_skins_tag_map`
|
||||||
join `mt_tag`) on(`mt_skins_tag_map`.`mt_skins_id` = `mt_skins`.`id`) and (`mt_skins_tag_map`.`mt_tag_id` = `mt_tag`.`tag_id`))
|
join `mt_tag`) on(`mt_skins_tag_map`.`mt_skins_id` = `mt_skins`.`id`) and (`mt_skins_tag_map`.`mt_tag_id` = `mt_tag`.`tag_id`))
|
||||||
JOIN `mt_skins_licenses` ON `mt_skins_licenses`.id = `mt_skins`.license
|
JOIN `mt_skins_licenses` ON `mt_skins_licenses`.id = `mt_skins`.license
|
||||||
|
|
||||||
|
$sql
|
||||||
group by `mt_skins`.`id`
|
group by `mt_skins`.`id`
|
||||||
$sql LIMIT $offset,$per_page;
|
LIMIT $offset,$per_page;
|
||||||
sql;
|
sql;
|
||||||
$out[debug] = $sql;
|
$out[debug] = $sql;
|
||||||
$result = mysql_query($sql);
|
$result = mysql_query($sql);
|
||||||
@ -172,6 +174,7 @@ sql;
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
if ($out) {
|
if ($out) {
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
|
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
|
||||||
$length = strlen($strout);
|
$length = strlen($strout);
|
||||||
|
20
getskins.php
20
getskins.php
@ -12,6 +12,25 @@ if ($_POST[filtertype] == 'Author' && isset($_POST[filter])) {
|
|||||||
} else {
|
} else {
|
||||||
$sql = "";
|
$sql = "";
|
||||||
}
|
}
|
||||||
|
$filterarr = array();
|
||||||
|
|
||||||
|
if ($_POST[name] and $_POST[name] != ""){
|
||||||
|
$filterarr[] = "`mt_skins`.`name` LIKE '%" . mysql_real_escape_string($_POST[name]) . "%'";
|
||||||
|
}
|
||||||
|
if ($_POST[author] and $_POST[author] != ""){
|
||||||
|
$filterarr[] = "`mt_skins`.`author` LIKE '%" . mysql_real_escape_string($_POST[author]) . "%'";
|
||||||
|
}
|
||||||
|
if ($_POST[license] and $_POST[license] != ""){
|
||||||
|
$filterarr[] = "`mt_skins`.`license` LIKE '%" . mysql_real_escape_string($_POST[license]) . "%'";
|
||||||
|
}
|
||||||
|
if ($_POST[id] and $_POST[id] != ""){
|
||||||
|
$ids = explode(",",$_POST['id']);//todo: check if here are some security leaks.
|
||||||
|
$filterarr[] = "`mt_skins`.`id` IN ('" . implode("','", $ids) . "')";
|
||||||
|
}
|
||||||
|
if (count($filterarr)>=1){
|
||||||
|
$sql = "WHERE " . implode(" AND ", $filterarr);
|
||||||
|
}
|
||||||
|
else $sql = "";
|
||||||
|
|
||||||
$count = "SELECT count(*) FROM `mt_skins` LEFT JOIN `mt_skins_licenses` ON `mt_skins_licenses`.id = `mt_skins`.license " . $sql;
|
$count = "SELECT count(*) FROM `mt_skins` LEFT JOIN `mt_skins_licenses` ON `mt_skins_licenses`.id = `mt_skins`.license " . $sql;
|
||||||
|
|
||||||
@ -57,6 +76,7 @@ $sql = <<<sql
|
|||||||
`mt_skins`.uploaded,
|
`mt_skins`.uploaded,
|
||||||
`mt_skins`.type,
|
`mt_skins`.type,
|
||||||
`mt_skins`.img,
|
`mt_skins`.img,
|
||||||
|
`mt_skins`.cape_compatible,
|
||||||
mt_skins_licenses.name AS license,
|
mt_skins_licenses.name AS license,
|
||||||
mt_skins_licenses.id AS license_id
|
mt_skins_licenses.id AS license_id
|
||||||
FROM `mt_skins`
|
FROM `mt_skins`
|
||||||
|
@ -144,6 +144,7 @@ function handleFileSelect(evt) {
|
|||||||
img.className = 'thumb';
|
img.className = 'thumb';
|
||||||
//css klasse zuweisen fuers aussehen ;)
|
//css klasse zuweisen fuers aussehen ;)
|
||||||
img.src = e.target.result;
|
img.src = e.target.result;
|
||||||
|
useTexture(e.target.result);
|
||||||
//das ist die data:// url fuer die vorschau
|
//das ist die data:// url fuer die vorschau
|
||||||
img.title = Datei.name;
|
img.title = Datei.name;
|
||||||
//als titel noch der dateiname.
|
//als titel noch der dateiname.
|
||||||
@ -209,7 +210,8 @@ function handleFileSelect(evt) {
|
|||||||
var width = img.width;
|
var width = img.width;
|
||||||
var height = img.height;
|
var height = img.height;
|
||||||
var className = (width == 64 && height == 32) ? "valid" : "invalid";
|
var className = (width == 64 && height == 32) ? "valid" : "invalid";
|
||||||
resolutionElem.innerHTML += "Resolution: <input class=" + className + " value='" + width + "px x " + height + "px' disabled>";
|
var toolTip = (width == 64 && height == 32) ? "resolution is 64x32, good :-)" : "currently only 64x32 images are alowed. sorry.";
|
||||||
|
resolutionElem.innerHTML += "Resolution: <input title='"+toolTip+"' class=" + className + " value='" + width + "px x " + height + "px' disabled>";
|
||||||
|
|
||||||
var imgElem = document.createElement('input');
|
var imgElem = document.createElement('input');
|
||||||
imgElem.name = 'img';
|
imgElem.name = 'img';
|
||||||
@ -231,6 +233,8 @@ function handleFileSelect(evt) {
|
|||||||
form.insertBefore(document.createElement('br'), null);
|
form.insertBefore(document.createElement('br'), null);
|
||||||
form.insertBefore(sizeElem, null);
|
form.insertBefore(sizeElem, null);
|
||||||
form.insertBefore(document.createElement('br'), null);
|
form.insertBefore(document.createElement('br'), null);
|
||||||
|
form.insertBefore(resolutionElem, null);
|
||||||
|
form.insertBefore(document.createElement('br'), null);
|
||||||
form.insertBefore(mimeElem, null);
|
form.insertBefore(mimeElem, null);
|
||||||
form.insertBefore(document.createElement('br'), null);
|
form.insertBefore(document.createElement('br'), null);
|
||||||
//form.insertBefore(resolutionElem, null);
|
//form.insertBefore(resolutionElem, null);
|
||||||
@ -636,7 +640,7 @@ function changeFilter(form){
|
|||||||
refreshFilterState();
|
refreshFilterState();
|
||||||
}
|
}
|
||||||
function isFilterActive(){
|
function isFilterActive(){
|
||||||
return (URIHash.get("id",false) || URIHash.get("name",false)|| URIHash.get("author",false)|| URIHash.get("license",false))
|
return (URIHash.get("id",false) || URIHash.get("name",false)|| URIHash.get("author",false)|| URIHash.get("license",false));
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshFilterState(){
|
function refreshFilterState(){
|
||||||
|
23
upload.php
23
upload.php
@ -14,19 +14,22 @@ $output[img] = $size;
|
|||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
if ($size[0] == 64 && $size[1] == 32 && $size[mime] == "image/png") {
|
if ($size[0] == 64 && $size[1] == 32 && $size[mime] == "image/png") {
|
||||||
$valid = true;
|
if ($author && $name && $license) {
|
||||||
} else {
|
|
||||||
$output[success] = false;
|
|
||||||
$output[status_msg] = 'ERROR: NOT a valid Skin file.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($author && $name && $license && $valid) {
|
|
||||||
$output[success] = true;
|
$output[success] = true;
|
||||||
$output[status_msg] = 'Upload sucessfull done';
|
$output[status_msg] = 'Upload sucessfull done';
|
||||||
} else {
|
|
||||||
$output[success] = false;
|
|
||||||
$output[status_msg] = 'ERROR: could not save the Skin. Some Parameter Missing. This could be happend by an outdated browser or by a try to hack.';
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$output[success] = false;
|
||||||
|
$output[status_msg] = 'ERROR: could not save the Skin. missing param author or name or license';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$valid = false;
|
||||||
|
$output[success] = false;
|
||||||
|
$output[status_msg] = 'ERROR: NOT a valid Skin file. only image/png and 64x32 skins are currently supported. (im working on a fix...)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($output[success] == true) {
|
if ($output[success] == true) {
|
||||||
$sql = "SELECT `id`
|
$sql = "SELECT `id`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user