Repository navigation
Expand file tree
/
Copy pathbootstrap.php
More file actions
72 lines (57 loc) · 1.58 KB
/
Copy pathbootstrap.php
File metadata and controls
72 lines (57 loc) · 1.58 KB
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
<?php
/**
* cfFormMailer
*
* @author Clefarray Factory
* @link http://www.clefarray-web.net/
* @version 1.7.0
*
* Documentation: http://www.clefarray-web.net/blog/manual/cfFormMailer_manual.html
* LICENSE: GNU General Public License (GPL) (http://www.gnu.org/copyleft/gpl.html)
*/
/** @var documentParser $modx */
if ($modx->isBackend()) {
return '';
}
if (!isset($config)) {
return '<strong>ERROR!:</strong> 「config」パラメータは必須です';
}
define('CFM_PATH', __DIR__ . '/');
require_once CFM_PATH . 'src/autoload.php';
$mf = new Class_cfFormMailer($modx);
$mf->parseConfig($config);
if ($mf->hasSystemError()) {
return '<strong>ERROR!</strong> ' . $mf->getSystemError();
}
if (is_file(CFM_PATH . 'additionalMethods.inc.php')) {
include_once CFM_PATH . 'additionalMethods.inc.php';
}
if (!postv()) {
return $mf->renderForm();
}
if (postv('return')) {
return $mf->renderFormOnBack();
}
if ($mf->alreadySent()) {
return $mf->raiseError('すでに送信しています');
}
if (postv('_mode') === 'conf') {
if(!$mf->validate()) {
return $mf->renderFormWithError();
}
return $mf->renderConfirm();
}
if (postv('_mode') === 'send') {
if (!$mf->isValidToken(postv('_cffm_token'))) {
return $mf->raiseError('画面遷移が正常に行われませんでした');
}
$sent = $mf->sendMail();
if (!$sent) {
return $mf->raiseError($mf->getError());
}
$mf->cleanUploadedFiles();
$mf->storeDataInSession();
$mf->storeDB();
return $mf->renderComplete();
}
return $mf->renderForm();