-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable.php
More file actions
85 lines (76 loc) · 2.17 KB
/
enable.php
File metadata and controls
85 lines (76 loc) · 2.17 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
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* mbForms
*
* Form Builder Plugin for WolfCMS
* Please keep this message intact when redistributing this plugin.
*
* @author Mike Barlow
* @email mike@mikebarlow.co.uk
*
* @file enable.php
* @date 16/08/2010
*
* Thanks to Sartas for SQLite Support.
*
*/
// check for some constants
if (!defined("CMS_ROOT"))
{
die("Invalid Action");
}
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// setup the table
if($driver == 'mysql')
{
$table1 = "CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "mbforms` (
`id` int(10) NOT NULL auto_increment,
`formname` varchar(255) NOT NULL,
`emailto` varchar(255) NOT NULL,
`usecaptcha` tinyint(1) NOT NULL default '0',
`successtpl` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;";
$table2 = "CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "mbforms_items` (
`id` int(10) NOT NULL auto_increment,
`formid` int(10) NOT NULL,
`label` text NOT NULL,
`extras` text NOT NULL,
`orderno` int(5) NOT NULL,
`type` varchar(10) NOT NULL,
`formvalues` text NOT NULL,
`isrequired` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;";
} elseif($driver == 'sqlite')
{
$table1 = "CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "mbforms` (
`id` INTEGER NOT NULL PRIMARY KEY,
`formname` varchar(255) NOT NULL,
`emailto` varchar(255) NOT NULL,
`usecaptcha` tinyint(1) NOT NULL default '0',
`successtpl` text NOT NULL
);";
$table2 = "CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "mbforms_items` (
`id` INTEGER NOT NULL PRIMARY KEY,
`formid` int(10) NOT NULL,
`label` text NOT NULL,
`extras` text NOT NULL,
`orderno` int(5) NOT NULL,
`type` varchar(10) NOT NULL,
`formvalues` text NOT NULL,
`isrequired` tinyint(1) NOT NULL default '0'
);";
}
$PDO->exec($table1);
$PDO->exec($table2);
$settings = Plugin::getAllSettings('mbforms');
if (!is_array($settings) OR count($settings) != 2)
{
// setup the plugin settings
Plugin::setAllSettings(array(
'publickey' => '',
'privatekey' => ''
), 'mbforms');
}