Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 3.0.8.0
- * @ Author : DeZender
- * @ Release on : 25.09.2017
- * @ Official site : http://DeZender.Net
- *
- */
- class listings
- {
- public $id = null;
- public $no_listings = null;
- public $use_index = null;
- public function __construct($id = 0)
- {
- global $db;
- if ($id) {
- $this->id = $id;
- $this->array = array( );
- $this->array = $db->fetchAssoc( 'select * from ' . TABLE_ADS . ' where `id`=' . $id );
- }
- }
- public function getId()
- {
- return $this->id;
- }
- public function setNoListings($no)
- {
- $this->no_listings = $no;
- }
- public function noListings()
- {
- return $this->no_listings;
- }
- public function delete($id = 0)
- {
- global $db;
- global $config_abs_path;
- if (!($id) || !(is_numeric( $id ))) {
- return;
- }
- $this->decCat( $id );
- $res_del = $db->query( 'delete from ' . TABLE_ADS . ' where `id`=\'' . $id . '\'' );
- $pics = new pictures( );
- $pics->deletePictures( $id );
- require_once $config_abs_path . '/classes/actions.php';
- actions::deleteListing( $id );
- require_once $config_abs_path . '/classes/coupons.php';
- coupons::deleteListing( $id );
- $res_del = $db->query( 'delete from ' . TABLE_OPTIONS . ' where `object_id`=\'' . $id . '\' and `option`!=\'store\'' );
- global $settings;
- if ($settings['nologin_enabled']) {
- $db->query( 'delete from ' . TABLE_ADS_EXTENSION . ' where `id`=' . $id );
- }
- $res_del = $db->query( 'delete from ' . TABLE_FAVOURITES . ' where `ad_id`=\'' . $id . '\'' );
- $res_del = $db->query( 'delete from ' . TABLE_PENDING_EDITED . ' where `ad_id`=\'' . $id . '\'' );
- require_once $config_abs_path . '/classes/auctions.php';
- $ac = new auctions( );
- $ac->deleteForAd( $id );
- do_action( 'delete_listing', array( $id ) );
- }
- public function isExpired($id = 0)
- {
- global $db;
- if (!($id)) {
- $id = $this->id;
- }
- $timestamp = date( 'Y-m-d H:i:s' );
- $res = $db->query( 'select count(*) from ' . TABLE_ADS . ' where `id`=\'' . $id . '\' and date_expires<\'' . $timestamp . '\' and date_expires!=\'0000-00-00 00:00:00\' ' );
- if (0 < $db->numRows( $res )) {
- return 1;
- }
- return 0;
- }
- public static function getUrlTitle($id)
- {
- $title = cleanHtml( listings::getTitle( $id ) );
- return _urlencode( $title );
- }
- public static function getTitle($id, $multiple = 0)
- {
- global $db;
- global $crt_lang;
- global $ads_settings;
- $title_var = '`title`';
- if ($ads_settings['translate_title_description']) {
- global $languages;
- if (empty( $languages )) {
- $languages = common::getCachedObject( 'base_languages' );
- }
- if (1 < count( $languages )) {
- $title_var = '`title_' . $crt_lang . '`';
- }
- }
- $title = $db->fetchRow( 'select ' . $title_var . ' from ' . TABLE_ADS . ' where `id`=\'' . $id . '\'' );
- if ($multiple) {
- $arr['title'] = $title;
- return $arr;
- }
- return $title;
- }
- public function Activate($id = 0)
- {
- global $db;
- if (!($id)) {
- $id = $this->id;
- }
- $this->incCat( $id );
- $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=1, `user_approved`=1 where `id`=\'' . $id . '\'' );
- $pending = $db->query( 'select pending from ' . TABLE_ADS . ' where id=\'' . $id . '\'' );
- if ($pending) {
- $this->ActivatePending( $id );
- }
- if ($this->isExpired( $id )) {
- $this->renew( $id );
- }
- }
- public function activateListing($id = 0)
- {
- global $db;
- if (!($id)) {
- $id = $this->id;
- }
- $this->incCat( $id );
- $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=1, pending=0, `user_approved`=1 where `id`=\'' . $id . '\'' );
- if ($this->isExpired( $id )) {
- $this->renew( $id );
- }
- $res_actions = $db->query( 'update ' . TABLE_ACTIONS . ' set pending=0 where type like \'newad\' or type like \'renewad\' and object_id=' . $id );
- global $ads_settings;
- if ($ads_settings['alerts_enabled']) {
- global $config_abs_path;
- require_once $config_abs_path . '/classes/alerts.php';
- $alert = new alerts( );
- $alert->checkImmediate( $id, $this->getShortListing( $id ) );
- }
- return 1;
- }
- public function ActivatePending($id)
- {
- global $db;
- global $lng;
- global $config_abs_path;
- require_once $config_abs_path . '/classes/mails.php';
- require_once $config_abs_path . '/classes/mail_templates.php';
- $this->incCat( $id );
- $db->query( 'update ' . TABLE_ADS . ' set active=1, pending=0, `user_approved` = 1 where id=' . $id );
- $db->query( 'update ' . TABLE_ACTIONS . ' set pending=0 where (type=\'newad\' or type=\'renewad\') and object_id = ' . $id );
- global $config_abs_path;
- require_once $config_abs_path . '/classes/users.php';
- $user_details = listings::getUserDetails( $id );
- $mail2send = new mails( );
- $mail2send->init( $user_details['email'], $user_details['name'] );
- $plan_name = listings::getPackageName( $id );
- $details_link = listings::makeDetailsLink( $id, $user_details['key'] );
- $array_subject = array( );
- $array_message = array(
- 'id' => $id,
- 'ad_id' => $id,
- 'username' => $user_details['username'],
- 'contact_name' => $user_details['name'],
- 'nologin' => $user_details['nologin'],
- 'admin_activated' => 1,
- 'active' => 1,
- 'status' => $lng['general']['active'],
- 'plan_name' => $plan_name,
- 'details_link' => $details_link
- );
- $mail2send->composeAndSend( 'ad_publish_status', $array_message, $array_subject );
- global $ads_settings;
- if ($ads_settings['alerts_enabled']) {
- global $config_abs_path;
- require_once $config_abs_path . '/classes/alerts.php';
- require_once $config_abs_path . '/classes/fields.php';
- require_once $config_abs_path . '/classes/depending_fields.php';
- require_once $config_abs_path . '/classes/pictures.php';
- $alert = new alerts( );
- $alert->checkImmediate( $id, $this->getShortListing( $id ) );
- }
- }
- public function Deactivate($id = 0)
- {
- global $db;
- if (!($id)) {
- $id = $this->id;
- }
- $this->decCat( $id );
- $res = $db->query( 'update ' . TABLE_ADS . ' set `active`=0 where `id`=\'' . $id . '\'' );
- }
- public function userApprove($id)
- {
- global $db;
- $res = $db->query( 'update ' . TABLE_ADS . ' set `user_approved`=1 where `id`=\'' . $id . '\'' );
- }
- public function nologinApprove($id)
- {
- global $db;
- global $settings;
- global $config_abs_path;
- if (!($id)) {
- $id = $this->id;
- }
- $this->userApprove( $id );
- if ($settings['nologin_activate_via_sms'] == 1) {
- $activation = generate_random( );
- $db->query( 'update ' . TABLE_ADS_EXTENSION . ' set `activation`=\'' . $activation . '\' where `id`=\'' . $id . '\'' );
- }
- require_once $config_abs_path . '/classes/actions.php';
- $actions = actions::getPendingListingActions( $id );
- $array_upgrades = array(
- 'featured',
- 'highlited',
- 'priority',
- 'video'
- );
- $array_ad = array(
- 'newad',
- 'renewad'
- );
- $upgrade = 0;
- $ad_pending = 0;
- foreach ($actions as $act) {
- if (in_array( $act['type'], $array_upgrades )) {
- $upgrade = 1;
- }
- if (in_array( $act['type'], $array_ad )) {
- $ad_pending = 1;
- }
- }
- if ($ad_pending || $upgrade) {
- $this->makePending( $id );
- if ($settings['send_mail_to_admin_when_pending']) {
- $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\'))' );
- $processor = $result['processor'];
- $invoice_no = $result['invoice'];
- ....................................................................
- ...........................
- .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement