Project

General

Profile

« Previous | Next » 

Revision 317

Added by stefan over 18 years ago

Changed all line endings to Unix stlye

View differences:

install.php
30 30

  
31 31
if(defined('WB_URL')) {
32 32
		
33
	// Create tables

34
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");

35
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,'

36
	                 . ' `section_id` INT NOT NULL ,'

37
	                 . ' `page_id` INT NOT NULL ,'

38
	                 . ' `position` INT NOT NULL ,'

39
	                 . ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,'

40
	                 . ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,'

41
	                 . ' `required` INT NOT NULL ,'

42
	                 . ' `value` TEXT NOT NULL DEFAULT \'\' ,'

43
	                 . ' `extra` TEXT NOT NULL DEFAULT \'\' ,'

44
	                 . ' PRIMARY KEY ( `field_id` ) )'

45
	                 . ' ';

46
	$database->query($mod_form);

47
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");

48
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_settings` ('

49
						  . ' `section_id` INT NOT NULL,'

50
						  . ' `page_id` INT NOT NULL,'

51
	                 . ' `header` TEXT NOT NULL DEFAULT \'\' ,'

52
	                 . ' `field_loop` TEXT NOT NULL DEFAULT \'\' ,'

53
	                 . ' `footer` TEXT NOT NULL DEFAULT \'\' ,'

54
	                 . ' `email_to` TEXT NOT NULL DEFAULT \'\' ,'

55
	                 . ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'

56
	                 . ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'

33
	// Create tables
34
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_fields`");
35
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_fields` ( `field_id` INT NOT NULL AUTO_INCREMENT,'
36
	                 . ' `section_id` INT NOT NULL ,'
37
	                 . ' `page_id` INT NOT NULL ,'
38
	                 . ' `position` INT NOT NULL ,'
39
	                 . ' `title` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
40
	                 . ' `type` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
41
	                 . ' `required` INT NOT NULL ,'
42
	                 . ' `value` TEXT NOT NULL DEFAULT \'\' ,'
43
	                 . ' `extra` TEXT NOT NULL DEFAULT \'\' ,'
44
	                 . ' PRIMARY KEY ( `field_id` ) )'
45
	                 . ' ';
46
	$database->query($mod_form);
47
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_settings`");
48
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_settings` ('
49
						  . ' `section_id` INT NOT NULL,'
50
						  . ' `page_id` INT NOT NULL,'
51
	                 . ' `header` TEXT NOT NULL DEFAULT \'\' ,'
52
	                 . ' `field_loop` TEXT NOT NULL DEFAULT \'\' ,'
53
	                 . ' `footer` TEXT NOT NULL DEFAULT \'\' ,'
54
	                 . ' `email_to` TEXT NOT NULL DEFAULT \'\' ,'
55
	                 . ' `email_from` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
56
	                 . ' `email_subject` VARCHAR(255) NOT NULL DEFAULT \'\' ,'
57 57
	                 . ' `success_message` TEXT NOT NULL DEFAULT \'\' ,'
58 58
					 . ' `stored_submissions` INT NOT NULL,'
59 59
					 . ' `max_submissions` INT NOT NULL,'
60
					 . ' `use_captcha` INT NOT NULL,'

61
	                 . ' PRIMARY KEY ( `section_id` ) )'

62
	                 . ' ';

63
	$database->query($mod_form);

64
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");

65
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,'

66
						  . ' `section_id` INT NOT NULL,'

60
					 . ' `use_captcha` INT NOT NULL,'
61
	                 . ' PRIMARY KEY ( `section_id` ) )'
62
	                 . ' ';
63
	$database->query($mod_form);
64
	$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_form_submissions`");
65
	$mod_form = 'CREATE TABLE `'.TABLE_PREFIX.'mod_form_submissions` ( `submission_id` INT NOT NULL AUTO_INCREMENT,'
66
						  . ' `section_id` INT NOT NULL,'
67 67
						  . ' `page_id` INT NOT NULL,'
68 68
						  . ' `submitted_when` INT NOT NULL,'
69
						  . ' `submitted_by` INT NOT NULL,'

70
	                 . ' `body` TEXT NOT NULL DEFAULT \'\' ,'

71
	                 . ' PRIMARY KEY ( `submission_id` ) )'

72
	                 . ' ';

69
						  . ' `submitted_by` INT NOT NULL,'
70
	                 . ' `body` TEXT NOT NULL DEFAULT \'\' ,'
71
	                 . ' PRIMARY KEY ( `submission_id` ) )'
72
	                 . ' ';
73 73
	$database->query($mod_form);
74
		
75
	// Insert info into the search table

76
	// Module query info

77
	$field_info = array();

78
	$field_info['page_id'] = 'page_id';

79
	$field_info['title'] = 'page_title';

74
		
75
	// Insert info into the search table
76
	// Module query info
77
	$field_info = array();
78
	$field_info['page_id'] = 'page_id';
79
	$field_info['title'] = 'page_title';
80 80
	$field_info['link'] = 'link';
81 81
	$field_info['description'] = 'description';
82 82
	$field_info['modified_when'] = 'modified_when';
83
	$field_info['modified_by'] = 'modified_by';

84
	$field_info = serialize($field_info);

85
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");

86
	// Query start

87
	$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 ";

88
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");

89
	// Query body

90
	$query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'

91
	OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'

92
	OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'";

93
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");

94
	// Query end

95
	$query_end_code = '';

96
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");

97
	
98
	// Insert blank row (there needs to be at least on row for the search to work)

99
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");

100
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");

83
	$field_info['modified_by'] = 'modified_by';
84
	$field_info = serialize($field_info);
85
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'form', '$field_info')");
86
	// Query start
87
	$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 ";
88
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'form')");
89
	// Query body
90
	$query_body_code = " [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.header [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'
91
	OR [TP]pages.page_id = [TP]mod_form_settings.page_id AND [TP]mod_form_settings.footer [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'
92
	OR [TP]pages.page_id = [TP]mod_form_fields.page_id AND [TP]mod_form_fields.title [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'";
93
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'form')");
94
	// Query end
95
	$query_end_code = '';
96
	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'form')");
97
	
98
	// Insert blank row (there needs to be at least on row for the search to work)
99
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_fields (page_id,section_id) VALUES ('0','0')");
100
	$database->query("INSERT INTO ".TABLE_PREFIX."mod_form_settings (page_id,section_id) VALUES ('0','0')");
101 101

  
102 102
}
103

  
103

  
104 104
?>

Also available in: Unified diff