|
|
@@ -37,17 +37,21 @@ class Alter {
|
|
37
|
37
|
|
|
38
|
38
|
/* Event functions */
|
|
39
|
39
|
|
|
40
|
|
- public static function addEvent($title, $content, $type, $eventdate) {
|
|
|
40
|
+ public static function addEvent($title, $content, $type, $eventdate, $image) {
|
|
41
|
41
|
$db = new DBClass();
|
|
42
|
|
- $sql = "INSERT INTO `events` (`id`, `title`, `img`, `type`, `description`, `time`) VALUES (NULL, '$title', 'image', '$type', '$content', '" . strtotime($eventdate) . "');";
|
|
|
42
|
+ $sql = "INSERT INTO `events` (`id`, `title`, `img`, `type`, `description`, `time`) VALUES (NULL, '$title', '$image', '$type', '$content', '" . strtotime($eventdate) . "');";
|
|
43
|
43
|
$db->query($sql);
|
|
44
|
44
|
header('Location: ' . Config::$sys_url . '?page=eventadmin');
|
|
45
|
45
|
die("Error, please enable browser-redirects.");
|
|
46
|
46
|
}
|
|
47
|
47
|
|
|
48
|
|
- public static function editEvent($id, $title, $content, $type, $eventdate) {
|
|
|
48
|
+ public static function editEvent($id, $title, $content, $type, $eventdate, $image) {
|
|
49
|
49
|
$db = new DBClass();
|
|
50
|
|
- $sql = "UPDATE `events` SET `title` = '$title', `img` = 'images', `type` = '$type', `time` = '" . strtotime($eventdate) . "', `description` = '$content' WHERE `events`.`id` = $id;";
|
|
|
50
|
+ if ($image != false) {
|
|
|
51
|
+ $sql = "UPDATE `events` SET `title` = '$title', `img` = '$image', `type` = '$type', `time` = '" . strtotime($eventdate) . "', `description` = '$content' WHERE `events`.`id` = $id;";
|
|
|
52
|
+ } else {
|
|
|
53
|
+ $sql = "UPDATE `events` SET `title` = '$title', `type` = '$type', `time` = '" . strtotime($eventdate) . "', `description` = '$content' WHERE `events`.`id` = $id;";
|
|
|
54
|
+ }
|
|
51
|
55
|
$db->query($sql);
|
|
52
|
56
|
header('Location: ' . Config::$sys_url . '?page=eventadmin');
|
|
53
|
57
|
die("Error, please enable browser redirects.");
|
|
|
@@ -87,8 +91,8 @@ class Alter {
|
|
87
|
91
|
return $db->query($sql);
|
|
88
|
92
|
}
|
|
89
|
93
|
}
|
|
90
|
|
-
|
|
91
|
|
- public static function insertImage($filename,$mime) {
|
|
|
94
|
+
|
|
|
95
|
+ public static function insertImage($filename, $mime) {
|
|
92
|
96
|
$db = new DBClass();
|
|
93
|
97
|
$time = new DateTime();
|
|
94
|
98
|
$sql = "INSERT INTO `uploads` (`id`, `filename`, `date`, `user`, `mime`) VALUES (NULL, '$filename', '" . $time->getTimestamp() . "', '" . $_SESSION['user'] . "', '" . $mime . "');";
|