Issues (762)

plugins/calender/install/install.php (1 issue)

Severity
1
<?php
2
3
/**
4
 * Copyright (c) 2018 Justin Kuenzel (jukusoft.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
if (!defined("PLUGIN_INSTALLER")) {
20
	echo "You cannot access this file directly!";
21
	exit;
22
}
23
24
/**
25
 * table plugin_calender_calenders
26
 *
27
 * Plugin: calender
28
 */
29
30
//create or upgrade test table
31
$table = new DBTable("plugin_calender_calenders", Database::getInstance());
32
$table->setEngine("InnoDB");
33
$table->setCharset("utf8");
34
35
//fields
36
$table->addInt("id", 10, true, true);
37
$table->addVarchar("title", 255, true);
38
$table->addText("description", true);
39
$table->addEnum("type", array("public", "internal", "private"), true, "private");
40
41
//add keys to table
42
$table->addPrimaryKey("id");
43
44
//create or upgrade table
45
$table->upgrade();
46
47
/**
48
 * table plugin_calender_events
49
 *
50
 * Plugin: calender
51
 */
52
53
//create or upgrade test table
54
$table = new DBTable("plugin_calender_events", Database::getInstance());
55
$table->setEngine("InnoDB");
56
$table->setCharset("utf8");
57
58
//fields
59
$table->addInt("id", 10, true, true);
60
$table->addInt("calenderID", 10, true, false);
61
$table->addVarchar("title", 255, true);
62
$table->addText("description", true);
63
$table->addVarchar("price_info", 255, true, "");
64
$table->addVarchar("image", 600, true, "none");
65
$table->addInt("all_day", 10, true, false, 0);
66
$table->addTimestamp("from_date", true, "0000-00-00 00:00:00");
67
$table->addTimestamp("to_date",true, "0000-00-00 00:00:00");
68
$table->addVarchar("location", 600, true, "");
69
$table->addVarchar("color", 255, true, "none");
70
$table->addInt("activated", 10, true, false, 1);
71
72
//add keys to table
73
$table->addPrimaryKey("id");
74
$table->addIndex("calenderID");
75
$table->addIndex("from_date");
76
$table->addIndex("activated");
77
78
//create or upgrade table
79
$table->upgrade();
80
81
/**
82
 * table plugin_calender_group_rights
83
 *
84
 * Plugin: calender
85
 */
86
87
//create or upgrade test table
88
$table = new DBTable("plugin_calender_group_rights", Database::getInstance());
89
$table->setEngine("InnoDB");
90
$table->setCharset("utf8");
91
92
//fields
93
$table->addInt("groupID", 10, true, false);
94
$table->addInt("calenderID", 10, true, false);
95
$table->addEnum("value", array("read", "write", "owner"), true, "read");
96
97
//add keys to table
98
$table->addPrimaryKey(array("groupID", "calenderID"));
99
100
//create or upgrade table
101
$table->upgrade();
102
103
/**
104
 * table plugin_calender_user_rights
105
 *
106
 * Plugin: calender
107
 */
108
109
//create or upgrade test table
110
$table = new DBTable("plugin_calender_user_rights", Database::getInstance());
111
$table->setEngine("InnoDB");
112
$table->setCharset("utf8");
113
114
//fields
115
$table->addInt("userID", 10, true, false);
116
$table->addInt("calenderID", 10, true, false);
117
$table->addEnum("value", array("read", "write", "owner"), true, "read");
118
119
//add keys to table
120
$table->addPrimaryKey(array("userID", "calenderID"));
121
122
//create or upgrade table
123
$table->upgrade();
124
125
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
126