fixed a big motherfucking bug when uploading a same skin

This commit is contained in:
printempw 2016-02-07 15:18:27 +08:00
parent f11b742ffc
commit 512e0ad7b8

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-01-16 23:01:33 * @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr * @Last Modified by: prpr
* @Last Modified time: 2016-02-06 23:32:13 * @Last Modified time: 2016-02-07 15:16:44
*/ */
class User class User
@ -103,11 +103,11 @@ class User
} }
public function setTexture($type, $file) { public function setTexture($type, $file) {
$hash = Utils::upload($file);
// Remove the original texture first // Remove the original texture first
if ($this->getTexture($type) != "") if ($this->getTexture($type) != "")
Utils::remove("./textures/".$this->getTexture($type)); Utils::remove("./textures/".$this->getTexture($type));
$this->updateLastModified(); $this->updateLastModified();
$hash = Utils::upload($file);
if ($type == "steve" | $type == "alex" | $type == "cape") if ($type == "steve" | $type == "alex" | $type == "cape")
return $this->db->update($this->uname, 'hash_'.$type, $hash); return $this->db->update($this->uname, 'hash_'.$type, $hash);
return false; return false;