403Webshell
Server IP : 5.129.245.98  /  Your IP : 216.73.216.246
Web Server : Apache/2.4.66 (Debian)
System : Linux 1b8c17c336b9 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/wp-content/plugins/content-egg/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/content-egg/application/models/PriceAlertModel.php
<?php

namespace ContentEgg\application\models;

defined('\ABSPATH') || exit;

use ContentEgg\application\helpers\TextHelper;

/**
 * PriceAlertModel class file
 *
 * @author keywordrush.com <support@keywordrush.com>
 * @link https://www.keywordrush.com
 * @copyright Copyright &copy; 2025 keywordrush.com
 */
class PriceAlertModel extends Model
{

	const STATUS_INACTIVE = 0;
	const STATUS_ACTIVE = 1;
	const STATUS_DELETED = 3;
	const CLEAN_DELETED_DAYS = 180;

	public function tableName()
	{
		return $this->getDb()->prefix . 'cegg_price_alert';
	}

	public function getDump()
	{
		return "CREATE TABLE " . $this->tableName() . " (
                    id bigint(20) unsigned NOT NULL auto_increment,
                    unique_id varchar(255) NOT NULL,
                    module_id varchar(255) NOT NULL,
                    post_id bigint(20) unsigned DEFAULT NULL,
                    create_date datetime NOT NULL,
                    complet_date datetime NOT NULL default '0000-00-00 00:00:00',
                    email varchar(255) NOT NULL,
                    price float(12,2) DEFAULT NULL,
                    start_price float(12,2) DEFAULT NULL,
                    status tinyint(1) DEFAULT 0,
                    activkey varchar(16) NOT NULL,
                    PRIMARY KEY  (id),
                    KEY uid (unique_id(80),module_id(30)),
                    KEY status (status)
                    ) $this->charset_collate;";
	}

	public static function model($className = __CLASS__)
	{
		return parent::model($className);
	}

	public function save(array $item)
	{
		if (empty($item['create_date']))
		{
			$item['create_date'] = \current_time('mysql');
		}
		if (!isset($item['status']))
		{
			$item['status'] = self::STATUS_INACTIVE;
		}
		if (!isset($item['activkey']))
		{
			$item['activkey'] = TextHelper::randomPassword(16);
		}

		return parent::save($item);
	}

	public function cleanOld($days, $optimize = true, $date_field = 'complet_date')
	{
		$this->deleteAll('status = ' . self::STATUS_DELETED . ' AND TIMESTAMPDIFF( DAY, ' . $date_field . ', "' . \current_time('mysql') . '") > ' . $days);
		if ($optimize)
		{
			$this->optimizeTable();
		}
	}

	public function unsubscribeAll($email)
	{
		$sql = 'DELETE FROM ' . $this->tableName() . ' WHERE email = %s AND status != %d';
		$this->getDb()->query($this->getDb()->prepare($sql, $email, self::STATUS_DELETED));
	}

	public static function getStatus($id)
	{
		$statuses = self::getStatuses();
		if (isset($statuses[$id]))
		{
			return $statuses[$id];
		}
		else
		{
			return null;
		}
	}

	public static function getStatuses()
	{
		return array(
			self::STATUS_INACTIVE => 'INACTIVE',
			self::STATUS_ACTIVE   => 'ACTIVE',
			self::STATUS_DELETED  => 'DELETED',
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit