-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.inc
194 lines (187 loc) · 8.49 KB
/
admin.inc
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
// $Id$
/**
* @file
* Administration part of donate.
*/
function giftoflife_donate_dengionline_admin_settings($form_state) {
$form['giftoflife_donate_dengionline_id'] = array(
'#type' => 'textfield',
'#title' => t('OnlineDengi ID'),
'#description' => t('Id of electronical shop.'),
'#default_value' => variable_get('giftoflife_donate_dengionline_id', '333333'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_dengionline_url'] = array(
'#type' => 'textfield',
'#title' => t('dengionline URL'),
'#default_value' => variable_get('giftoflife_donate_dengionline_url', 'http://www.onlinedengi.ru/wmpaycheck.php'),
'#description' => t('The DengiOnline URL to redirect to for donate.'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_dengionline_complete_url'] = array(
'#type' => 'textfield',
'#title' => t('Donate complete URL'),
'#description' => t('The URL on your site that the user will be redirected to after they complete donate.'),
'#default_value' => variable_get('giftoflife_donate_dengionline_complete_url', 'giftoflife_donate/thanks'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_dengionline_header'] = array(
'#type' => 'textarea',
'#title' => t('Donate page header'),
'#description' => t('HTML text to display before the form.'),
'#default_value' => variable_get('giftoflife_donate_dengionline_header', '<p>Please complete the form below and then you will be directed to Dengionline for completing the donate.</p>'),
);
$form['giftoflife_donate_dengionline_footer'] = array(
'#type' => 'textarea',
'#title' => t('Donate page footer'),
'#description' => t('HTML text to display after the form.'),
'#default_value' => variable_get('giftoflife_donate_dengionline_footer', '<p>We thank you for your business.</p>'),
);
return system_settings_form($form);
}
function giftoflife_donate_yandexmoney_admin_settings($form_state) {
$form['giftoflife_donate_yandexmoney_shopid'] = array(
'#type' => 'textfield',
'#title' => t('ShopID'),
'#description' => t('Yandex Money ShopID.'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_shopid', '10631'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_yandexmoney_scid'] = array(
'#type' => 'textfield',
'#title' => t('scid'),
'#description' => t('Yandex Money scid.'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_scid', '2399'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_yandexmoney_url'] = array(
'#type' => 'textfield',
'#title' => t('Yandex Money URL'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_url', 'https://money.yandex.ru/eshop.xml'),
'#description' => t('The Yandex Money URL to redirect to for donate.'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_yandexmoney_complete_url'] = array(
'#type' => 'textfield',
'#title' => t('Donate complete URL'),
'#description' => t('The URL on your site that the user will be redirected to after they complete donate.'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_complete_url', 'giftoflife_donate/thanks'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_yandexmoney_header'] = array(
'#type' => 'textarea',
'#title' => t('Donate page header'),
'#description' => t('HTML text to display before the form.'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_header', '<p>Please complete the form below and then you will be directed to Yandex Money for completing the donate.</p>'),
);
$form['giftoflife_donate_yandexmoney_footer'] = array(
'#type' => 'textarea',
'#title' => t('Donate page footer'),
'#description' => t('HTML text to display after the form.'),
'#default_value' => variable_get('giftoflife_donate_yandexmoney_footer', '<p>We thank you for your business.</p>'),
);
return system_settings_form($form);
}
function giftoflife_donate_rbkmoney_admin_settings($form_state) {
$form['giftoflife_donate_rbkmoney_eshopid'] = array(
'#type' => 'textfield',
'#title' => t('eshopID'),
'#description' => t('RBK Money eshopID.'),
'#default_value' => variable_get('giftoflife_donate_rbkmoney_eshopid', '2003743'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_rbkmoney_url'] = array(
'#type' => 'textfield',
'#title' => t('RBK Money URL'),
'#default_value' => variable_get('giftoflife_donate_rbkmoney_url', 'https://rbkmoney.ru/acceptpurchase.aspx'),
'#description' => t('The RBK Money URL to redirect to for donate.'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_rbkmoney_complete_url'] = array(
'#type' => 'textfield',
'#title' => t('Donate complete URL'),
'#description' => t('The URL on your site that the user will be redirected to after they complete donate.'),
'#default_value' => variable_get('giftoflife_donate_rbkmoney_complete_url', 'giftoflife_donate/thanks'),
'#size' => 40,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['giftoflife_donate_rbkmoney_header'] = array(
'#type' => 'textarea',
'#title' => t('Donate page header'),
'#description' => t('HTML text to display before the form.'),
'#default_value' => variable_get('giftoflife_donate_rbkmoney_header', '<p>Please complete the form below and then you will be directed to RBK Money for completing the donate.</p>'),
);
$form['giftoflife_donate_rbkmoney_footer'] = array(
'#type' => 'textarea',
'#title' => t('Donate page footer'),
'#description' => t('HTML text to display after the form.'),
'#default_value' => variable_get('giftoflife_donate_rbkmoney_footer', '<p>We thank you for your business.</p>'),
);
return system_settings_form($form);
}
function giftoflife_donate_admin_settings($form_state) {
$form['giftoflife_donate_help'] = array(
'#value' => t('Please walk through tabs and fill settings.'),
);
$form['giftoflife_donate_thanks'] = array(
'#type' => 'textarea',
'#title' => t('Thanks page'),
'#description' => t('HTML text to display on the thank you page.'),
'#default_value' => variable_get('giftoflife_donate_thanks', '<p>Thank you for your donation.</p>'),
);
$form['giftoflife_donate_error'] = array(
'#type' => 'textarea',
'#title' => t('Error page'),
'#description' => t('HTML text to display on the error page.'),
'#default_value' => variable_get('error', '<p>Some kind of error.</p>'),
);
return system_settings_form($form);
}
function giftoflife_donate_dengionline_admin_settings_validate($form, &$form_state) {
$dengionline_id=$form_state['values']['giftoflife_donate_dengionline_id'];
$dengionline_url = $form_state['values']['giftoflife_donate_dengionline_url'];
$dengionline_complete_url = $form_state['values']['giftoflife_donate_dengionline_complete_url'];
$dengionline_header = $form_state['values']['giftoflife_donate_dengionline_header'];
$dengionline_footer = $form_state['values']['giftoflife_donate_dengionline_footer'];
if (!$dengionline_id) {
form_set_error('giftoflife_donate_dengionline_id', 'Please enter Id of your e-shop.');
}
if (!$dengionline_url) {
form_set_error('giftoflife_donate_dengionline_url', 'Please enter URL of your e-shop.');
}
if (!$dengionline_complete_url) {
form_set_error('giftoflife_donate_dengionline_complete_url', 'Please enter URL where you go after complete donating.');
}
if (!$dengionline_header) {
form_set_error('giftoflife_donate_dengionline_header', 'Please type header message.');
}
if (!$dengionline_footer) {
form_set_error('giftoflife_donate_dengionline_footer', 'Please type footer message.');
}
}
function giftoflife_donate_admin_settings_validate($form, &$form_state) {
$thanks = $form_state['values']['giftoflife_donate_thanks'];
if (!$thanks) {
form_set_error('giftoflife_donate_error', 'Please type thanks message.');
}
}