Advertisement
Guest User

Untitled

a guest
Jan 12th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.3.0
  8. * @ Author : DeZender
  9. * @ Release on : 17.05.2011
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class users {
  15. var $id = null;
  16. var $error = null;
  17. var $clean = null;
  18. var $settings = null;
  19. var $array = null;
  20. var $tmp = null;
  21.  
  22. function users($id = 0) {
  23. global $db;
  24.  
  25. if ($id) {
  26. $this->id = $id;
  27. $this->array = array( );
  28. $this->array = $db->fetchAssoc( 'select * from ' . TABLE_USERS . ' where id=' . $id );
  29.  
  30. foreach ($this->array as $key => $value) {
  31. $this->array[$key] = clean( $value );
  32. }
  33. }
  34.  
  35. }
  36.  
  37. function getid() {
  38. return $this->id;
  39. }
  40.  
  41. function delete($id = 0) {
  42. global $db;
  43. global $config_abs_path;
  44. global $config_demo;
  45.  
  46. if ($config_demo == 1) {
  47. return null;
  48. }
  49.  
  50. if (!$id) {
  51. $id = $this->id;
  52. }
  53.  
  54. $username = $this->getUsername( $id );
  55. $res_del = $db->query( 'delete from ' . TABLE_USERS . ' where id="' . $id . '"' );
  56. $listings = new listings( );
  57. $listings->deleteUser( $id );
  58. auth::deleteloginhistory( $username );
  59. users_packages::deleteuser( $id );
  60. global $ads_settings;
  61.  
  62. if ($ads_settings['saved_searches_enabled']) {
  63. require_once( $config_abs_path . '/classes/searches.php' );
  64. searches::deleteuser( $id );
  65. }
  66.  
  67. require_once( $config_abs_path . '/classes/actions.php' );
  68. actions::deleteuser( $id );
  69. require_once( $config_abs_path . '/classes/coupons.php' );
  70. coupons::deleteuser( $id );
  71. $res_del = $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id`=\'' . $id . '\' and `option`=\'store\'' ) );
  72. }
  73.  
  74. function deleteusers($group) {
  75. global $db;
  76.  
  77. $arr = $db->fetchRowList( 'select id from ' . TABLE_USERS . ( '' . ' where `group`=' . $group ) );
  78.  
  79. foreach ($arr as $row) {
  80. $this->delete( $row );
  81. }
  82.  
  83. return 1;
  84. }
  85.  
  86. function enable($id = 0) {
  87. global $db;
  88. global $config_demo;
  89.  
  90. if ($config_demo == 1) {
  91. return null;
  92. }
  93.  
  94. $array = $db->fetchAssoc( 'select ' . TABLE_USERS . '.*, (' . TABLE_USERS . '.active=0 && ' . TABLE_USER_GROUPS . '.admin_verification=1 ) as pending from ' . TABLE_USERS . ' left join ' . TABLE_USER_GROUPS . ' on ' . TABLE_USERS . '.`group` = ' . TABLE_USER_GROUPS . '.`id` where ' . TABLE_USERS . ( '' . '.`id` =' . $id ) );
  95.  
  96. if (!$id) {
  97. $id = $this->id;
  98. }
  99.  
  100. $res = $db->query( 'update ' . TABLE_USERS . ' set active=1 where id="' . $id . '"' );
  101.  
  102. if ($array['pending']) {
  103. global $config_abs_path;
  104.  
  105. require_once( $config_abs_path . '/classes/mails.php' );
  106. require_once( $config_abs_path . '/classes/mail_templates.php' );
  107. $mail2send = new mails( );
  108. $mail2send->init( $array['email'], $array['contact_name'] );
  109. $array_subject = array( );
  110. $array_message = array( 'user' => $array, 'username' => $array['username'] );
  111. $mail2send->composeAndSend( 'registration', $array_message, $array_subject );
  112. }
  113.  
  114. }
  115.  
  116. function enablestore($id) {
  117. global $db;
  118.  
  119. $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 1 where `id`=\'' . $id . '\'' ) );
  120. global $ads_settings;
  121.  
  122. $days_expires = $ads_settings['store_availability'];
  123. $timestamp = date( 'Y-m-d H:i:s' );
  124.  
  125. if ($days_expires) {
  126. $str_expires = '' . ' `date_expires` = date_add(\'' . $timestamp . '\', interval \'' . $days_expires . '\' day)';
  127. } else {
  128. $str_expires = ' `date_expires` = \'\'';
  129. }
  130.  
  131. $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id` = ' . $id . ' and `option` like \'store\'' ) );
  132. $db->query( 'insert into ' . TABLE_OPTIONS . ( '' . ' set `object_id` = \'' . $id . '\', `option` = \'store\', `date_added` = \'' . $timestamp . '\', ' . $str_expires . ' ' ) );
  133. return 1;
  134. }
  135.  
  136. function disablestore($id) {
  137. global $db;
  138.  
  139. $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 0 where `id`=\'' . $id . '\'' ) );
  140. return 1;
  141. }
  142.  
  143. function enablependingstore($id) {
  144. global $db;
  145. global $lng;
  146. global $ads_settings;
  147.  
  148. $days_expires = $ads_settings['store_availability'];
  149. $timestamp = date( 'Y-m-d H:i:s' );
  150.  
  151. if ($days_expires) {
  152. $str_expires = '' . '`date_expires` = date_add(\'' . $timestamp . '\', interval \'' . $days_expires . '\' day)';
  153. } else {
  154. $str_expires = '`date_expires` = \'\'';
  155. }
  156.  
  157. $db->query( 'update ' . TABLE_USERS . ( '' . ' set `store` = 1 where `id`=\'' . $id . '\'' ) );
  158. $db->query( 'delete from ' . TABLE_OPTIONS . ( '' . ' where `object_id` = ' . $id . ' and `option` like \'store\'' ) );
  159. $db->query( 'insert into ' . TABLE_OPTIONS . ( '' . ' set `object_id` = \'' . $id . '\', `option` = \'store\', `date_added` = \'' . $timestamp . '\', ' . $str_expires . ' ' ) );
  160. $db->query( 'update ' . TABLE_ACTIONS . ( '' . ' set pending=0 where type=\'store\' and `user_id` = ' . $id ) );
  161. global $config_abs_path;
  162.  
  163. require_once( $config_abs_path . '/classes/mails.php' );
  164. require_once( $config_abs_path . '/classes/mail_templates.php' );
  165. $user = new users( );
  166. $user_details = $user->getUser( $id );
  167. $username = $user_details['username'];
  168. $user_email = $user_details['email'];
  169. $user_contact = $user_details['contact_name'];
  170.  
  171. if (!$user_contact) {
  172. $user_contact = $username;
  173. }
  174.  
  175. $mail2send = new mails( );
  176. $mail2send->init( $user_email, $user_contact );
  177. $array_subject = array( );
  178. $array_message = array( 'id' => $id, 'username' => $username, 'contact_name' => $user_contact, 'days' => $ads_settings['store_availability'], 'admin_activated' => 1, 'status' => $lng['general']['active'] );
  179. $mail2send->composeAndSend( 'buy_store_status', $array_message, $array_subject );
  180. return 1;
  181. }
  182.  
  183. function enablebulkuploads($id) {
  184. global $db;
  185.  
  186. $db->query( 'update ' . TABLE_USERS . ( '' . ' set `bulk_uploads` = 1 where `id`=\'' . $id . '\'' ) );
  187. return 1;
  188. }
  189.  
  190. function disablebulkuploads($id) {
  191. global $db;
  192.  
  193. $db->query( 'update ' . TABLE_USERS . ( '' . ' set `bulk_uploads` = 0 where `id`=\'' . $id . '\'' ) );
  194. return 1;
  195. }
  196.  
  197. function disable($id = 0) {
  198. global $db;
  199. global $config_demo;
  200.  
  201. if ($config_demo == 1) {
  202. return null;
  203. }
  204.  
  205. if (!$id) {
  206. $id = $this->id;
  207. }
  208.  
  209. $res = $db->query( 'update ' . TABLE_USERS . ' set active=0 where id="' . $id . '"' );
  210. }
  211.  
  212. function block($id) {
  213. global $db;
  214. global $config_demo;
  215.  
  216. if ($config_demo == 1) {
  217. return null;
  218. }
  219.  
  220. $ip = $this->getIp( $id );
  221. $res = $db->query( 'delete from ' . TABLE_BLOCKED_IPS . ' where ip like "' . $ip . '"' );
  222. $res1 = $db->query( 'insert into ' . TABLE_BLOCKED_IPS . ' values ("' . $ip . '")' );
  223. }
  224.  
  225. function unblock($id) {
  226. global $db;
  227. global $config_demo;
  228.  
  229. if ($config_demo == 1) {
  230. return null;
  231. }
  232.  
  233. $ip = $this->getIp( $id );
  234. $res = $db->query( 'delete from ' . TABLE_BLOCKED_IPS . ' where ip like "' . $ip . '"' );
  235. }
  236.  
  237. function activate_link($username, $activation) {
  238. global $db;
  239. global $lng;
  240.  
  241. $res = $db->query( 'select active from ' . TABLE_USERS . ( '' . ' where username like \'' . $username . '\'' ) );
  242.  
  243. if (!$db->numRows( $res )) {
  244. $this->addError( $lng['users']['errors']['invalid_account_or_activation'] );
  245. return 0;
  246. }
  247.  
  248. if ($db->fetchRow( ) == 1) {
  249. $this->addError( $lng['users']['errors']['account_already_active'] );
  250. return 0;
  251. }
  252.  
  253. $res = $db->query( 'select id from ' . TABLE_USERS . ( '' . ' where username like \'' . $username . '\' and activation like \'' . $activation . '\'' ) );
  254.  
  255. if (!$db->numRows( $res )) {
  256. $this->addError( $lng['users']['errors']['invalid_account_or_activation'] );
  257. return 0;
  258. }
  259.  
  260. $res = $db->query( 'update ' . TABLE_USERS . ( '' . ' set active=1 where username like \'' . $username . '\'' ) );
  261. return 1;
  262. }
  263.  
  264. function getusername($id = '') {
  265. global $db;
  266.  
  267. if (!$id) {
  268. $id = $this->id;
  269. }
  270.  
  271. $uname = $db->fetchRow( 'select username from ' . TABLE_USERS . ' where id="' . $id . '"' );
  272. return $uname;
  273. }
  274.  
  275. function getpasshash($id = '') {
  276. global $db;
  277.  
  278. if (!$id) {
  279. $id = $this->id;
  280. }
  281.  
  282. $pass = $db->fetchRow( 'select password from ' . TABLE_USERS . ' where id="' . $id . '"' );
  283. return $pass;
  284. }
  285.  
  286. function getuserid($username, $identity = '') {
  287. global $db;
  288.  
  289. $str = '';
  290.  
  291. if ($identity) {
  292. $str = '' . ' and `identity`=\'' . $identity . '\'';
  293. }
  294.  
  295. $id = $db->fetchRow( 'select id from ' . TABLE_USERS . ' where username like "' . $username . '"' . $str );
  296.  
  297. if (!$id) {
  298. return 0;
  299. }
  300.  
  301. return $id;
  302. }
  303.  
  304. function getgroup($id) {
  305. global $db;
  306.  
  307. $id = $db->fetchRow( 'select `group` from ' . TABLE_USERS . ( '' . ' where id=' . $id ) );
  308.  
  309. if (!$id) {
  310. return 0;
  311. }
  312.  
  313. return $id;
  314. }
  315.  
  316. ...............................
  317. ...............
  318. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement