Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.91 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 listings
  15. {
  16. public $id = null;
  17. public $no_listings = null;
  18. public $use_index = null;
  19.  
  20. public function __construct($id = 0)
  21. {
  22. global $db;
  23.  
  24. if ($id) {
  25. $this->id = $id;
  26. $this->array = array( );
  27. $this->array = $db->fetchAssoc( 'select * from ' . TABLE_ADS . ' where `id`=' . $id );
  28. }
  29. }
  30.  
  31. public function getId()
  32. {
  33. return $this->id;
  34. }
  35.  
  36. public function setNoListings($no)
  37. {
  38. $this->no_listings = $no;
  39. }
  40.  
  41. public function noListings()
  42. {
  43. return $this->no_listings;
  44. }
  45.  
  46. public function delete($id = 0)
  47. {
  48. global $db;
  49. global $config_abs_path;
  50. if (!($id) || !(is_numeric( $id ))) {
  51. return;
  52. }
  53.  
  54. $this->decCat( $id );
  55. $res_del = $db->query( 'delete from ' . TABLE_ADS . ' where `id`=\'' . $id . '\'' );
  56. $pics = new pictures( );
  57. $pics->deletePictures( $id );
  58. require_once $config_abs_path . '/classes/actions.php';
  59. actions::deleteListing( $id );
  60. require_once $config_abs_path . '/classes/coupons.php';
  61. coupons::deleteListing( $id );
  62. $res_del = $db->query( 'delete from ' . TABLE_OPTIONS . ' where `object_id`=\'' . $id . '\' and `option`!=\'store\'' );
  63. global $settings;
  64.  
  65. if ($settings['nologin_enabled']) {
  66. $db->query( 'delete from ' . TABLE_ADS_EXTENSION . ' where `id`=' . $id );
  67. }
  68.  
  69. $res_del = $db->query( 'delete from ' . TABLE_FAVOURITES . ' where `ad_id`=\'' . $id . '\'' );
  70. $res_del = $db->query( 'delete from ' . TABLE_PENDING_EDITED . ' where `ad_id`=\'' . $id . '\'' );
  71. require_once $config_abs_path . '/classes/auctions.php';
  72. $ac = new auctions( );
  73. $ac->deleteForAd( $id );
  74. do_action( 'delete_listing', array( $id ) );
  75. }
  76.  
  77. public function isExpired($id = 0)
  78. {
  79. global $db;
  80.  
  81. if (!($id)) {
  82. $id = $this->id;
  83. }
  84.  
  85. $timestamp = date( 'Y-m-d H:i:s' );
  86. $res = $db->query( 'select count(*) from ' . TABLE_ADS . ' where `id`=\'' . $id . '\' and date_expires<\'' . $timestamp . '\' and date_expires!=\'0000-00-00 00:00:00\' ' );
  87.  
  88. if (0 < $db->numRows( $res )) {
  89. return 1;
  90. }
  91.  
  92. return 0;
  93. }
  94.  
  95. public static function getUrlTitle($id)
  96. {
  97. $title = cleanHtml( listings::getTitle( $id ) );
  98. return _urlencode( $title );
  99. }
  100.  
  101. public static function getTitle($id, $multiple = 0)
  102. {
  103. global $db;
  104. global $crt_lang;
  105. global $ads_settings;
  106. $title_var = '`title`';
  107.  
  108. if ($ads_settings['translate_title_description']) {
  109. global $languages;
  110.  
  111. if (empty( $languages )) {
  112. $languages = common::getCachedObject( 'base_languages' );
  113. }
  114.  
  115. if (1 < count( $languages )) {
  116. $title_var = '`title_' . $crt_lang . '`';
  117. }
  118. }
  119.  
  120. $title = $db->fetchRow( 'select ' . $title_var . ' from ' . TABLE_ADS . ' where `id`=\'' . $id . '\'' );
  121.  
  122. if ($multiple) {
  123. $arr['title'] = $title;
  124. return $arr;
  125. }
  126.  
  127. return $title;
  128. }
  129.  
  130. public function Activate($id = 0)
  131. {
  132. global $db;
  133.  
  134. if (!($id)) {
  135. $id = $this->id;
  136. }
  137.  
  138. $this->incCat( $id );
  139. $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=1, `user_approved`=1 where `id`=\'' . $id . '\'' );
  140. $pending = $db->query( 'select pending from ' . TABLE_ADS . ' where id=\'' . $id . '\'' );
  141.  
  142. if ($pending) {
  143. $this->ActivatePending( $id );
  144. }
  145.  
  146. if ($this->isExpired( $id )) {
  147. $this->renew( $id );
  148. }
  149. }
  150.  
  151. public function activateListing($id = 0)
  152. {
  153. global $db;
  154.  
  155. if (!($id)) {
  156. $id = $this->id;
  157. }
  158.  
  159. $this->incCat( $id );
  160. $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=1, pending=0, `user_approved`=1 where `id`=\'' . $id . '\'' );
  161.  
  162. if ($this->isExpired( $id )) {
  163. $this->renew( $id );
  164. }
  165.  
  166. $res_actions = $db->query( 'update ' . TABLE_ACTIONS . ' set pending=0 where type like \'newad\' or type like \'renewad\' and object_id=' . $id );
  167. global $ads_settings;
  168.  
  169. if ($ads_settings['alerts_enabled']) {
  170. global $config_abs_path;
  171. require_once $config_abs_path . '/classes/alerts.php';
  172. $alert = new alerts( );
  173. $alert->checkImmediate( $id, $this->getShortListing( $id ) );
  174. }
  175.  
  176. return 1;
  177. }
  178.  
  179. public function ActivatePending($id)
  180. {
  181. global $db;
  182. global $lng;
  183. global $config_abs_path;
  184. require_once $config_abs_path . '/classes/mails.php';
  185. require_once $config_abs_path . '/classes/mail_templates.php';
  186. $this->incCat( $id );
  187. $db->query( 'update ' . TABLE_ADS . ' set active=1, pending=0, `user_approved` = 1 where id=' . $id );
  188. $db->query( 'update ' . TABLE_ACTIONS . ' set pending=0 where (type=\'newad\' or type=\'renewad\') and object_id = ' . $id );
  189. global $config_abs_path;
  190. require_once $config_abs_path . '/classes/users.php';
  191. $user_details = listings::getUserDetails( $id );
  192. $mail2send = new mails( );
  193. $mail2send->init( $user_details['email'], $user_details['name'] );
  194. $plan_name = listings::getPackageName( $id );
  195. $details_link = listings::makeDetailsLink( $id, $user_details['key'] );
  196. $array_subject = array( );
  197. $array_message = array(
  198. 'id' => $id,
  199. 'ad_id' => $id,
  200. 'username' => $user_details['username'],
  201. 'contact_name' => $user_details['name'],
  202. 'nologin' => $user_details['nologin'],
  203. 'admin_activated' => 1,
  204. 'active' => 1,
  205. 'status' => $lng['general']['active'],
  206. 'plan_name' => $plan_name,
  207. 'details_link' => $details_link
  208. );
  209. $mail2send->composeAndSend( 'ad_publish_status', $array_message, $array_subject );
  210. global $ads_settings;
  211.  
  212. if ($ads_settings['alerts_enabled']) {
  213. global $config_abs_path;
  214. require_once $config_abs_path . '/classes/alerts.php';
  215. require_once $config_abs_path . '/classes/fields.php';
  216. require_once $config_abs_path . '/classes/depending_fields.php';
  217. require_once $config_abs_path . '/classes/pictures.php';
  218. $alert = new alerts( );
  219. $alert->checkImmediate( $id, $this->getShortListing( $id ) );
  220. }
  221. }
  222.  
  223. public function Deactivate($id = 0)
  224. {
  225. global $db;
  226.  
  227. if (!($id)) {
  228. $id = $this->id;
  229. }
  230.  
  231. $this->decCat( $id );
  232. $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=0 where `id`=\'' . $id . '\'' );
  233. }
  234.  
  235. public function userApprove($id)
  236. {
  237. global $db;
  238. $res = $db->query( 'update ' . TABLE_ADS . ' set `user_approved`=1 where `id`=\'' . $id . '\'' );
  239. }
  240.  
  241. public function nologinApprove($id)
  242. {
  243. global $db;
  244. global $settings;
  245. global $config_abs_path;
  246.  
  247. if (!($id)) {
  248. $id = $this->id;
  249. }
  250.  
  251. $this->userApprove( $id );
  252.  
  253. if ($settings['nologin_activate_via_sms'] == 1) {
  254. $activation = generate_random( );
  255. $db->query( 'update ' . TABLE_ADS_EXTENSION . ' set `activation`=\'' . $activation . '\' where `id`=\'' . $id . '\'' );
  256. }
  257.  
  258. require_once $config_abs_path . '/classes/actions.php';
  259. $actions = actions::getPendingListingActions( $id );
  260. $array_upgrades = array(
  261. 'featured',
  262. 'highlited',
  263. 'priority',
  264. 'video'
  265. );
  266. $array_ad = array(
  267. 'newad',
  268. 'renewad'
  269. );
  270. $upgrade = 0;
  271. $ad_pending = 0;
  272.  
  273. foreach ($actions as $act) {
  274. if (in_array( $act['type'], $array_upgrades )) {
  275. $upgrade = 1;
  276. }
  277.  
  278. if (in_array( $act['type'], $array_ad )) {
  279. $ad_pending = 1;
  280. }
  281. }
  282.  
  283. if ($ad_pending || $upgrade) {
  284. $this->makePending( $id );
  285.  
  286. if ($settings['send_mail_to_admin_when_pending']) {
  287. $result = $db->fetchAssoc( 'SELECT `' . TABLE_ACTIONS . '`.invoice, `' . TABLE_PAYMENT_ACTIONS . '`.processor from `' . TABLE_ACTIONS . '` left join `' . TABLE_PAYMENT_ACTIONS . '` on `' . TABLE_PAYMENT_ACTIONS . '`.id = `' . TABLE_ACTIONS . '`.`invoice` where (`object_id` = ' . $id . ' and (`type` like \'newad\' or `type` like \'renewad\'))' );
  288. $processor = $result['processor'];
  289. $invoice_no = $result['invoice'];
  290. ....................................................................
  291. ...........................
  292. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement