-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathHitCounter.php
137 lines (129 loc) · 4.08 KB
/
HitCounter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
namespace coderius\hitCounter\entities;
use Yii;
use coderius\hitCounter\Module;
/**
* This is the model class for table "hit_counter".
*
* @property int $id
* @property string $counter_id Counter id generated in widget and passed by query param in inage src
* @property string $cookie_mark
* @property int $js_cookei_enabled
* @property int $js_java_enabled
* @property int $js_timezone_offset
* @property string $js_timezone
* @property string $js_connection
* @property string $js_current_url
* @property string $js_referer_url
* @property int $js_screen_width
* @property int $js_screen_height
* @property int $js_color_depth
* @property string $js_browser_language
* @property int $js_history_length
* @property int $js_is_toutch_device
* @property int $js_processor_ram
* @property string $serv_ip User ip
* @property string $serv_user_agent
* @property string $serv_referer_url
* @property string $serv_server_name
* @property int $serv_auth_user_id User id if exists
* @property string $serv_port
* @property string $serv_cookies
* @property string $serv_os
* @property string $serv_client
* @property string $serv_device
* @property string $serv_brand
* @property string $serv_model
* @property string $serv_bot
* @property string $serv_host_by_ip
* @property int $serv_is_proxy_or_vpn
* @property string $created_at
*
* @property User $servAuthUser
*/
class HitCounter extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%hit_counter}}';
}
public static function create(
$counter_id,
$cookie_mark,
$js_cookei_enabled,
$js_java_enabled,
$js_timezone_offset,
$js_timezone,
$js_connection,
$js_current_url,
$js_referer_url,
$js_screen_width,
$js_screen_height,
$js_color_depth,
$js_browser_language,
$js_history_length,
$js_is_toutch_device,
$js_processor_ram,
$serv_ip,
$serv_user_agent,
$serv_referer_url,
$serv_server_name,
$serv_auth_user_id,
$serv_port,
$serv_cookies,
$serv_os,
$serv_client,
$serv_device,
$serv_brand,
$serv_model,
$serv_bot,
$serv_host_by_ip,
$serv_is_proxy_or_vpn
)
{
$hit = new static();
$hit->counter_id = $counter_id;
$hit->cookie_mark = $cookie_mark;
$hit->js_cookei_enabled = $js_cookei_enabled;
$hit->js_java_enabled = $js_java_enabled;
$hit->js_timezone_offset = $js_timezone_offset;
$hit->js_timezone = $js_timezone;
$hit->js_connection = $js_connection;
$hit->js_current_url = $js_current_url;
$hit->js_referer_url = $js_referer_url;
$hit->js_screen_width = $js_screen_width;
$hit->js_screen_height = $js_screen_height;
$hit->js_color_depth = $js_color_depth;
$hit->js_browser_language = $js_browser_language;
$hit->js_history_length = $js_history_length;
$hit->js_is_toutch_device = $js_is_toutch_device;
$hit->js_processor_ram = $js_processor_ram;
$hit->serv_ip = $serv_ip;
$hit->serv_user_agent = $serv_user_agent;
$hit->serv_referer_url = $serv_referer_url;
$hit->serv_server_name = $serv_server_name;
$hit->serv_auth_user_id = $serv_auth_user_id;
$hit->serv_port = $serv_port;
$hit->serv_cookies = $serv_cookies;
$hit->serv_os = $serv_os;
$hit->serv_client = $serv_client;
$hit->serv_device = $serv_device;
$hit->serv_brand = $serv_brand;
$hit->serv_model = $serv_model;
$hit->serv_bot = $serv_bot;
$hit->serv_host_by_ip = $serv_host_by_ip;
$hit->serv_is_proxy_or_vpn = $serv_is_proxy_or_vpn;
$hit->created_at = gmdate("Y-m-d H:i:s");
return $hit;
}
/**
* @return \yii\db\ActiveQuery
*/
public function getServAuthUser()
{
return $this->hasOne(Module::getInstance()->userIdentityClass, ['id' => 'serv_auth_user_id']);
}
}