*

rooman

  • ****
  • 231 posts
How can I disable fake ads
« on: December 24, 2022, 12:10:09 PM »
Hello
Many times fake ads appear
It is not fake
I always delete reports of fake ads
How can I disable this option

*

MB Themes

Re: How can I disable fake ads
« Reply #1 on: December 24, 2022, 12:48:45 PM »
You probably cannot
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I disable fake ads
« Reply #2 on: December 25, 2022, 09:37:21 AM »
You probably cannot

Where can I find the code responsible for this function

*

MB Themes

Re: How can I disable fake ads
« Reply #3 on: December 25, 2022, 12:42:16 PM »
Somewhere in code.
Check ItemActions.php
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I disable fake ads
« Reply #4 on: December 26, 2022, 11:36:20 AM »
I found this code in this path oc-includes\osclass\functions.php
Code: [Select]
function osc_admin_toolbar_spam() {
  $total = Item::newInstance()->countByMarkas( 'spam' );
  if ( $total > 0 ) {
    $title = '<i class="circle circle-red">' . $total . '</i>' . __( 'Spam' );

    AdminToolbar::newInstance()->add_menu(
      array (
        'id'  => 'spam' ,
        'title' => $title ,
        'href'  => osc_admin_base_url( true ) . '?page=items&action=items_reported&sort=spam' ,
        'meta'  => array ( 'class' => 'action-btn action-btn-black' )
      )
    );
  }
}
Is it if it is disabled
It will not affect the site

*

MB Themes

Re: How can I disable fake ads
« Reply #5 on: December 26, 2022, 12:50:11 PM »
It will just not show counter.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I disable fake ads
« Reply #6 on: December 27, 2022, 12:17:17 PM »
This is the code for fake ads
If it is disabled, does it affect other codes?

Code: [Select]
// akismet check spam ...
    if ($this->_akismet_text($aItem[ 'title' ], $aItem[ 'description' ], $contactName, $contactEmail)) {
      $is_spam = 1;
    }

    $flash_error .= ((!osc_validate_category($aItem[ 'catId' ])) ? _m('Category invalid.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_number($aItem[ 'price' ])) ? _m('Price must be a number.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max(number_format((float)$aItem[ 'price' ], 0, '', ''), 25)) ? _m('Price too long.') . PHP_EOL : '');
    $flash_error .= (($aItem[ 'price' ] !== null && (int)$aItem[ 'price' ] < 0) ? _m('Price must be positive number.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($contactName, 35)) ? _m('Name too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($contactPhone, 100)) ? _m('Phone too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($contactOther, 100)) ? _m('Other contact information too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_email($contactEmail)) ? _m('Email invalid.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_text($aItem[ 'countryName' ], 2, false)) ? _m('Country too short.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($aItem[ 'countryName' ], 50)) ? _m('Country too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_text($aItem[ 'regionName' ], 2, false)) ? _m('Region too short.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($aItem[ 'regionName' ], 50)) ? _m('Region too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_text($aItem[ 'cityName' ], 2, false)) ? _m('City too short.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($aItem[ 'cityName' ], 50)) ? _m('City too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_text($aItem[ 'cityArea' ], 2, false)) ? _m('Municipality too short.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_max($aItem[ 'cityArea' ], 50)) ? _m('Municipality too long.') . PHP_EOL : '');
    $flash_error .= ((!osc_validate_text($aItem[ 'address' ], 3, false)) ? _m('Address too short.') . PHP_EOL  : '');
    $flash_error .= ((!osc_validate_max($aItem[ 'address' ], 100)) ? _m('Address too long.') . PHP_EOL : '');
    $flash_error .= ((((time() - (int)Session::newInstance()->_get('last_submit_item')) < osc_items_wait_time()) && !$this->is_admin) ? _m('Too fast. You should wait a little to publish your ad.') . PHP_EOL : '');

    $_meta = Field::newInstance()->findByCategory($aItem[ 'catId' ]);
    $meta  = (is_array(Params::getParam('meta')) ? Params::getParam('meta') : array());

    if(is_array($_meta) && count($_meta) > 0) {
      foreach ($_meta as $_m) {
        if(isset($_m['pk_i_id']) && trim($_m['pk_i_id']) <> '') {
          $meta[$_m['pk_i_id']] = isset($meta[$_m['pk_i_id']]) ? $meta[$_m['pk_i_id']] : '';
        }
      }
    }

    if ($meta != '' && is_array($meta) && count($meta) > 0) {
      $mField = Field::newInstance();
     
      foreach ($meta as $k => $v) {
        if ($v == '') {
          $field = $mField->findByPrimaryKey($k);
          if ($field[ 'b_required' ] == 1) {
            $flash_error .= sprintf(_m('%s field is required.'), $field[ 's_name' ]) . PHP_EOL;
          }
        }
      }
    }

*

MB Themes

Re: How can I disable fake ads
« Reply #7 on: December 27, 2022, 06:02:07 PM »
In itemactions.php change this:
Code: [Select]
    if (isset($column)) {
      ItemStats::newInstance()->increase($column, $id);
    }

into:
Code: [Select]
    if (isset($column) && $as != 'spam') {
      ItemStats::newInstance()->increase($column, $id);
    }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rooman

  • ****
  • 231 posts
Re: How can I disable fake ads
« Reply #8 on: December 28, 2022, 11:34:19 AM »
In itemactions.php change this:
Code: [Select]
    if (isset($column)) {
      ItemStats::newInstance()->increase($column, $id);
    }

into:
Code: [Select]
    if (isset($column) && $as != 'spam') {
      ItemStats::newInstance()->increase($column, $id);
    }

Thank you
I will experiment and let you know the developments
Kindly
In the new version 8.0.3, if possible, put a button in the control panel in the Ads Settings section
Activate the search for fake ads
Disable the search for fake ads
Thank you again