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

172 lines 6.7 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 use AcyMailing\Helpers\CronHelper;
6
7 trait Configuration
8 {
9 public function addPref(): bool
10 {
11 $this->level = ucfirst($this->level);
12
13 $allPref = acym_getDefaultConfigValues();
14
15 $allPref['level'] = $this->level;
16 $allPref['version'] = $this->version;
17
18 $allPref['from_name'] = acym_getCMSConfig('fromname');
19 $allPref['from_email'] = acym_getCMSConfig('mailfrom');
20 $allPref['bounce_email'] = acym_getCMSConfig('mailfrom');
21 $cmsMailer = acym_getCMSConfig('mailer', 'phpmail');
22 $allPref['mailer_method'] = $cmsMailer === 'mail' ? 'phpmail' : $cmsMailer;
23 $allPref['sendmail_path'] = acym_getCMSConfig('sendmail');
24 $allPref['smtp_port'] = acym_getCMSConfig('smtpport');
25 $allPref['smtp_secured'] = acym_getCMSConfig('smtpsecure');
26 $allPref['smtp_auth'] = acym_getCMSConfig('smtpauth');
27 $allPref['smtp_username'] = acym_getCMSConfig('smtpuser');
28 $allPref['smtp_password'] = acym_getCMSConfig('smtppass');
29
30 $allPref['replyto_name'] = $allPref['from_name'];
31 $allPref['replyto_email'] = $allPref['from_email'];
32 $allPref['cron_sendto'] = $allPref['from_email'];
33
34 $allPref['add_names'] = '1';
35 $allPref['encoding_format'] = '8bit';
36 $allPref['charset'] = 'UTF-8';
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 [
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'] = '30';
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['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'] = CronHelper::SEND_REPORT_ONLY_ON_ERROR;
86 $allPref['cron_savereport'] = CronHelper::SEND_REPORT_ONLY_ON_ACTION;
87 $allPref['direct_queue_statistics'] = 0;
88 $allPref['uploadfolder'] = str_replace('\\', '/', ACYM_UPLOAD_FOLDER);
89 $allPref['last_import'] = '';
90 $allPref['security_key'] = acym_generateKey(30);
91 $allPref['export_excelsecurity'] = 1;
92 $allPref['gdpr_export'] = 0;
93 $allPref['gdpr_delete'] = 0;
94 $allPref['trackingsystem'] = 'acymailing';
95 $allPref['trackingsystemexternalwebsite'] = 1;
96 $allPref['generate_name'] = 1;
97 $allPref['allow_modif'] = 'data';
98 $allPref['from_as_replyto'] = '1';
99 $allPref['bounceVersion'] = self::BOUNCE_VERSION;
100 $allPref['numberThumbnail'] = 2;
101 $allPref['daily_hour'] = '12';
102 $allPref['daily_minute'] = '00';
103 $allPref['regacy'] = 1;
104 $allPref['regacy_delete'] = 1;
105 $allPref['regacy_forceconf'] = 0;
106 $allPref['remindme'] = '[]';
107 $allPref['notifications'] = '{}';
108 $allPref['unsubscribe_page'] = 1;
109 $allPref['delete_stats_enabled'] = 1;
110 $allPref['delete_stats'] = 86400 * 360;
111 $allPref['delete_archive_history_after'] = 86400 * 90;
112
113 $allPref['install_date'] = time();
114 $allPref['license_key'] = '';
115 $allPref['active_cron'] = 0;
116 $allPref['multilingual'] = 0;
117
118 $allPref['walk_through'] = '1';
119 $allPref['migration'] = '0';
120 $allPref['installcomplete'] = '0';
121
122 $allPref['Starter'] = ACYM_STARTER;
123 $allPref['Essential'] = ACYM_ESSENTIAL;
124 $allPref['Enterprise'] = ACYM_ENTERPRISE;
125 $allPref['previous_version'] = '10.11.1';
126
127 $allPref['display_built_by'] = acym_level(ACYM_ESSENTIAL) ? 0 : 1;
128 $allPref['php_overrides'] = 0;
129
130 $query = 'INSERT IGNORE INTO `#__acym_configuration` (`name`,`value`) VALUES ';
131 foreach ($allPref as $namekey => $value) {
132 $query .= '('.acym_escapeDB($namekey).','.acym_escapeDB($value).'),';
133 }
134 $query = rtrim($query, ',');
135
136 return $this->updateQuery($query, 'display');
137 }
138
139 public function updatePref(): bool
140 {
141 try {
142 $results = acym_loadObjectList('SELECT `name`, `value` FROM `#__acym_configuration` WHERE `name` IN ("version", "level") LIMIT 2', 'name');
143 } catch (\Exception $e) {
144 $results = null;
145 }
146
147 if ($results === null) {
148 acym_display(isset($e) ? $e->getMessage() : substr(strip_tags(acym_getDBError()), 0, 200).'...', 'error');
149
150 return false;
151 }
152
153 if (!empty($results['version'])) {
154 $this->firstInstallation = false;
155 }
156
157 if ($results['version']->value === $this->version && $results['level']->value === $this->level) {
158 return true;
159 }
160
161 $this->isUpdating = true;
162 $this->previousVersion = $results['version']->value;
163
164 $query = 'REPLACE INTO `#__acym_configuration` (`name`,`value`) VALUES ("level",'.acym_escapeDB($this->level).')';
165 $query .= ',("version",'.acym_escapeDB($this->version).')';
166 $query .= ',("installcomplete","0")';
167 $query .= ',("previous_version",'.acym_escapeDB($this->previousVersion).')';
168
169 return $this->updateQuery($query);
170 }
171 }
172