Advertisement
Guest User

Untitled

a guest
Mar 27th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.8.0
  8. * @ Author : DeZender
  9. * @ Release on : 25.09.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class directadmin_extended_license_1721PDOWrapper
  15. {
  16. private static $pdoConnection = null;
  17.  
  18. private static 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. private static 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. public static function query($query, $params = array( ))
  52. {
  53. $statement = self::getDbConnection( )->prepare( $query );
  54. $statement->execute( $params );
  55. return $statement;
  56. }
  57.  
  58. public static function real_escape_string($string)
  59. {
  60. return substr( self::getDbConnection( )->quote( $string ), 1, -1 );
  61. }
  62.  
  63. public static function fetch_assoc($query)
  64. {
  65. return $query->fetch( PDO::FETCH_ASSOC );
  66. }
  67.  
  68. public static function fetch_array($query)
  69. {
  70. return $query->fetch( PDO::FETCH_BOTH );
  71. .....................................................................
  72. .............................................
  73. ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement