PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.1.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.1.4
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.1.4, at back/Helpers/Update/Configuration.php

186 lines 7.4 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 $allPref['smtp_type'] = 'oauth';
45 if (isset($smtpinfos[1])) {
46 $allPref['smtp_port'] = $smtpinfos[1];
47 }
48 if (!in_array($allPref['smtp_secured'], ['tls', 'ssl'])) {
49 $allPref['smtp_secured'] = '';
50 }
51
52 $allPref['social_icons'] = json_encode([
53 'facebook' => ACYM_IMAGES.'logo/facebook.png',
54 'twitter' => ACYM_IMAGES.'logo/twitter.png',
55 'x' => ACYM_IMAGES.'logo/x.png',
56 'instagram' => ACYM_IMAGES.'logo/instagram.png',
57 'linkedin' => ACYM_IMAGES.'logo/linkedin.png',
58 'pinterest' => ACYM_IMAGES.'logo/pinterest.png',
59 'vimeo' => ACYM_IMAGES.'logo/vimeo.png',
60 'wordpress' => ACYM_IMAGES.'logo/wordpress.png',
61 'youtube' => ACYM_IMAGES.'logo/youtube.png',
62 'telegram' => ACYM_IMAGES.'logo/telegram.png',
63 ]
64 );
65
66 $allPref['queue_nbmail'] = '40';
67 $allPref['queue_nbmail_auto'] = '70';
68 $allPref['queue_type'] = 'auto';
69 $allPref['queue_try'] = '3';
70 $allPref['queue_pause'] = '120';
71 $allPref['allow_visitor'] = '1';
72 $allPref['require_confirmation'] = '1';
73 $allPref['priority_newsletter'] = '3';
74 $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';
75 $allPref['confirm_redirect'] = '';
76 $allPref['subscription_message'] = '1';
77 $allPref['notification_unsuball'] = '';
78 $allPref['cron_next'] = '1251990901';
79 $allPref['confirmation_message'] = '1';
80 $allPref['welcome_message'] = '1';
81 $allPref['unsub_message'] = '1';
82 $allPref['cron_last'] = '0';
83 $allPref['cron_fromip'] = '';
84 $allPref['cron_report'] = '';
85 $allPref['cron_frequency'] = '900';
86 $allPref['cron_sendreport'] = '2';
87 $allPref['cron_fullreport'] = '1';
88 $allPref['cron_savereport'] = '2';
89 $allPref['uploadfolder'] = str_replace('\\', '/', ACYM_UPLOAD_FOLDER);
90 $allPref['notification_created'] = '';
91 $allPref['notification_accept'] = '';
92 $allPref['notification_refuse'] = '';
93 $allPref['forward'] = '0';
94 $allPref['priority_followup'] = '2';
95 $allPref['unsub_redirect'] = '';
96 $allPref['use_sef'] = '0';
97 $allPref['css_frontend'] = '';
98 $allPref['css_backend'] = '';
99 $allPref['last_import'] = '';
100 $allPref['unsub_reasons'] = serialize(['UNSUB_SURVEY_FREQUENT', 'UNSUB_SURVEY_RELEVANT']);
101 $allPref['security_key'] = acym_generateKey(30);
102 $allPref['export_excelsecurity'] = 1;
103 $allPref['gdpr_export'] = 0;
104 $allPref['gdpr_delete'] = 0;
105 $allPref['anonymous_tracking'] = '0';
106 $allPref['anonymizeold'] = '0';
107 $allPref['trackingsystem'] = 'acymailing';
108 $allPref['trackingsystemexternalwebsite'] = 1;
109 $allPref['generate_name'] = 1;
110 $allPref['allow_modif'] = 'data';
111 $allPref['from_as_replyto'] = '1';
112 $allPref['templates_installed'] = '0';
113 $allPref['bounceVersion'] = self::BOUNCE_VERSION;
114 $allPref['numberThumbnail'] = 2;
115 $allPref['daily_hour'] = '12';
116 $allPref['daily_minute'] = '00';
117 $allPref['regacy'] = 1;
118 $allPref['regacy_delete'] = 1;
119 $allPref['regacy_forceconf'] = 0;
120 $allPref['remindme'] = '[]';
121 $allPref['notifications'] = '{}';
122 $allPref['unsubscribe_page'] = 1;
123 $allPref['delete_stats_enabled'] = 1;
124 $allPref['delete_stats'] = 86400 * 360;
125 $allPref['delete_archive_history_after'] = 86400 * 90;
126
127 $allPref['install_date'] = time();
128 $allPref['license_key'] = '';
129 $allPref['active_cron'] = 0;
130 $allPref['multilingual'] = 0;
131
132 $allPref['walk_through'] = '1';
133 $allPref['migration'] = '0';
134 $allPref['installcomplete'] = '0';
135
136 $allPref['Starter'] = ACYM_STARTER;
137 $allPref['Essential'] = ACYM_ESSENTIAL;
138 $allPref['Enterprise'] = ACYM_ENTERPRISE;
139 $allPref['previous_version'] = '10.1.4';
140
141 $allPref['display_built_by'] = acym_level(ACYM_ESSENTIAL) ? 0 : 1;
142 $allPref['php_overrides'] = 0;
143
144 $query = 'INSERT IGNORE INTO `#__acym_configuration` (`name`,`value`) VALUES ';
145 foreach ($allPref as $namekey => $value) {
146 $query .= '('.acym_escapeDB($namekey).','.acym_escapeDB($value).'),';
147 }
148 $query = rtrim($query, ',');
149
150 return $this->updateQuery($query, 'display');
151 }
152
153 public function updatePref(): bool
154 {
155 try {
156 $results = acym_loadObjectList('SELECT `name`, `value` FROM `#__acym_configuration` WHERE `name` IN ("version", "level") LIMIT 2', 'name');
157 } catch (\Exception $e) {
158 $results = null;
159 }
160
161 if ($results === null) {
162 acym_display(isset($e) ? $e->getMessage() : substr(strip_tags(acym_getDBError()), 0, 200).'...', 'error');
163
164 return false;
165 }
166
167 if (!empty($results['version'])) {
168 $this->firstInstallation = false;
169 }
170
171 if ($results['version']->value === $this->version && $results['level']->value === $this->level) {
172 return true;
173 }
174
175 $this->isUpdating = true;
176 $this->previousVersion = $results['version']->value;
177
178 $query = 'REPLACE INTO `#__acym_configuration` (`name`,`value`) VALUES ("level",'.acym_escapeDB($this->level).')';
179 $query .= ',("version",'.acym_escapeDB($this->version).')';
180 $query .= ',("installcomplete","0")';
181 $query .= ',("previous_version",'.acym_escapeDB($this->previousVersion).')';
182
183 return $this->updateQuery($query);
184 }
185 }
186