Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class ControllerStudioUploadArt extends Controller {
  15.  
  16. public function index() {
  17.  
  18. $this->load->language("studio/upload_art");
  19. $this->data["heading_title"] = $this->language->get("heading_title");
  20. $this->data["text_copyright"] = $this->language->get("text_copyright");
  21. $this->data["text_browse"] = $this->language->get("text_browse");
  22. $this->data["text_select_colors"] = $this->language->get("text_select_colors");
  23. $this->data["text_below_colors"] = $this->language->get("text_below_colors");
  24. $this->data["text_background"] = $this->language->get("text_background");
  25. $this->data["button_cancel"] = $this->language->get("button_cancel");
  26. $this->data["button_agree"] = $this->language->get("button_agree");
  27. $this->data["button_upload"] = $this->language->get("button_upload");
  28. $this->data["button_change_image"] = $this->language->get("button_change_image");
  29. $this->data["button_apply"] = $this->language->get("button_apply");
  30. $this->data["button_remove_color"] = $this->language->get("button_remove_color");
  31. $this->data["button_cancel_remove_color"] = $this->language->get("button_cancel_remove_color");
  32. $this->load->model("opentshirts/design_color");
  33. $this->data["colors"] = $this->model_opentshirts_design_color->getColors();
  34. $licensekey = $this->config->get("ot_uyoa_licensekey");
  35. $localkey = $this->config->get("ot_uyoa_localkey") ? ($this->config->get("ot_uyoa_localkey")) : "";
  36. $this->data["results"] = $this->uyoa_check_license($licensekey, $localkey);
  37. if ($this->data["results"]["status"] == "Active")
  38. {
  39. if (isset($this->data["results"]["localkey"]))
  40. {
  41. $localkeydata = $this->data["results"]["localkey"];
  42. $this->db->query("INSERT INTO " . DB_PREFIX . "setting SET store_id = '0', `group` = 'ot_uyoa', `key` = 'ot_uyoa_localkey', `value` = '" . $this->db->escape($localkeydata) . "'");
  43. }
  44. }
  45. if (file_exists(DIR_TEMPLATE . $this->config->get("config_template") . "/template/studio/upload_art.tpl"))
  46. {
  47. $this->template = $this->config->get("config_template") . "/template/studio/upload_art.tpl";
  48. }
  49. else
  50. {
  51. $this->template = "default/template/studio/upload_art.tpl";
  52. }
  53. $this->response->setOutput($this->render());
  54. return;
  55. }
  56.  
  57. public function upload_image() {
  58.  
  59. $this->language->load("studio/upload_art");
  60. $json = array();
  61. if (!empty($this->request->files["file"]["name"]))
  62. {
  63. $filename = html_entity_decode($this->request->files["file"]["name"], ENT_QUOTES, "UTF-8");
  64. $allowed = array();
  65. $filetypes = explode(",", "jpg,png,gif,JPG");
  66. foreach ($filetypes as $filetype)
  67. {
  68. $allowed[] = trim($filetype);
  69. continue;
  70. }
  71. if (!in_array(utf8_substr(strrchr($filename, "."), 1), $allowed))
  72. {
  73. $json["error"] = $this->language->get("error_filetype");
  74. }
  75. if ($this->request->files["file"]["error"] != UPLOAD_ERR_OK)
  76. {
  77. $json["error"] = $this->language->get("error_upload_" . $this->request->files["file"]["error"]);
  78. }
  79. }
  80. else
  81. {
  82. $json["error"] = $this->language->get("error_upload");
  83. }
  84. if ($this->request->server["REQUEST_METHOD"] == "POST" && !isset($json["error"]))
  85. {
  86. if (is_uploaded_file($this->request->files["file"]["tmp_name"]) || file_exists($this->request->files["file"]["tmp_name"]))
  87. {
  88. $file = substr(md5(rand()), 0, 8) . "-" . basename($filename);
  89. if (move_uploaded_file($this->request->files["file"]["tmp_name"], DIR_IMAGE . "data/bitmaps/" . $file))
  90. {
  91. $json["filename"] = $file;
  92. ..........................................................................
  93. ....................................
  94. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement