-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.php
executable file
·59 lines (45 loc) · 2.15 KB
/
install.php
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
<?php
rex_yform_manager_table_api::importTablesets(rex_file::get(rex_path::addon('poll', 'install/tablesets/poll_tables.json')));
$searchtext = 'module:poll_basic_output';
$yform_module_name = 'translate:poll_module';
$gm = rex_sql::factory();
//$gm->setDebug();
$gm->setQuery('select * from rex_module where output LIKE ?', ['%' . $searchtext . '%']);
$modules = $gm->getArray();
if (0 < count($modules)) {
$gm->setQuery('update rex_module set input = :input, output = :output, updatedate = :updatedate, updateuser = :updateuser where id = :module_id', [
':input' => rex_file::get(rex_path::addon('poll', 'module/module_input.inc')),
':output' => rex_file::get(rex_path::addon('poll', 'module/module_output.inc')),
':updatedate' => date('Y-m-d H:i:s'),
':updateuser' => 'poll-addon',
':module_id' => $modules[0]['id'],
]);
} else {
$gm->setQuery('insert into rex_module set name = :name, input = :input, output = :output, updatedate = :updatedate, updateuser = :updateuser', [
':name' => $yform_module_name,
':input' => rex_file::get(rex_path::addon('poll', 'module/module_input.inc')),
':output' => rex_file::get(rex_path::addon('poll', 'module/module_output.inc')),
':updatedate' => date('Y-m-d H:i:s'),
':updateuser' => 'poll-addon',
]);
}
$name = 'poll_user';
$templates = $gm->getArray('select * from rex_yform_email_template where name = ?', [$name]);
$subject = 'Bestätigung für Umfrage "REX_YFORM_DATA[field="poll-title"]"';
$body = 'Hallo,
vielen Dank für deine Beteiligung an der Umfrage. Bitte bestätige deine Wahl unter folgendem Link: REX_YFORM_DATA[field="poll-link"]
Vielen Dank,
Das Poll-System';
if (0 < count($templates)) {
$gm->setQuery('update rex_yform_email_template set subject = :subject, body = :body where id = :template_id', [
':subject' => $subject,
':body' => $body,
':template_id' => $templates[0]['id'],
]);
} else {
$gm->setQuery('insert into rex_yform_email_template set subject = :subject, body = :body, name = :name', [
':name' => $name,
':subject' => $subject,
':body' => $body,
]);
}