PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.2.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.2.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Helpers / Update / Configuration.php

Configuration.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.2.2, at back/Helpers/Update/Configuration.php

185 lines 7.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Helpers\Update;
4
5 trait Configuration
6 {
7 public function addPref(): bool
8 {
9 $this->level = ucfirst($this->level);
10
11 $allPref = acym_getDefaultConfigValues();
12
13 $allPref['level'] = $this->level;
14 $allPref['version'] = $this->version;
15
16 $allPref['from_name'] = acym_getCMSConfig('fromname');
17 $allPref['from_email'] = acym_getCMSConfig('mailfrom');
18 $allPref['bounce_email'] = acym_getCMSConfig('mailfrom');
19 $cmsMailer = acym_getCMSConfig('mailer', 'phpmail');
20 $allPref['mailer_method'] = $cmsMailer === 'mail' ? 'phpmail' : $cmsMailer;
21 $allPref['sendmail_path'] = acym_getCMSConfig('sendmail');
22 $allPref['smtp_port'] = acym_getCMSConfig('smtpport');
23 $allPref['smtp_secured'] = acym_getCMSConfig('smtpsecure');
24 $allPref['smtp_auth'] = acym_getCMSConfig('smtpauth');
25 $allPref['smtp_username'] = acym_getCMSConfig('smtpuser');
26 $allPref['smtp_password'] = acym_getCMSConfig('smtppass');
27
28 $allPref['replyto_name'] = $allPref['from_name'];
29 $allPref['replyto_email'] = $allPref['from_email'];
30 $allPref['cron_sendto'] = $allPref['from_email'];
31
32 $allPref['add_names'] = '1';
33 $allPref['encoding_format'] = '8bit';
34 $allPref['charset'] = 'UTF-8';
35 $allPref['word_wrapping'] = '150';
36 $allPref['hostname'] = '';
37 $allPref['embed_images'] = '0';
38 $allPref['embed_files'] = '0';
39 $allPref['editor'] = 'codemirror';
40 $allPref['multiple_part'] = '1';
41
42 $smtpinfos = explode(':', acym_getCMSConfig('smtphost', ''));
43 $allPref['smtp_host'] = $smtpinfos[0];
44 if (isset($smtpinfos[1])) {
45 $allPref['smtp_port'] = $smtpinfos[1];
46 }
47 if (!in_array($allPref['smtp_secured'], ['tls', 'ssl'])) {
48 $allPref['smtp_secured'] = '';
49 }
50
51 $allPref['social_icons'] = json_encode([
52 'facebook' => ACYM_IMAGES.'logo/facebook.png',
53 'twitter' => ACYM_IMAGES.'logo/twitter.png',
54 'x' => ACYM_IMAGES.'logo/x.png',
55 'instagram' => ACYM_IMAGES.'logo/instagram.png',
56 'linkedin' => ACYM_IMAGES.'logo/linkedin.png',
57 'pinterest' => ACYM_IMAGES.'logo/pinterest.png',
58 'vimeo' => ACYM_IMAGES.'logo/vimeo.png',
59 'wordpress' => ACYM_IMAGES.'logo/wordpress.png',
60 'youtube' => ACYM_IMAGES.'logo/youtube.png',
61 'telegram' => ACYM_IMAGES.'logo/telegram.png',
62 ]
63 );
64
65 $allPref['queue_nbmail'] = '40';
66 $allPref['queue_nbmail_auto'] = '70';
67 $allPref['queue_type'] = 'auto';
68 $allPref['queue_try'] = '3';
69 $allPref['queue_pause'] = '120';
70 $allPref['allow_visitor'] = '1';
71 $allPref['require_confirmation'] = '1';
72 $allPref['priority_newsletter'] = '3';
73 $allPref['allowed_files'] = 'zip,doc,docx,pdf,xls,txt,gzip,rar,jpg,jpeg,gif,xlsx,pps,csv,bmp,ico,odg,odp,ods,odt,png,ppt,swf,xcf,mp3,wma';
74 $allPref['confirm_redirect'] = '';
75 $allPref['subscription_message'] = '1';
76 $allPref['notification_unsuball'] = '';
77 $allPref['cron_next'] = '1251990901';
78 $allPref['confirmation_message'] = '1';
79 $allPref['welcome_message'] = '1';
80 $allPref['unsub_message'] = '1';
81 $allPref['cron_last'] = '0';
82 $allPref['cron_fromip'] = '';
83 $allPref['cron_report'] = '';
84 $allPref['cron_frequency'] = '900';
85 $allPref['cron_sendreport'] = '2';
86 $allPref['cron_fullreport'] = '1';
87 $allPref['cron_savereport'] = '2';
88 $allPref['uploadfolder'] = str_replace('\\', '/', ACYM_UPLOAD_FOLDER);
89 $allPref['notification_created'] = '';
90 $allPref['notification_accept'] = '';
91 $allPref['notification_refuse'] = '';
92 $allPref['forward'] = '0';
93 $allPref['priority_followup'] = '2';
94 $allPref['unsub_redirect'] = '';
95 $allPref['use_sef'] = '0';
96 $allPref['css_frontend'] = '';
97 $allPref['css_backend'] = '';
98 $allPref['last_import'] = '';
99 $allPref['unsub_reasons'] = serialize(['UNSUB_SURVEY_FREQUENT', 'UNSUB_SURVEY_RELEVANT']);
100 $allPref['security_key'] = acym_generateKey(30);
101 $allPref['export_excelsecurity'] = 1;
102 $allPref['gdpr_export'] = 0;
103 $allPref['gdpr_delete'] = 0;
104 $allPref['anonymous_tracking'] = '0';
105 $allPref['anonymizeold'] = '0';
106 $allPref['trackingsystem'] = 'acymailing';
107 $allPref['trackingsystemexternalwebsite'] = 1;
108 $allPref['generate_name'] = 1;
109 $allPref['allow_modif'] = 'data';
110 $allPref['from_as_replyto'] = '1';
111 $allPref['templates_installed'] = '0';
112 $allPref['bounceVersion'] = self::BOUNCE_VERSION;
113 $allPref['numberThumbnail'] = 2;
114 $allPref['daily_hour'] = '12';
115 $allPref['daily_minute'] = '00';
116 $allPref['regacy'] = 1;
117 $allPref['regacy_delete'] = 1;
118 $allPref['regacy_forceconf'] = 0;
119 $allPref['remindme'] = '[]';
120 $allPref['notifications'] = '{}';
121 $allPref['unsubscribe_page'] = 1;
122 $allPref['delete_stats_enabled'] = 1;
123 $allPref['delete_stats'] = 86400 * 360;
124 $allPref['delete_archive_history_after'] = 86400 * 90;
125
126 $allPref['install_date'] = time();
127 $allPref['license_key'] = '';
128 $allPref['active_cron'] = 0;
129 $allPref['multilingual'] = 0;
130
131 $allPref['walk_through'] = '1';
132 $allPref['migration'] = '0';
133 $allPref['installcomplete'] = '0';
134
135 $allPref['Starter'] = ACYM_STARTER;
136 $allPref['Essential'] = ACYM_ESSENTIAL;
137 $allPref['Enterprise'] = ACYM_ENTERPRISE;
138 $allPref['previous_version'] = '10.2.2';
139
140 $allPref['display_built_by'] = acym_level(ACYM_ESSENTIAL) ? 0 : 1;
141 $allPref['php_overrides'] = 0;
142
143 $query = 'INSERT IGNORE INTO `#__acym_configuration` (`name`,`value`) VALUES ';
144 foreach ($allPref as $namekey => $value) {
145 $query .= '('.acym_escapeDB($namekey).','.acym_escapeDB($value).'),';
146 }
147 $query = rtrim($query, ',');
148
149 return $this->updateQuery($query, 'display');
150 }
151
152 public function updatePref(): bool
153 {
154 try {
155 $results = acym_loadObjectList('SELECT `name`, `value` FROM `#__acym_configuration` WHERE `name` IN ("version", "level") LIMIT 2', 'name');
156 } catch (\Exception $e) {
157 $results = null;
158 }
159
160 if ($results === null) {
161 acym_display(isset($e) ? $e->getMessage() : substr(strip_tags(acym_getDBError()), 0, 200).'...', 'error');
162
163 return false;
164 }
165
166 if (!empty($results['version'])) {
167 $this->firstInstallation = false;
168 }
169
170 if ($results['version']->value === $this->version && $results['level']->value === $this->level) {
171 return true;
172 }
173
174 $this->isUpdating = true;
175 $this->previousVersion = $results['version']->value;
176
177 $query = 'REPLACE INTO `#__acym_configuration` (`name`,`value`) VALUES ("level",'.acym_escapeDB($this->level).')';
178 $query .= ',("version",'.acym_escapeDB($this->version).')';
179 $query .= ',("installcomplete","0")';
180 $query .= ',("previous_version",'.acym_escapeDB($this->previousVersion).')';
181
182 return $this->updateQuery($query);
183 }
184 }
185