Guest User

Untitled

a guest
Aug 20th, 2020
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 15.05.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class proxmox_vps_license_4690PDOWrapper
  15. {
  16. static private $pdoConnection;
  17.  
  18. static private function getDbConnection()
  19. {
  20. if (class_exists('Illuminate\\Database\\Capsule\\Manager')) {
  21. return Illuminate\Database\Capsule\Manager::connection()->getPdo();
  22. }
  23.  
  24. if (self::$pdoConnection === NULL) {
  25. self::$pdoConnection = self::setNewConnection();
  26. }
  27.  
  28. return self::$pdoConnection;
  29. }
  30.  
  31. static private function setNewConnection()
  32. {
  33. try {
  34. $includePath = ROOTDIR . DIRECTORY_SEPARATOR . 'configuration.php';
  35.  
  36. if (file_exists($includePath)) {
  37. require $includePath;
  38. }
  39. else {
  40. throw new Exception('No configuration file found');
  41. }
  42.  
  43. $connection = new PDO(sprintf('mysql:host=%s;dbname=%s;port=%s;charset=utf8', $db_host, $db_name, $db_port ? $db_port : 3360), $db_username, $db_password);
  44. $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  45. return $connection;
  46. }
  47. catch (PDOException $exc) {
  48. }
  49. }
  50.  
  51. static public function query($query, $params = [])
  52. {
  53. $statement = self::getDbConnection()->prepare($query);
  54. $statement->execute($params);
  55. return $statement;
  56. }
  57.  
  58. static public function real_escape_string($string)
  59. {
  60. return substr(self::getDbConnection()->quote($string), 1, -1);
  61. }
  62.  
  63. static public function fetch_assoc($query)
  64. {
  65. return $query->fetch(PDO::FETCH_ASSOC);
  66. }
  67.  
  68. static public function fetch_array($query)
  69. {
  70. return $query->fetch(PDO::FETCH_BOTH);
  71. }
  72.  
  73. static public function fetch_object($query)
  74. {
  75. return $query->fetch(PDO::FETCH_OBJ);
  76. }
  77.  
  78. static public function num_rows($query)
  79. {
  80. $query->fetch(PDO::FETCH_BOTH);
  81. return $query->rowCount();
  82. }
  83.  
  84. static public function insert_id()
  85. {
  86. return self::getDbConnection()->lastInsertId();
  87. }
  88.  
  89. static public function errorInfo()
  90. {
  91. $tmpErr = self::getDbConnection()->errorInfo();
  92. if ($tmpErr[0] && ($tmpErr[0] !== '00000')) {
  93. return $tmpErr;
  94. }
  95.  
  96. return false;
  97. }
  98.  
  99. static public function mysql_get_array($query, $params = [])
  100. {
  101. $qRes = self::query($query, $params);
  102. $arr = [];
  103.  
  104. while ($row = self::fetch_assoc($qRes)) {
  105. $arr[] = $row;
  106. }
  107.  
  108. return $arr;
  109. }
  110.  
  111. static public function mysql_get_row($query, $params = [])
  112. {
  113. $qRes = self::query($query, $params);
  114. ......................................................................
  115. .....................................
  116. .................
RAW Paste Data