1 |
1289
|
kweitzel
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category modules
|
5 |
|
|
* @package form
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2010, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 4.3.4 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
*
|
17 |
|
|
*/
|
18 |
|
|
|
19 |
|
|
if(defined('WB_URL'))
|
20 |
|
|
{
|
21 |
|
|
|
22 |
|
|
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");
|
23 |
|
|
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");
|
24 |
|
|
// $database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");
|
25 |
|
|
|
26 |
|
|
// Create tables
|
27 |
|
|
$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,'
|
28 |
|
|
. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
|
29 |
|
|
. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
|
30 |
|
|
. ' `position` INT NOT NULL DEFAULT \'0\' ,'
|
31 |
|
|
. ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
32 |
|
|
. ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
33 |
|
|
. ' `required` INT NOT NULL DEFAULT \'0\' ,'
|
34 |
|
|
. ' `value` TEXT NOT NULL ,'
|
35 |
|
|
. ' `extra` TEXT NOT NULL ,'
|
36 |
|
|
. ' PRIMARY KEY ( `field_id` ) '
|
37 |
|
|
. ' )';
|
38 |
|
|
$database->query($mod_form);
|
39 |
|
|
|
40 |
|
|
$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_settings` ('
|
41 |
|
|
. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
|
42 |
|
|
. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
|
43 |
|
|
. ' `header` TEXT NOT NULL ,'
|
44 |
|
|
. ' `field_loop` TEXT NOT NULL ,'
|
45 |
|
|
. ' `footer` TEXT NOT NULL ,'
|
46 |
|
|
. ' `email_to` TEXT NOT NULL ,'
|
47 |
|
|
. ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
48 |
|
|
. ' `email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
49 |
|
|
. ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
50 |
|
|
. ' `success_page` TEXT NOT NULL ,'
|
51 |
|
|
. ' `success_email_to` TEXT NOT NULL ,'
|
52 |
|
|
. ' `success_email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
53 |
|
|
. ' `success_email_fromname` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
54 |
|
|
. ' `success_email_text` TEXT NOT NULL ,'
|
55 |
|
|
. ' `success_email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
|
56 |
|
|
. ' `stored_submissions` INT NOT NULL DEFAULT \'0\' ,'
|
57 |
|
|
. ' `max_submissions` INT NOT NULL DEFAULT \'0\' ,'
|
58 |
|
|
. ' `use_captcha` INT NOT NULL DEFAULT \'0\' ,'
|
59 |
|
|
. ' PRIMARY KEY ( `section_id` ) '
|
60 |
|
|
. ' )';
|
61 |
|
|
$database->query($mod_form);
|
62 |
|
|
|
63 |
|
|
$mod_form = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,'
|
64 |
|
|
. ' `section_id` INT NOT NULL DEFAULT \'0\' ,'
|
65 |
|
|
. ' `page_id` INT NOT NULL DEFAULT \'0\' ,'
|
66 |
|
|
. ' `submitted_when` INT NOT NULL DEFAULT \'0\' ,'
|
67 |
|
|
. ' `submitted_by` INT NOT NULL DEFAULT \'0\','
|
68 |
|
|
. ' `body` TEXT NOT NULL,'
|
69 |
|
|
. ' PRIMARY KEY ( `submission_id` ) '
|
70 |
|
|
. ' )';
|
71 |
|
|
$database->query($mod_form);
|
72 |
|
|
|
73 |
|
|
$mod_search = "SELECT * FROM ".TABLE_PREFIX."search WHERE value = 'form'";
|
74 |
|
|
$insert_search = $database->query($mod_search);
|
75 |
|
|
if( $insert_search->numRows() == 0 )
|
76 |
|
|
{
|
77 |
|
|
// Insert info into the search table
|
78 |
|
|
// Module query info
|
79 |
|
|
$field_info = array();
|
80 |
|
|
$field_info['page_id'] = 'page_id';
|
81 |
|
|
$field_info['title'] = 'page_title';
|
82 |
|
|
$field_info['link'] = 'link';
|
83 |
|
|
$field_info['description'] = 'description';
|
84 |
|
|
$field_info['modified_when'] = 'modified_when';
|
85 |
|
|
$field_info['modified_by'] = 'modified_by';
|
86 |
|
|
$field_info = serialize($field_info);
|
87 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");
|
88 |
|
|
// Query start
|
89 |
|
|
$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_form_fields, [TP]mod_form_settings, [TP]pages WHERE ";
|
90 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");
|
91 |
|
|
// Query body
|
92 |
|
|
$query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header LIKE \'%[STRING]%\'
|
93 |
|
|
OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer LIKE \'%[STRING]%\'
|
94 |
|
|
OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title LIKE \'%[STRING]%\' ";
|
95 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");
|
96 |
|
|
// Query end
|
97 |
|
|
$query_end_code = "";
|
98 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");
|
99 |
|
|
|
100 |
|
|
// Insert blank row (there needs to be at least on row for the search to work)
|
101 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");
|
102 |
|
|
$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");
|
103 |
|
|
|
104 |
|
|
}
|
105 |
|
|
}
|
106 |
|
|
|
107 |
560
|
Ruebenwurz
|
?>
|