403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/skyweb24.popuppro/lib/entity/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/skyweb24.popuppro/lib/entity/stattable.php
<?php
namespace Skyweb24\Popuppro\Entity;

use Bitrix\Main\Localization\Loc,
    Bitrix\Main\ORM\Data\DataManager,
    Bitrix\Main\ORM\Fields\DatetimeField,
    Bitrix\Main\ORM\Fields\IntegerField,
    Bitrix\Main\ORM\Fields\StringField,
    Bitrix\Main\ORM\Fields\TextField,
    Bitrix\Main\ORM\Fields\Validators\LengthValidator,
    Bitrix\Main\Type\DateTime;

Loc::loadMessages(__FILE__);

/**
 * Class StatTable
 *
 * Fields:
 * <ul>
 * <li> id int mandatory
 * <li> id_popup int mandatory
 * <li> url string(200) mandatory
 * <li> site_url string(200) mandatory
 * <li> date datetime optional default current datetime
 * <li> close_type string(20) optional
 * <li> show_time int optional default 0
 * <li> target_action string(10) optional default 'N'
 * <li> device string(20) mandatory
 * <li> os string(20) mandatory
 * <li> browser string(20) mandatory
 * <li> ip string(16) optional default '0.0.0.0'
 * </ul>
 *
 * @package Bitrix\Popuppro
 **/

class StatTable extends DataManager
{
    /**
     * Returns DB table name for entity.
     *
     * @return string
     */
    public static function getTableName()
    {
        return 'skyweb24_popuppro_stat';
    }

    /**
     * Returns entity map definition.
     *
     * @return array
     */
    public static function getMap()
    {
        return [
            new IntegerField(
                'id',
                [
                    'primary' => true,
                    'autocomplete' => true,
                    'title' => Loc::getMessage('STAT_ENTITY_ID_FIELD')
                ]
            ),
            new IntegerField(
                'id_popup',
                [
                    'required' => true,
                    'title' => Loc::getMessage('STAT_ENTITY_ID_POPUP_FIELD')
                ]
            ),
            new StringField(
                'url',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateUrl'],
                    'title' => Loc::getMessage('STAT_ENTITY_URL_FIELD')
                ]
            ),
            new StringField(
                'site_url',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateSiteUrl'],
                    'title' => Loc::getMessage('STAT_ENTITY_SITE_URL_FIELD')
                ]
            ),
            new DatetimeField(
                'date',
                [
                    'default' => function()
                    {
                        return new DateTime();
                    },
                    'title' => Loc::getMessage('STAT_ENTITY_DATE_FIELD')
                ]
            ),
            new StringField(
                'close_type',
                [
                    'title' => Loc::getMessage('STAT_ENTITY_CLOSE_TYPE_FIELD')
                ]
            ),
            new IntegerField(
                'show_time',
                [
                    'default' => 0,
                    'title' => Loc::getMessage('STAT_ENTITY_SHOW_TIME_FIELD')
                ]
            ),
            new StringField(
                'target_action',
                [
                    'default' => 'N',
                    'validation' => [__CLASS__, 'validateTargetAction'],
                    'title' => Loc::getMessage('STAT_ENTITY_TARGET_ACTION_FIELD')
                ]
            ),
            new StringField(
                'device',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateDevice'],
                    'title' => Loc::getMessage('STAT_ENTITY_DEVICE_FIELD')
                ]
            ),
            new StringField(
                'os',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateOs'],
                    'title' => Loc::getMessage('STAT_ENTITY_OS_FIELD')
                ]
            ),
            new StringField(
                'browser',
                [
                    'required' => true,
                    'validation' => [__CLASS__, 'validateBrowser'],
                    'title' => Loc::getMessage('STAT_ENTITY_BROWSER_FIELD')
                ]
            ),
            new StringField(
                'ip',
                [
                    'default' => '0.0.0.0',
                    'validation' => [__CLASS__, 'validateIp'],
                    'title' => Loc::getMessage('STAT_ENTITY_IP_FIELD')
                ]
            ),
            new TextField(
                'params',
                [
                    'title' => Loc::getMessage('STAT_ENTITY_PARAMS_FIELD')
                ]
            ),
            new IntegerField(
                'abtest_id',
                [
                    'title' => Loc::getMessage('STAT_ENTITY_ABTEST_ID_FIELD')
                ]
            ),
        ];
    }

    public static function deleteGroupById($ids = [])
    {
        if(!empty($ids))
        {
            global $DB;
            $res = $DB->query("DELETE FROM " . self::getTableName() . " WHERE id in (" . implode(",", $ids) . ")");
            return $res->result;
        }
        return false;
    }

    /**
     * Returns validators for url field.
     *
     * @return array
     */
    public static function validateUrl()
    {
        return [
            new LengthValidator(null, 200),
        ];
    }

    /**
     * Returns validators for site_url field.
     *
     * @return array
     */
    public static function validateSiteUrl()
    {
        return [
            new LengthValidator(null, 200),
        ];
    }

    /**
     * Returns validators for target_action field.
     *
     * @return array
     */
    public static function validateTargetAction()
    {
        return [
            new LengthValidator(null, 10),
        ];
    }

    /**
     * Returns validators for device field.
     *
     * @return array
     */
    public static function validateDevice()
    {
        return [
            new LengthValidator(null, 20),
        ];
    }

    /**
     * Returns validators for os field.
     *
     * @return array
     */
    public static function validateOs()
    {
        return [
            new LengthValidator(null, 20),
        ];
    }

    /**
     * Returns validators for browser field.
     *
     * @return array
     */
    public static function validateBrowser()
    {
        return [
            new LengthValidator(null, 20),
        ];
    }

    /**
     * Returns validators for ip field.
     *
     * @return array
     */
    public static function validateIp()
    {
        return [
            new LengthValidator(null, 16),
        ];
    }


}

Youez - 2016 - github.com/yon3zu
LinuXploit