Advertisement
Guest User

Untitled

a guest
Sep 10th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 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.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. require_once CLASSES_DIR . PHP5_DIR . 'meta/DbTables.php';
  15.  
  16. class geoTableRowset implements Iterator
  17. {
  18. private $_rs = null;
  19. protected $_rowClass = 'geoTableRow';
  20.  
  21. public function __construct(geoTableSelect $select)
  22. {
  23. if ($select) {
  24. $this->_rs = DataAccess::getInstance()->Execute('' . $select);
  25. }
  26. }
  27.  
  28. public function fetchRow()
  29. {
  30. if (!$this->_rs) {
  31. return false;
  32. }
  33.  
  34. return new $this->_rowClass($this->_rs->FetchRow());
  35. }
  36.  
  37. public function rewind()
  38. {
  39. if (!$this->_rs) {
  40. return null;
  41. }
  42.  
  43. $this->_rs->MoveFirst();
  44. }
  45.  
  46. public function current()
  47. {
  48. if (!$this->_rs) {
  49. return false;
  50. }
  51.  
  52. return new $this->_rowClass($this->_rs->fields);
  53. }
  54.  
  55. public function key()
  56. {
  57. return $this->_rs->CurrentKey();
  58. }
  59.  
  60. public function next()
  61. {
  62. $this->_rs->MoveNext();
  63. }
  64.  
  65. public function valid()
  66. {
  67. return !$this->_rs->EOF;
  68. }
  69.  
  70. public function __toString()
  71. {
  72. return '' . $this->_rs;
  73. }
  74. }
  75.  
  76. class DataAccess
  77. {
  78. private static $instance = null;
  79. private $db = null;
  80. private $perf = null;
  81. private $executeTime = null;
  82. private $numExecutes = null;
  83. private $result_sets = null;
  84. private $configuration_data = null;
  85. private $errors = null;
  86. private $queries = null;
  87. public $geoTables = null;
  88. private $db_info = null;
  89. private $old_config_columns = null;
  90. private $messages = null;
  91. private $messages_pages = null;
  92. private $language_id = null;
  93. private $num_new_ads = null;
  94. private $preloaded_num_new_ads = null;
  95. private $allowedTags = false;
  96. private $ipIsChecked = null;
  97. private $_tableSelects = array();
  98.  
  99. const TYPE_STRING = 'string';
  100. const TYPE_STRING_TODB = 'toDB';
  101. const TYPE_INT = 'int';
  102. const TYPE_FLOAT = 'float';
  103. const TYPE_BOOL = 'bool';
  104. const SELECT_BROWSE = 'browse';
  105. const SELECT_SEARCH = 'search';
  106. const SELECT_FEED = 'feed';
  107. const ADODB_DEBUG = 0;
  108.  
  109. public static function getInstance()
  110. {
  111. if (!(isset($instance) && is_object(self::$instance))) {
  112. $c = 'DataAccess';
  113. self::$instance = new $c();
  114. }
  115.  
  116. return self::$instance;
  117. }
  118.  
  119. private function __construct()
  120. {
  121. $this->results = array();
  122. $this->current_result_index = 0;
  123. $this->geoTables = new geoTables();
  124. }
  125.  
  126. private function __clone()
  127. {
  128. throw new Exception('No cloning permitted! Make sure that the setting "zend.ze1_compatibility_mode" is turned OFF in your php.ini configuration file.');
  129. }
  130.  
  131. private function _checkResults($results)
  132. {
  133. return true;
  134. }
  135.  
  136. private function init()
  137. {
  138. if (!$this->IsConnected()) {
  139. require GEO_BASE_DIR . 'config.default.php';
  140. $this->db_info = array('db_host' => $db_host, 'db_name' => $database);
  141.  
  142. try {
  143. $this->db = ADONewConnection($db_type);
  144.  
  145. if (isset($persistent_connections) && $persistent_connections) {
  146. if (!$this->db->PConnect($db_host, $db_username, $db_password, $database)) {
  147. echo 'Could not connect to database.';
  148.  
  149. exit();
  150. }
  151. } else {
  152. if (!$this->db->Connect($db_host, $db_username, $db_password, $database)) {
  153. echo 'Could not connect to database.';
  154.  
  155. exit();
  156. }
  157. }
  158. } catch (exception $e) {
  159. echo 'Could not connect to database.';
  160.  
  161. exit();
  162. }
  163.  
  164. if (defined('IAMDEVELOPER') && self::ADODB_DEBUG) {
  165. session_start();
  166. $this->db->LogSQL();
  167. $this->perf = &NewPerfMonitor($this->db);
  168. }
  169.  
  170. if (isset($strict_mode) && $strict_mode) {
  171. $this->Execute("SET SESSION sql_mode=''");
  172. }
  173.  
  174. if (isset($force_db_connection_charset) && strlen(trim($force_db_connection_charset))) {
  175. $this->db->Execute("SET NAMES '" . $force_db_connection_charset . "'");
  176. }
  177.  
  178. $this->db->SetFetchMode(ADODB_FETCH_ASSOC);
  179. }
  180. }
  181.  
  182. public function IsConnected()
  183. {
  184. if (isset($this->db) && is_object($this->db) && $this->db->IsConnected()) {
  185. return true;
  186. }
  187.  
  188. return false;
  189. }
  190.  
  191. public function Affected_Rows()
  192. {
  193. $this->init();
  194.  
  195. return $this->db->Affected_Rows();
  196. }
  197.  
  198. public function Execute($sql, $inputs = false)
  199. {
  200. $this->init();
  201. trigger_error('DEBUG STATS_EXTRA: Using Execute wrapper! Query: ' . $sql);
  202. $sqlI = 'Execute: ' . $sql;
  203.  
  204. if (!isset($this->queries[$sqlI])) {
  205. $this->queries[$sqlI]['count'] = 1;
  206. } else {
  207. $this->queries[$sqlI]['count']++;
  208. }
  209.  
  210. $start = $this->microtime_float();
  211.  
  212. try {
  213. if (is_array($inputs)) {
  214. $results = $this->db->Execute($sql, $inputs);
  215. } else {
  216. $results = $this->db->Execute($sql);
  217. }
  218.  
  219. $execution_time = $this->microtime_float() - $start;
  220. $this->executeTime += $execution_time;
  221. $this->numExecutes++;
  222. $this->queries[$sqlI]['time'][] = $execution_time;
  223.  
  224. if ($results === false) {
  225. trigger_error('ERROR SQL: Sql Query: ' . $sql . ' Error Reported: ' . $this->db->ErrorMsg());
  226.  
  227. return false;
  228. }
  229. } catch (Exception $e) {
  230. trigger_error('ERROR SQL STATS: Sql Query: ' . $sql . ' Error Caught: ' . print_r($e, 1));
  231.  
  232. return false;
  233. }
  234.  
  235. return $results;
  236. }
  237.  
  238. public function ErrorMsg()
  239. {
  240. if (isset($this->errors) && strlen($this->errors)) {
  241. return $this->errors;
  242. }
  243.  
  244. $this->init();
  245.  
  246. return $this->db->ErrorMsg();
  247. }
  248.  
  249. public function qstr($var_1, $var_2 = false)
  250. {
  251. $this->init();
  252.  
  253. return $this->db->qstr($var_1, $var_2);
  254. }
  255.  
  256. public function Prepare($sql)
  257. {
  258. $this->init();
  259. $sqlI = 'Prepare: ' . $sql;
  260.  
  261. if (!isset($this->queries[$sqlI])) {
  262. $this->queries[$sqlI]['count'] = 1;
  263. ............................................................................
  264. ................................................
  265. ......................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement