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 / global / file.php

file.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.1.4, at back/Helpers/global/file.php

736 lines 21.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use AcyMailing\Helpers\ImageHelper;
4
5 function acym_bytes($val)
6 {
7 $val = trim($val);
8 if (empty($val)) {
9 return 0;
10 }
11 $last = strtolower($val[strlen($val) - 1]);
12 switch ($last) {
13 case 'g':
14 $val = intval($val) * 1073741824;
15 break;
16 case 'm':
17 $val = intval($val) * 1048576;
18 break;
19 case 'k':
20 $val = intval($val) * 1024;
21 break;
22 }
23
24 return (int)$val;
25 }
26
27 function acym_createDir($dir, $report = true, $secured = false)
28 {
29 if (is_dir($dir)) return true;
30
31 $indexhtml = '<html><body bgcolor="#FFFFFF"></body></html>';
32
33 try {
34 $status = acym_createFolder($dir);
35 } catch (Exception $e) {
36 $status = false;
37 }
38
39 if (!$status) {
40 if ($report) {
41 acym_display('Could not create the directory '.$dir, 'error');
42 }
43
44 return false;
45 }
46
47 try {
48 $status = acym_writeFile($dir.DS.'index.html', $indexhtml);
49 } catch (Exception $e) {
50 $status = false;
51 }
52
53 if (!$status) {
54 if ($report) {
55 acym_display('Could not create the file '.$dir.DS.'index.html', 'error');
56 }
57 }
58
59 if ($secured) {
60 try {
61 $htaccess = 'Order deny,allow'."\r\n".'Deny from all';
62 $status = acym_writeFile($dir.DS.'.htaccess', $htaccess);
63 } catch (Exception $e) {
64 $status = false;
65 }
66
67 if (!$status) {
68 if ($report) {
69 acym_display('Could not create the file '.$dir.DS.'.htaccess', 'error');
70 }
71 }
72 }
73
74 return $status;
75 }
76
77 function acym_importFile($file, $uploadPath, $onlyPict, $maxwidth = '')
78 {
79 acym_checkToken();
80
81 $config = acym_config();
82 $additionalMsg = '';
83
84 if ($file['error'] > 0) {
85 $file['error'] = intval($file['error']);
86 if ($file['error'] > 8) {
87 $file['error'] = 0;
88 }
89
90 $phpFileUploadErrors = [
91 0 => 'Unknown error',
92 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
93 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
94 3 => 'The uploaded file was only partially uploaded',
95 4 => 'No file was uploaded',
96 6 => 'Missing a temporary folder',
97 7 => 'Failed to write file to disk',
98 8 => 'A PHP extension stopped the file upload',
99 ];
100
101 acym_enqueueMessage(acym_translationSprintf('ACYM_ERROR_UPLOADING_FILE_X', $phpFileUploadErrors[$file['error']]), 'error');
102
103 return false;
104 }
105
106 acym_createDir($uploadPath, true);
107
108 if (!is_writable($uploadPath)) {
109 @chmod($uploadPath, '0755');
110 if (!is_writable($uploadPath)) {
111 acym_display(acym_translationSprintf('ACYM_WRITABLE_FOLDER', $uploadPath), 'error');
112
113 return false;
114 }
115 }
116
117 if ($onlyPict) {
118 $allowedExtensions = ['png', 'jpeg', 'jpg', 'gif', 'ico', 'bmp'];
119 } else {
120 $allowedExtensions = explode(',', $config->get('allowed_files'));
121 }
122
123 if (!preg_match('#\.('.implode('|', $allowedExtensions).')$#Ui', $file['name'], $extension)) {
124 $ext = substr($file['name'], strrpos($file['name'], '.') + 1);
125 acym_display(
126 acym_translationSprintf(
127 'ACYM_ACCEPTED_TYPE',
128 acym_escape($ext),
129 implode(', ', $allowedExtensions)
130 ),
131 'error'
132 );
133
134 return false;
135 }
136
137 if (preg_match('#\.(php.?|.?htm.?|pl|py|jsp|asp|sh|cgi)#Ui', $file['name'])) {
138 acym_display(
139 'This extension name is blocked by the system regardless your configuration for security reasons',
140 'error'
141 );
142
143 return false;
144 }
145
146 $file['name'] = str_replace(
147 ['-', '.', ' ', '\''],
148 '_',
149 substr($file['name'], 0, strrpos($file['name'], '.'))
150 ).'.'.$extension[1];
151
152 if ($onlyPict) {
153 $imageSize = @getimagesize($file['tmp_name']);
154 if (empty($imageSize)) {
155 acym_display(acym_translation('ACYM_INVALID_IMAGE'), 'error');
156
157 return false;
158 }
159 }
160
161 if (file_exists($uploadPath.DS.$file['name'])) {
162 $i = 1;
163 $nameFile = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file['name']);
164 $ext = substr($file['name'], strrpos($file['name'], '.') + 1);
165 while (file_exists($uploadPath.DS.$nameFile.'_'.$i.'.'.$ext)) {
166 $i++;
167 }
168
169 $file['name'] = $nameFile.'_'.$i.'.'.$ext;
170 $additionalMsg = '<br />'.acym_translationSprintf('ACYM_FILE_RENAMED', $file['name']);
171 if ($onlyPict) {
172 $additionalMsg .= '<br /><a style="color: blue; cursor: pointer;" onclick="confirmBox(\'rename\', \''.$file['name'].'\', \''.$nameFile.'.'.$ext.'\')">'.acym_translation(
173 'ACYM_RENAME_OR_REPLACE'
174 ).'</a>';
175 }
176 }
177
178 if (!acym_uploadFile($file['tmp_name'], rtrim($uploadPath, DS).DS.$file['name'])) {
179 if (!move_uploaded_file($file['tmp_name'], rtrim($uploadPath, DS).DS.$file['name'])) {
180 acym_display(
181 acym_translationSprintf(
182 'ACYM_FAIL_UPLOAD',
183 '<b><i>'.acym_escape($file['tmp_name']).'</i></b>',
184 '<b><i>'.acym_escape(rtrim($uploadPath, DS).DS.$file['name']).'</i></b>'
185 ),
186 'error'
187 );
188
189 return false;
190 }
191 }
192
193 if (!empty($maxwidth) || ($onlyPict && $imageSize[0] > 1000)) {
194 $imageHelper = new ImageHelper();
195 if ($imageHelper->available()) {
196 $imageHelper->maxHeight = 9999;
197 if (empty($maxwidth)) {
198 $imageHelper->maxWidth = 700;
199 } else {
200 $imageHelper->maxWidth = $maxwidth;
201 }
202 $message = 'ACYM_IMAGE_RESIZED';
203 $imageHelper->destination = $uploadPath;
204 $thumb = $imageHelper->generateThumbnail(rtrim($uploadPath, DS).DS.$file['name']);
205 if (!empty($thumb)) {
206 acym_moveFile($thumb['file'], $uploadPath.DS.$file['name']);
207 $additionalMsg .= '<br />'.acym_translation($message);
208 }
209 }
210 }
211 acym_enqueueMessage(acym_translation('ACYM_SUCCESS_FILE_UPLOAD').$additionalMsg, 'success');
212
213 return $file['name'];
214 }
215
216 function acym_inputFile($name, $value = '', $id = '', $class = '', $attributes = '')
217 {
218 $return = '<div class="cell '.$class.' grid-x"><input '.$attributes.' style="display: none" id="'.$id.'" type="file" name="'.$name.'"><button type="button" class=" acym__button__file button button-secondary cell shrink">'.acym_translation(
219 'ACYM_CHOOSE_FILE'
220 ).'</button><span class="cell shrink margin-left-2">';
221 $return .= empty($value) ? acym_translation('ACYM_NO_FILE_CHOSEN') : $value;
222 $return .= '</span></div>';
223
224 return $return;
225 }
226
227 function acym_getFilesFolder($ignoreVariables = false)
228 {
229 $config = acym_config();
230 $uploadFolder = $config->get('uploadfolder', ACYM_UPLOAD_FOLDER);
231 if ($ignoreVariables) $uploadFolder = str_replace(['{userid}', '{groupname}'], '', $uploadFolder);
232 $uploadFolder = trim($uploadFolder, '/');
233
234 if (strpos($uploadFolder, '{userid}') !== false) {
235 $uploadFolder = str_replace('{userid}', acym_currentUserId(), $uploadFolder);
236 }
237
238 return acym_replaceGroupTags($uploadFolder);
239 }
240
241 function acym_generateArborescence($folders)
242 {
243 $folderList = [];
244 foreach ($folders as $folder) {
245 $folderPath = acym_cleanPath(ACYM_ROOT.trim(str_replace('/', DS, trim($folder)), DS));
246 if (!file_exists($folderPath)) {
247 acym_createDir($folderPath);
248 }
249 $subFolders = acym_listFolderTree($folderPath, '', 15);
250 $folderList[$folder] = [];
251 foreach ($subFolders as $oneFolder) {
252 $subFolder = str_replace(ACYM_ROOT, '', $oneFolder['relname']);
253 $subFolder = str_replace(DS, '/', $subFolder);
254 $folderList[$folder][$subFolder] = ltrim($subFolder, '/');
255 }
256 $folderList[$folder] = array_unique($folderList[$folder]);
257 }
258
259 return $folderList;
260 }
261
262 function acym_makeSafeFile($file)
263 {
264 $file = rtrim($file, '.');
265 $regex = ['#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#', '#^\.#'];
266
267 return trim(preg_replace($regex, '', $file));
268 }
269
270 function acym_deleteFolder($path, $report = true)
271 {
272 $path = acym_cleanPath($path);
273 if (!is_dir($path)) {
274 if ($report) acym_enqueueMessage(acym_translationSprintf('ACYM_IS_NOT_A_FOLDER', $path), 'error');
275
276 return false;
277 }
278
279 $files = acym_getFiles($path, '.', false, false, [], []);
280 if (!empty($files)) {
281 foreach ($files as $oneFile) {
282 if (!acym_deleteFile($path.DS.$oneFile, $report)) {
283 return false;
284 }
285 }
286 }
287
288 $folders = acym_getFolders($path, '.', false, false, []);
289 if (!empty($folders)) {
290 foreach ($folders as $oneFolder) {
291 if (!acym_deleteFolder($path.DS.$oneFolder, $report)) {
292 return false;
293 }
294 }
295 }
296
297 if (@rmdir($path)) {
298 $ret = true;
299 } else {
300 if ($report) acym_enqueueMessage(acym_translationSprintf('ACYM_COULD_NOT_DELETE_FOLDER', $path), 'error');
301 $ret = false;
302 }
303
304 return $ret;
305 }
306
307 function acym_createFolder($path = '', $mode = 0755)
308 {
309 $path = acym_cleanPath($path);
310 if (file_exists($path)) {
311 return true;
312 }
313
314 $origmask = @umask(0);
315 $ret = @mkdir($path, $mode, true);
316 @umask($origmask);
317
318 return $ret;
319 }
320
321 function acym_getFolders($path, $filter = '.', $recurse = false, $full = false, $exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], $excludefilter = ['^\..*'])
322 {
323 $path = acym_cleanPath($path);
324
325 if (!is_dir($path)) {
326 acym_enqueueMessage(acym_translationSprintf('ACYM_IS_NOT_A_FOLDER', $path), 'error');
327
328 return [];
329 }
330
331 if (count($excludefilter)) {
332 $excludefilter_string = '/('.implode('|', $excludefilter).')/';
333 } else {
334 $excludefilter_string = '';
335 }
336
337 $arr = acym_getItems($path, $filter, $recurse, $full, $exclude, $excludefilter_string, false);
338 asort($arr);
339
340 return array_values($arr);
341 }
342
343 function acym_getFiles(
344 $path,
345 $filter = '.',
346 $recurse = false,
347 $full = false,
348 $exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'],
349 $excludefilter = [
350 '^\..*',
351 '.*~',
352 ],
353 $naturalSort = false
354 ) {
355 $path = acym_cleanPath($path);
356
357 if (!is_dir($path)) {
358 acym_enqueueMessage(acym_translationSprintf('ACYM_IS_NOT_A_FOLDER', $path), 'error');
359
360 return false;
361 }
362
363 if (count($excludefilter)) {
364 $excludefilter_string = '/('.implode('|', $excludefilter).')/';
365 } else {
366 $excludefilter_string = '';
367 }
368
369 $arr = acym_getItems($path, $filter, $recurse, $full, $exclude, $excludefilter_string, true);
370
371 if ($naturalSort) {
372 natsort($arr);
373 } else {
374 asort($arr);
375 }
376
377 return array_values($arr);
378 }
379
380 function acym_getItems($path, $filter, $recurse, $full, $exclude, $excludefilter_string, $findfiles)
381 {
382 $arr = [];
383
384 if (!($handle = @opendir($path))) {
385 return $arr;
386 }
387
388 while (($file = readdir($handle)) !== false) {
389 if ($file == '.' || $file == '..' || in_array($file, $exclude) || (!empty($excludefilter_string) && preg_match(
390 $excludefilter_string,
391 $file
392 ))) {
393 continue;
394 }
395 $fullpath = rtrim($path, '/').'/'.$file;
396
397 $isDir = is_dir($fullpath);
398
399 if (($isDir xor $findfiles) && preg_match("/$filter/", $file)) {
400 if ($full) {
401 $arr[] = $fullpath;
402 } else {
403 $arr[] = $file;
404 }
405 }
406
407 if ($isDir && $recurse) {
408 if (is_int($recurse)) {
409 $arr = array_merge(
410 $arr,
411 acym_getItems(
412 $fullpath,
413 $filter,
414 $recurse - 1,
415 $full,
416 $exclude,
417 $excludefilter_string,
418 $findfiles
419 )
420 );
421 } else {
422 $arr = array_merge(
423 $arr,
424 acym_getItems(
425 $fullpath,
426 $filter,
427 $recurse,
428 $full,
429 $exclude,
430 $excludefilter_string,
431 $findfiles
432 )
433 );
434 }
435 }
436 }
437
438 closedir($handle);
439
440 return $arr;
441 }
442
443 function acym_copyFolder($src, $dest, $path = '', $force = false, $use_streams = false)
444 {
445
446 if ($path) {
447 $src = acym_cleanPath($path.'/'.$src);
448 $dest = acym_cleanPath($path.'/'.$dest);
449 }
450
451 $src = rtrim($src, DIRECTORY_SEPARATOR);
452 $dest = rtrim($dest, DIRECTORY_SEPARATOR);
453
454 if (!file_exists($src)) {
455 acym_enqueueMessage(acym_translationSprintf('ACYM_FOLDER_DOES_NOT_EXIST', $src), 'error');
456
457 return false;
458 }
459
460 if (file_exists($dest) && !$force) {
461 acym_enqueueMessage(acym_translationSprintf('ACYM_FOLDER_ALREADY_EXIST', $dest), 'error');
462
463 return true;
464 }
465
466 if (!acym_createFolder($dest)) {
467 acym_enqueueMessage(acym_translation('ACYM_CANNOT_CREATE_DESTINATION_FOLDER'), 'error');
468
469 return false;
470 }
471
472 if (!($dh = @opendir($src))) {
473 acym_enqueueMessage(acym_translation('ACYM_CANNOT_OPEN_SOURCE_FOLDER'), 'error');
474
475 return false;
476 }
477
478 while (($file = readdir($dh)) !== false) {
479 $sfid = $src.'/'.$file;
480 $dfid = $dest.'/'.$file;
481
482 switch (filetype($sfid)) {
483 case 'dir':
484 if ($file != '.' && $file != '..') {
485 $ret = acym_copyFolder($sfid, $dfid, null, $force, $use_streams);
486
487 if ($ret !== true) {
488 return $ret;
489 }
490 }
491 break;
492
493 case 'file':
494 if (!@copy($sfid, $dfid)) {
495 acym_enqueueMessage(acym_translationSprintf('ACYM_COPY_FILE_FAILED_PERMISSION', $sfid), 'error');
496
497 return false;
498 }
499 break;
500 }
501 }
502
503 return true;
504 }
505
506 function acym_listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0)
507 {
508 $dirs = [];
509
510 if ($level == 0) {
511 $GLOBALS['acym_folder_tree_index'] = 0;
512 }
513
514 if ($level < $maxLevel) {
515 $folders = acym_getFolders($path, $filter);
516
517 foreach ($folders as $name) {
518 $id = ++$GLOBALS['acym_folder_tree_index'];
519 $fullName = acym_cleanPath($path.'/'.$name);
520 $dirs[] = [
521 'id' => $id,
522 'parent' => $parent,
523 'name' => $name,
524 'fullname' => $fullName,
525 'relname' => str_replace(ACYM_ROOT, '', $fullName),
526 ];
527 $dirs2 = acym_listFolderTree($fullName, $filter, $maxLevel, $level + 1, $id);
528 $dirs = array_merge($dirs, $dirs2);
529 }
530 }
531
532 return $dirs;
533 }
534
535 function acym_deleteFile($file, $report = true)
536 {
537 $file = acym_cleanPath($file);
538 if (!is_file($file)) {
539 if ($report) acym_enqueueMessage(acym_translationSprintf('ACYM_IS_NOT_A_FILE', $file), 'error');
540
541 return false;
542 }
543
544 @chmod($file, 0777);
545
546 if (!@unlink($file)) {
547 $filename = basename($file);
548 if ($report) acym_enqueueMessage(acym_translationSprintf('ACYM_FAILED_DELETE', $filename), 'error');
549
550 return false;
551 }
552
553 return true;
554 }
555
556 function acym_writeFile($file, $buffer, $flags = 0)
557 {
558 if (!file_exists(dirname($file)) && acym_createFolder(dirname($file)) == false) {
559 return false;
560 }
561 $file = acym_cleanPath($file);
562
563 return is_int(file_put_contents($file, $buffer, $flags));
564 }
565
566 function acym_moveFile($src, $dest, $path = '', $use_streams = false)
567 {
568 if (!empty($path)) {
569 $src = acym_cleanPath($path.'/'.$src);
570 $dest = acym_cleanPath($path.'/'.$dest);
571 }
572
573 if (!is_readable($src)) {
574 acym_enqueueMessage(acym_translationSprintf('ACYM_COULD_NOT_FIND_FILE_SOURCE_PERMISSION', $src), 'error');
575
576 return false;
577 }
578
579 if (!@rename($src, $dest)) {
580 acym_enqueueMessage(acym_translation('ACYM_COULD_NOT_MOVE_FILE'), 'error');
581
582 return false;
583 }
584
585 return true;
586 }
587
588 function acym_uploadFile($src, $dest)
589 {
590 $dest = acym_cleanPath($dest);
591
592 $baseDir = dirname($dest);
593 if (!file_exists($baseDir)) {
594 acym_createFolder($baseDir);
595 }
596
597 if (is_writeable($baseDir) && move_uploaded_file($src, $dest)) {
598 if (@chmod($dest, octdec('0644'))) {
599 return true;
600 } else {
601 acym_enqueueMessage(acym_translation('ACYM_FILE_REJECTED_SAFETY_REASON'), 'error');
602 }
603 } else {
604 acym_enqueueMessage(acym_translationSprintf('ACYM_COULD_NOT_UPLOAD_FILE_PERMISSION', $baseDir), 'error');
605 }
606
607 return false;
608 }
609
610 function acym_copyFile($src, $dest, $path = null, $use_streams = false)
611 {
612 if ($path) {
613 $src = acym_cleanPath($path.DS.$src);
614 $dest = acym_cleanPath($path.DS.$dest);
615 }
616
617 if (!is_readable($src)) {
618 acym_enqueueMessage(acym_translationSprintf('ACYM_COULD_NOT_FIND_FILE_SOURCE_PERMISSION', $src), 'error');
619
620 return false;
621 }
622
623 if (!@copy($src, $dest)) {
624 acym_enqueueMessage(acym_translationSprintf('ACYM_COULD_NOT_COPY_FILE_X_TO_X', $src, $dest), 'error');
625
626 return false;
627 }
628
629 return true;
630 }
631
632 function acym_fileGetExt($file)
633 {
634 $pathInfo = pathinfo($file);
635
636 return empty($pathInfo['extension']) ? '' : strtolower($pathInfo['extension']);
637 }
638
639 function acym_cleanPath($path, $ds = DIRECTORY_SEPARATOR)
640 {
641 $path = trim($path);
642
643 if (empty($path)) {
644 $path = ACYM_ROOT;
645 } elseif (($ds == '\\') && substr($path, 0, 2) == '\\\\') {
646 $path = "\\".preg_replace('#[/\\\\]+#', $ds, $path);
647 } else {
648 $path = preg_replace('#[/\\\\]+#', $ds, $path);
649 }
650
651 return $path;
652 }
653
654 function acym_createArchive($name, $files)
655 {
656 $contents = [];
657 $ctrldir = [];
658
659 $timearray = getdate();
660 $dostime = (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
661 $dtime = dechex($dostime);
662 $hexdtime = chr(hexdec($dtime[6].$dtime[7])).chr(hexdec($dtime[4].$dtime[5])).chr(hexdec($dtime[2].$dtime[3])).chr(
663 hexdec($dtime[0].$dtime[1])
664 );
665
666 foreach ($files as $file) {
667 $data = $file['data'];
668 $filename = str_replace('\\', '/', $file['name']);
669
670 $fr = "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00".$hexdtime;
671
672 $unc_len = strlen($data);
673 $crc = crc32($data);
674 $zdata = gzcompress($data);
675 $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2);
676 $c_len = strlen($zdata);
677
678 $fr .= pack('V', $crc).pack('V', $c_len).pack('V', $unc_len).pack('v', strlen($filename)).pack(
679 'v',
680 0
681 ).$filename.$zdata;
682
683 $old_offset = strlen(implode('', $contents));
684 $contents[] = $fr;
685
686 $cdrec = "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00".$hexdtime;
687 $cdrec .= pack('V', $crc).pack('V', $c_len).pack('V', $unc_len).pack('v', strlen($filename)).pack('v', 0).pack(
688 'v',
689 0
690 ).pack('v', 0).pack('v', 0).pack('V', 32).pack('V', $old_offset).$filename;
691
692 $ctrldir[] = $cdrec;
693 }
694
695 $data = implode('', $contents);
696 $dir = implode('', $ctrldir);
697 $buffer = $data.$dir."\x50\x4b\x05\x06\x00\x00\x00\x00".pack('v', count($ctrldir)).pack('v', count($ctrldir)).pack(
698 'V',
699 strlen($dir)
700 ).pack('V', strlen($data))."\x00\x00";
701
702 return acym_writeFile($name.'.zip', $buffer);
703 }
704
705 function acym_loaderLogo(bool $wrap = true): string
706 {
707 $loader = '';
708 if ($wrap) {
709 $loader .= '<div class="cell shrink acym_loader_logo">';
710 }
711
712 $loader .= '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 1024 1024">
713 <path class="acym__svg__loader" fill="#a6a9ab" d="M553.074 174.168c-12.201 7.319-26.84 10.573-40.668 10.573s-27.655-3.253-40.668-10.573l-242.376-139.081-229.362 132.575v732.011l254.576 143.963v-430.26l219.602 124.442c11.388 6.507 24.401 9.76 37.415 9.76 0 0 0 0 0 0s0 0 0 0c12.201 0 25.214-3.253 36.6-9.76l221.23-124.442v430.26l254.576-144.775v-732.011l-229.362-131.762-241.563 139.081zM491.261 701.215l-217.164-122.815-61.001-34.161v430.26l-173.243-97.601v-662.063l422.94 245.629c0 0 0 0 0 0 8.947 4.881 17.895 8.135 27.655 10.573v230.178zM983.334 876.086l-173.243 98.416v-431.073l-61.001 34.161-217.164 122.815v-229.362c9.76-2.441 18.707-5.694 27.655-10.573l423.753-246.444v662.063zM539.246 425.493c-17.080 9.76-38.227 9.76-55.307 0 0 0 0 0 0 0l-422.94-245.629 168.362-97.601 222.043 127.696c18.707 10.573 39.853 16.267 61.001 16.267s42.294-5.694 61.001-16.267l222.043-127.696 168.362 97.601-424.566 245.629z"></path>
714 </svg>';
715
716 if ($wrap) {
717 $loader .= '</div>';
718 }
719
720 return $loader;
721 }
722
723 function acym_fileNameValid($filename)
724 {
725 if (empty($filename)) return false;
726
727 if (strpos($filename, '..') !== false || strpos($filename, '/') !== false || strpos($filename, '\\') !== false) return false;
728
729 return true;
730 }
731
732 function acym_getImageFileExtensions()
733 {
734 return ['jpg', 'jpeg', 'png', 'gif', 'ico', 'bmp', 'svg'];
735 }
736