Advertisement
Guest User

Untitled

a guest
Aug 25th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 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.3
  8. * @ Author : DeZender
  9. * @ Release on : 06.05.2013
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. if (!defined("GSP_CALLED"))
  15. {
  16. exit("This file cannot be called directly, please include gsp-panel.php");
  17. }
  18.  
  19.  
  20. class GSP {
  21.  
  22.  
  23. private static $_instance = null;
  24. private $version = "1.0.84-stable";
  25. private $releasetype = null;
  26. private $allowedservers = null;
  27. private $allowedgameservers = null;
  28. public $licinfo = null;
  29. public $updates = null;
  30. public $settings = null;
  31. public $lang = null;
  32. public $api = false;
  33. public $db = null;
  34. public static function getInstance() {
  35.  
  36. if (null === self::$_instance)
  37. {
  38. self::$_instance = new self();
  39. }
  40. return self::$_instance;
  41. }
  42.  
  43. public function __construct() {
  44.  
  45. require_once DOC_ROOT . "/includes/mysql.conf.php";
  46. if (!($this->db = new mysqli($config["mysql_host"], $config["mysql_user"], $config["mysql_pass"], $config["mysql_database"])))
  47. {
  48. exit("There was a problem connecting to the database");
  49. }
  50. $this->db->set_charset("utf8");
  51. return;
  52. }
  53.  
  54. public function GetAllowedGameServers() {
  55.  
  56. return $this->allowedgameservers;
  57. }
  58.  
  59. public function GetAllowedServers() {
  60.  
  61. return $this->allowedservers;
  62. }
  63.  
  64. public function CheckVersion() {
  65.  
  66. return $this->version;
  67. }
  68.  
  69. public function GetReleaseType() {
  70.  
  71. return $this->releasetype;
  72. }
  73.  
  74. public function Update() {
  75.  
  76. if (!extension_loaded("zip"))
  77. {
  78. return array("error" => -1);
  79. }
  80. if (!is_writeable(DOC_ROOT))
  81. {
  82. return array("error" => -2);
  83. }
  84. $updateurl = $this->updates["url"];
  85. $localzip = DOC_ROOT . "/update.zip";
  86. $dir = DOC_ROOT;
  87. $ch = curl_init($updateurl);
  88. curl_setopt($ch, CURLOPT_HEADER, 0);
  89. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  90. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  91. $rawdata = curl_exec($ch);
  92. curl_close($ch);
  93. if (file_exists($localzip))
  94. {
  95. @unlink($localzip);
  96. }
  97. if (strlen($rawdata) < 200)
  98. {
  99. return array("error" => -5, "message" => $rawdata);
  100. }
  101. $fp = fopen($localzip, "x");
  102. fwrite($fp, $rawdata);
  103. fclose($fp);
  104. if (!(!is_file($localzip)) && !is_dir($dir))
  105. {
  106. return array("error" => -3);
  107. }
  108. $zip = new ZipArchive();
  109. $res = $zip->open($localzip, ZIPARCHIVE::CHECKCONS);
  110. if ($res === true)
  111. {
  112. $erroredfiles = array();
  113. $i = 0;
  114. while ($i <= $zip->numFiles)
  115. {
  116. if (file_exists($dir . "/" . $zip->getNameIndex($i)) && !is_writable($dir . "/" . $zip->getNameIndex($i)))
  117. {
  118. $erroredfiles[] = $zip->getNameIndex($i);
  119. }
  120. ++$i;
  121. continue;
  122. }
  123. if (0 < count($erroredfiles))
  124. {
  125. $filestring = "";
  126. ...........................................................................
  127. .............................
  128. ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement