1
0

pushed some changes made a long time ago

This commit is contained in:
adrido 2014-12-23 03:09:56 +01:00
parent d4b2373574
commit 08f0a94787
5 changed files with 45 additions and 14 deletions

View File

@ -169,6 +169,7 @@ SQL;
echo apiDokumentation();
}
if ($out) {
header("Access-Control-Allow-Origin: *");
header('Content-type: application/json');
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$length = strlen($strout);

View File

@ -153,8 +153,10 @@ from (`mt_skins`
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_skins_licenses` ON `mt_skins_licenses`.id = `mt_skins`.license
group by `mt_skins`.`id`
$sql LIMIT $offset,$per_page;
$sql
group by `mt_skins`.`id`
LIMIT $offset,$per_page;
sql;
$out[debug] = $sql;
$result = mysql_query($sql);
@ -172,6 +174,7 @@ sql;
}
}}
if ($out) {
header("Access-Control-Allow-Origin: *");
header('Content-type: application/json');
$strout = json_encode($out, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$length = strlen($strout);

View File

@ -12,6 +12,25 @@ if ($_POST[filtertype] == 'Author' && isset($_POST[filter])) {
} else {
$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;
@ -57,6 +76,7 @@ $sql = <<<sql
`mt_skins`.uploaded,
`mt_skins`.type,
`mt_skins`.img,
`mt_skins`.cape_compatible,
mt_skins_licenses.name AS license,
mt_skins_licenses.id AS license_id
FROM `mt_skins`

View File

@ -144,6 +144,7 @@ function handleFileSelect(evt) {
img.className = 'thumb';
//css klasse zuweisen fuers aussehen ;)
img.src = e.target.result;
useTexture(e.target.result);
//das ist die data:// url fuer die vorschau
img.title = Datei.name;
//als titel noch der dateiname.
@ -209,7 +210,8 @@ function handleFileSelect(evt) {
var width = img.width;
var height = img.height;
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');
imgElem.name = 'img';
@ -231,6 +233,8 @@ function handleFileSelect(evt) {
form.insertBefore(document.createElement('br'), null);
form.insertBefore(sizeElem, null);
form.insertBefore(document.createElement('br'), null);
form.insertBefore(resolutionElem, null);
form.insertBefore(document.createElement('br'), null);
form.insertBefore(mimeElem, null);
form.insertBefore(document.createElement('br'), null);
//form.insertBefore(resolutionElem, null);
@ -636,7 +640,7 @@ function changeFilter(form){
refreshFilterState();
}
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(){

View File

@ -14,19 +14,22 @@ $output[img] = $size;
header('Content-Type: application/json');
if ($size[0] == 64 && $size[1] == 32 && $size[mime] == "image/png") {
$valid = true;
} else {
if ($author && $name && $license) {
$output[success] = true;
$output[status_msg] = 'Upload sucessfull done';
}
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.';
$output[status_msg] = 'ERROR: NOT a valid Skin file. only image/png and 64x32 skins are currently supported. (im working on a fix...)';
}
if ($author && $name && $license && $valid) {
$output[success] = true;
$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.';
}
if ($output[success] == true) {
$sql = "SELECT `id`