Passed
Push — master ( ce6199...f8d49f )
by Saepul
02:14
created
core/classes/HDNews.php 1 patch
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -2,98 +2,98 @@
 block discarded – undo
2 2
 
3 3
 class HDNews
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired)
13
-    {
14
-        $query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)');
15
-        $query->bindValue(1, $newsdate);
16
-        $query->bindValue(2, $title);
17
-        $query->bindValue(3, $detail);
18
-        $query->bindValue(4, $createdby);
19
-        $query->bindValue(5, $createdon);
20
-        $query->bindValue(6, $expired);
21
-
22
-        try {
23
-            $query->execute();
24
-        } catch (PDOException $e) {
25
-            die($e->getMessage());
26
-        }
27
-    }
28
-
29
-    public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired)
30
-    {
31
-        $query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?');
32
-        $query->bindValue(1, $newsdate);
33
-        $query->bindValue(2, $title);
34
-        $query->bindValue(3, $detail);
35
-        $query->bindValue(4, $createdby);
36
-        $query->bindValue(5, $createdon);
37
-        $query->bindValue(6, $expired);
38
-        $query->bindValue(7, $id);
39
-
40
-        try {
41
-            $query->execute();
42
-        } catch (PDOException $e) {
43
-            die($e->getMessage());
44
-        }
45
-    }
46
-
47
-    public function delete($id)
48
-    {
49
-        $sql = 'DELETE FROM `news` WHERE `id` = ?';
50
-        $query = $this->db->prepare($sql);
51
-        $query->bindValue(1, $id);
52
-
53
-        try {
54
-            $query->execute();
55
-        } catch (PDOException $e) {
56
-            die($e->getMessage());
57
-        }
58
-    }
59
-
60
-    public function news_data($id)
61
-    {
62
-        $query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?');
63
-        $query->bindValue(1, $id);
64
-
65
-        try {
66
-            $query->execute();
67
-
68
-            return $query->fetch();
69
-        } catch (PDOException $e) {
70
-            die($e->getMessage());
71
-        }
72
-    }
73
-
74
-    public function get_news()
75
-    {
76
-        $query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC');
77
-
78
-        try {
79
-            $query->execute();
80
-        } catch (PDOException $e) {
81
-            die($e->getMessage());
82
-        }
83
-
84
-        return $query->fetchAll();
85
-    }
86
-
87
-    public function get_headline_news()
88
-    {
89
-        $query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC');
90
-
91
-        try {
92
-            $query->execute();
93
-        } catch (PDOException $e) {
94
-            die($e->getMessage());
95
-        }
96
-
97
-        return $query->fetchAll();
98
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function add_news($newsdate, $title, $detail, $createdby, $createdon, $expired)
13
+	{
14
+		$query = $this->db->prepare('INSERT INTO `news` (`newsdate`,`title`, `detail`, `createdby`, `createdon`, `expired`) VALUES (?, ?, ?, ?, ?, ?)');
15
+		$query->bindValue(1, $newsdate);
16
+		$query->bindValue(2, $title);
17
+		$query->bindValue(3, $detail);
18
+		$query->bindValue(4, $createdby);
19
+		$query->bindValue(5, $createdon);
20
+		$query->bindValue(6, $expired);
21
+
22
+		try {
23
+			$query->execute();
24
+		} catch (PDOException $e) {
25
+			die($e->getMessage());
26
+		}
27
+	}
28
+
29
+	public function update_news($id, $newsdate, $title, $detail, $createdby, $createdon, $expired)
30
+	{
31
+		$query = $this->db->prepare('UPDATE `news` SET `newsdate` = ? , `title` = ? ,`detail` = ? , `createdby` = ? , `createdon` = ? , `expired` = ? WHERE `id` = ?');
32
+		$query->bindValue(1, $newsdate);
33
+		$query->bindValue(2, $title);
34
+		$query->bindValue(3, $detail);
35
+		$query->bindValue(4, $createdby);
36
+		$query->bindValue(5, $createdon);
37
+		$query->bindValue(6, $expired);
38
+		$query->bindValue(7, $id);
39
+
40
+		try {
41
+			$query->execute();
42
+		} catch (PDOException $e) {
43
+			die($e->getMessage());
44
+		}
45
+	}
46
+
47
+	public function delete($id)
48
+	{
49
+		$sql = 'DELETE FROM `news` WHERE `id` = ?';
50
+		$query = $this->db->prepare($sql);
51
+		$query->bindValue(1, $id);
52
+
53
+		try {
54
+			$query->execute();
55
+		} catch (PDOException $e) {
56
+			die($e->getMessage());
57
+		}
58
+	}
59
+
60
+	public function news_data($id)
61
+	{
62
+		$query = $this->db->prepare('SELECT * FROM `news` WHERE `id`= ?');
63
+		$query->bindValue(1, $id);
64
+
65
+		try {
66
+			$query->execute();
67
+
68
+			return $query->fetch();
69
+		} catch (PDOException $e) {
70
+			die($e->getMessage());
71
+		}
72
+	}
73
+
74
+	public function get_news()
75
+	{
76
+		$query = $this->db->prepare('SELECT * FROM `news` ORDER BY `newsdate` ASC');
77
+
78
+		try {
79
+			$query->execute();
80
+		} catch (PDOException $e) {
81
+			die($e->getMessage());
82
+		}
83
+
84
+		return $query->fetchAll();
85
+	}
86
+
87
+	public function get_headline_news()
88
+	{
89
+		$query = $this->db->prepare('SELECT * FROM `news` WHERE UNIX_TIMESTAMP( curdate( ) ) < `expired` ORDER BY `newsdate` ASC');
90
+
91
+		try {
92
+			$query->execute();
93
+		} catch (PDOException $e) {
94
+			die($e->getMessage());
95
+		}
96
+
97
+		return $query->fetchAll();
98
+	}
99 99
 }
Please login to merge, or discard this patch.
core/classes/Emails.php 1 patch
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -3,211 +3,211 @@
 block discarded – undo
3 3
 date_default_timezone_set('Asia/Jakarta');
4 4
 class Emails
5 5
 {
6
-    private $db;
7
-
8
-    public function __construct($database)
9
-    {
10
-        $this->db = $database;
11
-    }
12
-
13
-    public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus)
14
-    {
15
-        $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
16
-        $query = $this->db->prepare($querystring);
17
-        $query->bindValue(1, $idticket);
18
-        $query->bindValue(2, $senddate);
19
-        $query->bindValue(3, $emailto);
20
-        $query->bindValue(4, $emailcc);
21
-        $query->bindValue(5, $emailbcc);
22
-        $query->bindValue(6, $emailsubject);
23
-        $query->bindValue(7, $message);
24
-        $query->bindValue(8, $emailstatus);
25
-
26
-        try {
27
-            $query->execute();
28
-        } catch (PDOException $e) {
29
-            die($e->getMessage());
30
-        }
31
-    }
32
-
33
-    public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message)
34
-    {
35
-        $emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time";
36
-        $message =
6
+	private $db;
7
+
8
+	public function __construct($database)
9
+	{
10
+		$this->db = $database;
11
+	}
12
+
13
+	public function add_email($idticket, $senddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message, $emailstatus)
14
+	{
15
+		$querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
16
+		$query = $this->db->prepare($querystring);
17
+		$query->bindValue(1, $idticket);
18
+		$query->bindValue(2, $senddate);
19
+		$query->bindValue(3, $emailto);
20
+		$query->bindValue(4, $emailcc);
21
+		$query->bindValue(5, $emailbcc);
22
+		$query->bindValue(6, $emailsubject);
23
+		$query->bindValue(7, $message);
24
+		$query->bindValue(8, $emailstatus);
25
+
26
+		try {
27
+			$query->execute();
28
+		} catch (PDOException $e) {
29
+			die($e->getMessage());
30
+		}
31
+	}
32
+
33
+	public function add_sla_remainder($idticket, $ticketnumber, $slasenddate, $emailto, $emailcc, $emailbcc, $emailsubject, $message)
34
+	{
35
+		$emailsubject = "Ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time";
36
+		$message =
37 37
 "Dear Assignee, \r\n
38 38
 We remaind you that your ticket No: $ticketnumber has reached 75% of SLA Resolution Goal Time.\r\n
39 39
 Please give resolution for this ticket as soon as posible.\r\n
40 40
 Thank you. \r\n
41 41
 Regards, \r\n
42 42
 Helpdesk";
43
-        $querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
44
-        $query = $this->db->prepare($querystring);
45
-        $query->bindValue(1, $idticket);
46
-        $query->bindValue(2, $slasenddate);
47
-        $query->bindValue(3, $emailto);
48
-        $query->bindValue(4, $emailcc);
49
-        $query->bindValue(5, $emailbcc);
50
-        $query->bindValue(6, $emailsubject);
51
-        $query->bindValue(7, $message);
52
-        $query->bindValue(8, 'SLA Remainder');
53
-
54
-        try {
55
-            $query->execute();
56
-        } catch (PDOException $e) {
57
-            die($e->getMessage());
58
-        }
59
-    }
60
-
61
-    public function update_status_email($idemail, $emailstatus)
62
-    {
63
-        $querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?';
64
-        $query = $this->db->prepare($querystring);
65
-        $query->bindValue(1, $emailstatus);
66
-        $query->bindValue(2, $idemail);
67
-
68
-        try {
69
-            $query->execute();
70
-        } catch (PDOException $e) {
71
-            die($e->getMessage());
72
-        }
73
-    }
74
-
75
-    public function delete($idemail)
76
-    {
77
-        $sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?';
78
-        $query = $this->db->prepare($sql);
79
-        $query->bindValue(1, $idemail);
80
-
81
-        try {
82
-            $query->execute();
83
-        } catch (PDOException $e) {
84
-            die($e->getMessage());
85
-        }
86
-    }
87
-
88
-    public function get_email_by_idemail($idemail)
89
-    {
90
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
91
-        $query->bindValue(1, $idemail);
92
-
93
-        try {
94
-            $query->execute();
95
-
96
-            return $query->fetch();
97
-        } catch (PDOException $e) {
98
-            die($e->getMessage());
99
-        }
100
-    }
101
-
102
-    public function get_email_by_idticket($idticket)
103
-    {
104
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?');
105
-        $query->bindValue(1, $idticket);
106
-
107
-        try {
108
-            $query->execute();
109
-
110
-            return $query->fetch();
111
-        } catch (PDOException $e) {
112
-            die($e->getMessage());
113
-        }
114
-    }
115
-
116
-    public function get_email_by_status($emailstatus)
117
-    {
118
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?');
119
-        $query->bindValue(1, $emailstatus);
120
-
121
-        try {
122
-            $query->execute();
123
-        } catch (PDOException $e) {
124
-            die($e->getMessage());
125
-        }
126
-
127
-        return $query->fetchAll();
128
-    }
129
-
130
-    public function get_email_sla_remainder()
131
-    {
132
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())');
133
-        $query->bindValue(1, 'SLA Remainder');
134
-
135
-        try {
136
-            $query->execute();
137
-        } catch (PDOException $e) {
138
-            die($e->getMessage());
139
-        }
140
-
141
-        return $query->fetchAll();
142
-    }
143
-
144
-    public function get_email()
145
-    {
146
-        $query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC');
147
-
148
-        try {
149
-            $query->execute();
150
-        } catch (PDOException $e) {
151
-            die($e->getMessage());
152
-        }
153
-
154
-        return $query->fetchAll();
155
-    }
156
-
157
-    public function get_email_queue()
158
-    {
159
-        $query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC");
160
-
161
-        try {
162
-            $query->execute();
163
-        } catch (PDOException $e) {
164
-            die($e->getMessage());
165
-        }
166
-
167
-        return $query->fetchAll();
168
-    }
169
-
170
-    public function get_email_queue_by_id($idemail)
171
-    {
172
-        $query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
173
-        $query->bindValue(1, $idemail);
174
-
175
-        try {
176
-            $query->execute();
177
-
178
-            return $query->fetch();
179
-        } catch (PDOException $e) {
180
-            die($e->getMessage());
181
-        }
182
-    }
183
-
184
-    public function send_new_ticket()
185
-    {
186
-        if (substr(php_uname(), 0, 7) == 'Windows') {
187
-            //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat";
188
-            $cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat";
189
-            $WshShell = new COM('WScript.Shell');
190
-            $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
191
-
192
-            return $oExec == 0 ? true : false;
193
-        } else {
194
-            $cmd = 'php /batch/sendnewticket.bat';
195
-            exec($cmd.' > /dev/null &');
196
-        }
197
-    }
198
-
199
-    public function send_sla_remainder()
200
-    {
201
-        if (substr(php_uname(), 0, 7) == 'Windows') {
202
-            //$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat";
203
-            $cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat";
204
-            $WshShell = new COM('WScript.Shell');
205
-            $oExec = $WshShell->Run("cmd /C $cmd", 0, false);
206
-
207
-            return $oExec == 0 ? true : false;
208
-        } else {
209
-            $cmd = 'php /batch/sendslaremainder.bat';
210
-            exec($cmd.' > /dev/null &');
211
-        }
212
-    }
43
+		$querystring = 'INSERT INTO `log_emails` (`idticket`,`senddate`,`emailto`,`emailcc`, `emailbcc`,`emailsubject`,`message`, `emailstatus`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
44
+		$query = $this->db->prepare($querystring);
45
+		$query->bindValue(1, $idticket);
46
+		$query->bindValue(2, $slasenddate);
47
+		$query->bindValue(3, $emailto);
48
+		$query->bindValue(4, $emailcc);
49
+		$query->bindValue(5, $emailbcc);
50
+		$query->bindValue(6, $emailsubject);
51
+		$query->bindValue(7, $message);
52
+		$query->bindValue(8, 'SLA Remainder');
53
+
54
+		try {
55
+			$query->execute();
56
+		} catch (PDOException $e) {
57
+			die($e->getMessage());
58
+		}
59
+	}
60
+
61
+	public function update_status_email($idemail, $emailstatus)
62
+	{
63
+		$querystring = 'UPDATE `log_emails` SET `emailstatus` = ? WHERE `idemail` = ?';
64
+		$query = $this->db->prepare($querystring);
65
+		$query->bindValue(1, $emailstatus);
66
+		$query->bindValue(2, $idemail);
67
+
68
+		try {
69
+			$query->execute();
70
+		} catch (PDOException $e) {
71
+			die($e->getMessage());
72
+		}
73
+	}
74
+
75
+	public function delete($idemail)
76
+	{
77
+		$sql = 'DELETE FROM `log_emails` WHERE `idemail` = ?';
78
+		$query = $this->db->prepare($sql);
79
+		$query->bindValue(1, $idemail);
80
+
81
+		try {
82
+			$query->execute();
83
+		} catch (PDOException $e) {
84
+			die($e->getMessage());
85
+		}
86
+	}
87
+
88
+	public function get_email_by_idemail($idemail)
89
+	{
90
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
91
+		$query->bindValue(1, $idemail);
92
+
93
+		try {
94
+			$query->execute();
95
+
96
+			return $query->fetch();
97
+		} catch (PDOException $e) {
98
+			die($e->getMessage());
99
+		}
100
+	}
101
+
102
+	public function get_email_by_idticket($idticket)
103
+	{
104
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idticket`= ?');
105
+		$query->bindValue(1, $idticket);
106
+
107
+		try {
108
+			$query->execute();
109
+
110
+			return $query->fetch();
111
+		} catch (PDOException $e) {
112
+			die($e->getMessage());
113
+		}
114
+	}
115
+
116
+	public function get_email_by_status($emailstatus)
117
+	{
118
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ?');
119
+		$query->bindValue(1, $emailstatus);
120
+
121
+		try {
122
+			$query->execute();
123
+		} catch (PDOException $e) {
124
+			die($e->getMessage());
125
+		}
126
+
127
+		return $query->fetchAll();
128
+	}
129
+
130
+	public function get_email_sla_remainder()
131
+	{
132
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `emailstatus`= ? and senddate <= UNIX_TIMESTAMP(NOW())');
133
+		$query->bindValue(1, 'SLA Remainder');
134
+
135
+		try {
136
+			$query->execute();
137
+		} catch (PDOException $e) {
138
+			die($e->getMessage());
139
+		}
140
+
141
+		return $query->fetchAll();
142
+	}
143
+
144
+	public function get_email()
145
+	{
146
+		$query = $this->db->prepare('SELECT * FROM `log_emails` ORDER BY `idemail` ASC');
147
+
148
+		try {
149
+			$query->execute();
150
+		} catch (PDOException $e) {
151
+			die($e->getMessage());
152
+		}
153
+
154
+		return $query->fetchAll();
155
+	}
156
+
157
+	public function get_email_queue()
158
+	{
159
+		$query = $this->db->prepare("SELECT * FROM `log_emails` WHERE `emailstatus` <> 'Sent' AND senddate <= UNIX_TIMESTAMP(NOW()) ORDER BY `senddate` ASC");
160
+
161
+		try {
162
+			$query->execute();
163
+		} catch (PDOException $e) {
164
+			die($e->getMessage());
165
+		}
166
+
167
+		return $query->fetchAll();
168
+	}
169
+
170
+	public function get_email_queue_by_id($idemail)
171
+	{
172
+		$query = $this->db->prepare('SELECT * FROM `log_emails` WHERE `idemail`= ?');
173
+		$query->bindValue(1, $idemail);
174
+
175
+		try {
176
+			$query->execute();
177
+
178
+			return $query->fetch();
179
+		} catch (PDOException $e) {
180
+			die($e->getMessage());
181
+		}
182
+	}
183
+
184
+	public function send_new_ticket()
185
+	{
186
+		if (substr(php_uname(), 0, 7) == 'Windows') {
187
+			//$cmd = "D:\mowes_portable\www\helpdesk\batch\sendnewticket.bat";
188
+			$cmd = "C:\xampp\htdocs\helpdesk\batch\sendnewticket.bat";
189
+			$WshShell = new COM('WScript.Shell');
190
+			$oExec = $WshShell->Run("cmd /C $cmd", 0, false);
191
+
192
+			return $oExec == 0 ? true : false;
193
+		} else {
194
+			$cmd = 'php /batch/sendnewticket.bat';
195
+			exec($cmd.' > /dev/null &');
196
+		}
197
+	}
198
+
199
+	public function send_sla_remainder()
200
+	{
201
+		if (substr(php_uname(), 0, 7) == 'Windows') {
202
+			//$cmd = "D:\mowes_portable\www\helpdesk\batch\sendslaremainder.bat";
203
+			$cmd = "C:\xampp\htdocs\helpdesk\batch\sendslaremainder.bat";
204
+			$WshShell = new COM('WScript.Shell');
205
+			$oExec = $WshShell->Run("cmd /C $cmd", 0, false);
206
+
207
+			return $oExec == 0 ? true : false;
208
+		} else {
209
+			$cmd = 'php /batch/sendslaremainder.bat';
210
+			exec($cmd.' > /dev/null &');
211
+		}
212
+	}
213 213
 }
Please login to merge, or discard this patch.
core/classes/Report.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -2,37 +2,37 @@
 block discarded – undo
2 2
 
3 3
 class Reports
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function data_report($idreport)
13
-    {
14
-        $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?');
15
-        $query->bindValue(1, $slaid);
16
-
17
-        try {
18
-            $query->execute();
19
-
20
-            return $query->fetch();
21
-        } catch (PDOException $e) {
22
-            die($e->getMessage());
23
-        }
24
-    }
25
-
26
-    public function data_report_002()
27
-    {
28
-        $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
29
-
30
-        try {
31
-            $query->execute();
32
-        } catch (PDOException $e) {
33
-            die($e->getMessage());
34
-        }
35
-
36
-        return $query->fetchAll();
37
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function data_report($idreport)
13
+	{
14
+		$query = $this->db->prepare('SELECT * FROM `tickets` WHERE `slaid`= ?');
15
+		$query->bindValue(1, $slaid);
16
+
17
+		try {
18
+			$query->execute();
19
+
20
+			return $query->fetch();
21
+		} catch (PDOException $e) {
22
+			die($e->getMessage());
23
+		}
24
+	}
25
+
26
+	public function data_report_002()
27
+	{
28
+		$query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
29
+
30
+		try {
31
+			$query->execute();
32
+		} catch (PDOException $e) {
33
+			die($e->getMessage());
34
+		}
35
+
36
+		return $query->fetchAll();
37
+	}
38 38
 }
Please login to merge, or discard this patch.
core/classes/General.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,24 +2,24 @@
 block discarded – undo
2 2
 
3 3
 class General
4 4
 {
5
-    public function logged_in()
6
-    {
7
-        return(isset($_SESSION['loginid'])) ? true : false;
8
-    }
5
+	public function logged_in()
6
+	{
7
+		return(isset($_SESSION['loginid'])) ? true : false;
8
+	}
9 9
 
10
-    public function logged_in_protect()
11
-    {
12
-        if ($this->logged_in() === true) {
13
-            header('Location: home.php');
14
-            exit();
15
-        }
16
-    }
10
+	public function logged_in_protect()
11
+	{
12
+		if ($this->logged_in() === true) {
13
+			header('Location: home.php');
14
+			exit();
15
+		}
16
+	}
17 17
 
18
-    public function logged_out_protect()
19
-    {
20
-        if ($this->logged_in() === false) {
21
-            header('Location: index.php');
22
-            exit();
23
-        }
24
-    }
18
+	public function logged_out_protect()
19
+	{
20
+		if ($this->logged_in() === false) {
21
+			header('Location: index.php');
22
+			exit();
23
+		}
24
+	}
25 25
 }
Please login to merge, or discard this patch.
core/classes/Customers.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -2,195 +2,195 @@
 block discarded – undo
2 2
 
3 3
 class Customers
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function customer_exists($customername)
13
-    {
14
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `customername`= ?');
15
-        $query->bindValue(1, $customername);
16
-
17
-        try {
18
-            $query->execute();
19
-            $rows = $query->fetchColumn();
20
-            if ($rows == 1) {
21
-                return true;
22
-            } else {
23
-                return false;
24
-            }
25
-        } catch (PDOException $e) {
26
-            die($e->getMessage());
27
-        }
28
-    }
29
-
30
-    public function email_exists($email)
31
-    {
32
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email`= ?');
33
-        $query->bindValue(1, $email);
34
-
35
-        try {
36
-            $query->execute();
37
-            $rows = $query->fetchColumn();
38
-            if ($rows == 1) {
39
-                return true;
40
-            } else {
41
-                return false;
42
-            }
43
-        } catch (PDOException $e) {
44
-            die($e->getMessage());
45
-        }
46
-    }
47
-
48
-    public function add_customer($namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct)
49
-    {
50
-        $time = time();
51
-        $ip = $_SERVER['REMOTE_ADDR'];
52
-        $query = $this->db->prepare('INSERT INTO `customers` (`namacustomer`, `alamat`, `Telp`, `email`, `PIC`,`selesperson`, `customerproduct`, `time`, `ip`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');
53
-        $query->bindValue(1, $namacustomer);
54
-        $query->bindValue(2, $alamat);
55
-        $query->bindValue(3, $Telp);
56
-        $query->bindValue(4, $email);
57
-        $query->bindValue(5, $PIC);
58
-        $query->bindValue(6, $selesperson);
59
-        $query->bindValue(7, $customerproduct);
60
-        $query->bindValue(8, $time);
61
-        $query->bindValue(9, $ip);
62
-
63
-        try {
64
-            $query->execute();
65
-        } catch (PDOException $e) {
66
-            die($e->getMessage());
67
-        }
68
-    }
69
-
70
-    public function update_customer($idcustomer, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct)
71
-    {
72
-        $time = time();
73
-        $ip = $_SERVER['REMOTE_ADDR'];
74
-        $query = $this->db->prepare('UPDATE `customers` SET `namacustomer` = ? , `alamat` = ? , `Telp` = ? , `email` = ? , `PIC` = ? , `selesperson` = ? ,`customerproduct` = ? ,`ip` = ? , `time` = ? WHERE `idcustomer` = ?');
75
-        $query->bindValue(1, $namacustomer);
76
-        $query->bindValue(2, $alamat);
77
-        $query->bindValue(3, $Telp);
78
-        $query->bindValue(4, $email);
79
-        $query->bindValue(5, $PIC);
80
-        $query->bindValue(6, $selesperson);
81
-        $query->bindValue(7, $customerproduct);
82
-        $query->bindValue(8, $ip);
83
-        $query->bindValue(9, $time);
84
-        $query->bindValue(10, $idcustomer);
85
-
86
-        try {
87
-            $query->execute();
88
-        } catch (PDOException $e) {
89
-            die($e->getMessage());
90
-        }
91
-    }
92
-
93
-    public function delete($id)
94
-    {
95
-        $sql = 'DELETE FROM `customers` WHERE `idcustomer` = ?';
96
-        $query = $this->db->prepare($sql);
97
-        $query->bindValue(1, $id);
98
-
99
-        try {
100
-            $query->execute();
101
-        } catch (PDOException $e) {
102
-            die($e->getMessage());
103
-        }
104
-    }
105
-
106
-    public function activate($email, $email_code)
107
-    {
108
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email` = ? AND `email_code` = ? AND `confirmed` = ?');
109
-        $query->bindValue(1, $email);
110
-        $query->bindValue(2, $email_code);
111
-        $query->bindValue(3, 0);
112
-
113
-        try {
114
-            $query->execute();
115
-            $rows = $query->fetchColumn();
116
-            if ($rows == 1) {
117
-                $query_2 = $this->db->prepare('UPDATE `customers` SET `confirmed` = ? WHERE `email` = ?');
118
-                $query_2->bindValue(1, 1);
119
-                $query_2->bindValue(2, $email);
120
-                $query_2->execute();
121
-
122
-                return true;
123
-            } else {
124
-                return false;
125
-            }
126
-        } catch (PDOException $e) {
127
-            die($e->getMessage());
128
-        }
129
-    }
130
-
131
-    public function email_confirmed($username)
132
-    {
133
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `username`= ? AND `confirmed` = ?');
134
-        $query->bindValue(1, $username);
135
-        $query->bindValue(2, 1);
136
-
137
-        try {
138
-            $query->execute();
139
-            $rows = $query->fetchColumn();
140
-            if ($rows == 1) {
141
-                return true;
142
-            } else {
143
-                return false;
144
-            }
145
-        } catch (PDOException $e) {
146
-            die($e->getMessage());
147
-        }
148
-    }
149
-
150
-    public function login_customer($username, $password)
151
-    {
152
-        $query = $this->db->prepare('SELECT `email`, `ticket_id` FROM `customers` WHERE `email` = ?');
153
-        $query->bindValue(1, $username);
154
-
155
-        try {
156
-            $query->execute();
157
-            $data = $query->fetch();
158
-            $stored_password = $data['password'];
159
-            $id = $data['id'];
160
-            if ($stored_password === sha1($password)) {
161
-                return $id;
162
-            } else {
163
-                return false;
164
-            }
165
-        } catch (PDOException $e) {
166
-            die($e->getMessage());
167
-        }
168
-    }
169
-
170
-    public function customer_data($id)
171
-    {
172
-        $query = $this->db->prepare('SELECT * FROM `customers` WHERE `idcustomer`= ?');
173
-        $query->bindValue(1, $id);
174
-
175
-        try {
176
-            $query->execute();
177
-
178
-            return $query->fetch();
179
-        } catch (PDOException $e) {
180
-            die($e->getMessage());
181
-        }
182
-    }
183
-
184
-    public function get_customers()
185
-    {
186
-        $query = $this->db->prepare('SELECT * FROM `customers` ORDER BY `namacustomer` ASC');
187
-
188
-        try {
189
-            $query->execute();
190
-        } catch (PDOException $e) {
191
-            die($e->getMessage());
192
-        }
193
-
194
-        return $query->fetchAll();
195
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function customer_exists($customername)
13
+	{
14
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `customername`= ?');
15
+		$query->bindValue(1, $customername);
16
+
17
+		try {
18
+			$query->execute();
19
+			$rows = $query->fetchColumn();
20
+			if ($rows == 1) {
21
+				return true;
22
+			} else {
23
+				return false;
24
+			}
25
+		} catch (PDOException $e) {
26
+			die($e->getMessage());
27
+		}
28
+	}
29
+
30
+	public function email_exists($email)
31
+	{
32
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email`= ?');
33
+		$query->bindValue(1, $email);
34
+
35
+		try {
36
+			$query->execute();
37
+			$rows = $query->fetchColumn();
38
+			if ($rows == 1) {
39
+				return true;
40
+			} else {
41
+				return false;
42
+			}
43
+		} catch (PDOException $e) {
44
+			die($e->getMessage());
45
+		}
46
+	}
47
+
48
+	public function add_customer($namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct)
49
+	{
50
+		$time = time();
51
+		$ip = $_SERVER['REMOTE_ADDR'];
52
+		$query = $this->db->prepare('INSERT INTO `customers` (`namacustomer`, `alamat`, `Telp`, `email`, `PIC`,`selesperson`, `customerproduct`, `time`, `ip`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');
53
+		$query->bindValue(1, $namacustomer);
54
+		$query->bindValue(2, $alamat);
55
+		$query->bindValue(3, $Telp);
56
+		$query->bindValue(4, $email);
57
+		$query->bindValue(5, $PIC);
58
+		$query->bindValue(6, $selesperson);
59
+		$query->bindValue(7, $customerproduct);
60
+		$query->bindValue(8, $time);
61
+		$query->bindValue(9, $ip);
62
+
63
+		try {
64
+			$query->execute();
65
+		} catch (PDOException $e) {
66
+			die($e->getMessage());
67
+		}
68
+	}
69
+
70
+	public function update_customer($idcustomer, $namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct)
71
+	{
72
+		$time = time();
73
+		$ip = $_SERVER['REMOTE_ADDR'];
74
+		$query = $this->db->prepare('UPDATE `customers` SET `namacustomer` = ? , `alamat` = ? , `Telp` = ? , `email` = ? , `PIC` = ? , `selesperson` = ? ,`customerproduct` = ? ,`ip` = ? , `time` = ? WHERE `idcustomer` = ?');
75
+		$query->bindValue(1, $namacustomer);
76
+		$query->bindValue(2, $alamat);
77
+		$query->bindValue(3, $Telp);
78
+		$query->bindValue(4, $email);
79
+		$query->bindValue(5, $PIC);
80
+		$query->bindValue(6, $selesperson);
81
+		$query->bindValue(7, $customerproduct);
82
+		$query->bindValue(8, $ip);
83
+		$query->bindValue(9, $time);
84
+		$query->bindValue(10, $idcustomer);
85
+
86
+		try {
87
+			$query->execute();
88
+		} catch (PDOException $e) {
89
+			die($e->getMessage());
90
+		}
91
+	}
92
+
93
+	public function delete($id)
94
+	{
95
+		$sql = 'DELETE FROM `customers` WHERE `idcustomer` = ?';
96
+		$query = $this->db->prepare($sql);
97
+		$query->bindValue(1, $id);
98
+
99
+		try {
100
+			$query->execute();
101
+		} catch (PDOException $e) {
102
+			die($e->getMessage());
103
+		}
104
+	}
105
+
106
+	public function activate($email, $email_code)
107
+	{
108
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `email` = ? AND `email_code` = ? AND `confirmed` = ?');
109
+		$query->bindValue(1, $email);
110
+		$query->bindValue(2, $email_code);
111
+		$query->bindValue(3, 0);
112
+
113
+		try {
114
+			$query->execute();
115
+			$rows = $query->fetchColumn();
116
+			if ($rows == 1) {
117
+				$query_2 = $this->db->prepare('UPDATE `customers` SET `confirmed` = ? WHERE `email` = ?');
118
+				$query_2->bindValue(1, 1);
119
+				$query_2->bindValue(2, $email);
120
+				$query_2->execute();
121
+
122
+				return true;
123
+			} else {
124
+				return false;
125
+			}
126
+		} catch (PDOException $e) {
127
+			die($e->getMessage());
128
+		}
129
+	}
130
+
131
+	public function email_confirmed($username)
132
+	{
133
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `customers` WHERE `username`= ? AND `confirmed` = ?');
134
+		$query->bindValue(1, $username);
135
+		$query->bindValue(2, 1);
136
+
137
+		try {
138
+			$query->execute();
139
+			$rows = $query->fetchColumn();
140
+			if ($rows == 1) {
141
+				return true;
142
+			} else {
143
+				return false;
144
+			}
145
+		} catch (PDOException $e) {
146
+			die($e->getMessage());
147
+		}
148
+	}
149
+
150
+	public function login_customer($username, $password)
151
+	{
152
+		$query = $this->db->prepare('SELECT `email`, `ticket_id` FROM `customers` WHERE `email` = ?');
153
+		$query->bindValue(1, $username);
154
+
155
+		try {
156
+			$query->execute();
157
+			$data = $query->fetch();
158
+			$stored_password = $data['password'];
159
+			$id = $data['id'];
160
+			if ($stored_password === sha1($password)) {
161
+				return $id;
162
+			} else {
163
+				return false;
164
+			}
165
+		} catch (PDOException $e) {
166
+			die($e->getMessage());
167
+		}
168
+	}
169
+
170
+	public function customer_data($id)
171
+	{
172
+		$query = $this->db->prepare('SELECT * FROM `customers` WHERE `idcustomer`= ?');
173
+		$query->bindValue(1, $id);
174
+
175
+		try {
176
+			$query->execute();
177
+
178
+			return $query->fetch();
179
+		} catch (PDOException $e) {
180
+			die($e->getMessage());
181
+		}
182
+	}
183
+
184
+	public function get_customers()
185
+	{
186
+		$query = $this->db->prepare('SELECT * FROM `customers` ORDER BY `namacustomer` ASC');
187
+
188
+		try {
189
+			$query->execute();
190
+		} catch (PDOException $e) {
191
+			die($e->getMessage());
192
+		}
193
+
194
+		return $query->fetchAll();
195
+	}
196 196
 }
Please login to merge, or discard this patch.
core/classes/Projects.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -2,133 +2,133 @@
 block discarded – undo
2 2
 
3 3
 class Projects
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function project_exists($projectid)
13
-    {
14
-        $query = $this->db->prepare('SELECT COUNT(`id`) FROM `projects` WHERE `projectid`= ?');
15
-        $query->bindValue(1, $projectid);
16
-
17
-        try {
18
-            $query->execute();
19
-            $rows = $query->fetchColumn();
20
-            if ($rows == 1) {
21
-                return true;
22
-            } else {
23
-                return false;
24
-            }
25
-        } catch (PDOException $e) {
26
-            die($e->getMessage());
27
-        }
28
-    }
29
-
30
-    public function add_project($projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod)
31
-    {
32
-        $querystring = 'INSERT INTO `projects` (`projectname`,`idcustomer`, `deliverybegin`, `deliveryend`, `installbegin`, `installend`,`uatbegin`,`uatend`,`billstartdate`, `billduedate`, `warrantyperiod`, `contractstartdate`, `contractperiod`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
33
-        $query = $this->db->prepare($querystring);
34
-        $query->bindValue(1, $projectname);
35
-        $query->bindValue(2, $idcustomer);
36
-        $query->bindValue(3, $deliverybegin);
37
-        $query->bindValue(4, $deliveryend);
38
-        $query->bindValue(5, $installbegin);
39
-        $query->bindValue(6, $installend);
40
-        $query->bindValue(7, $uatbegin);
41
-        $query->bindValue(8, $uatend);
42
-        $query->bindValue(9, $billstartdate);
43
-        $query->bindValue(10, $billduedate);
44
-        $query->bindValue(11, $warrantyperiod);
45
-        $query->bindValue(12, $contractstartdate);
46
-        $query->bindValue(13, $contractperiod);
47
-
48
-        try {
49
-            $query->execute();
50
-        } catch (PDOException $e) {
51
-            die($e->getMessage());
52
-        }
53
-    }
54
-
55
-    public function update_project($projectid, $projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod)
56
-    {
57
-        $querystring = 'UPDATE `projects` SET `projectname` = ? , `idcustomer` = ? , `deliverybegin` = ? , `deliveryend` = ? , `installbegin` = ? ,`installend` = ? , `uatbegin` = ? , `uatend` = ? ,`billstartdate` = ?, `billduedate` = ? , `warrantyperiod` = ? ,`contractstartdate` = ?,`contractperiod` = ? WHERE `projectid` = ?';
58
-        $query = $this->db->prepare($querystring);
59
-        $query->bindValue(1, $projectname);
60
-        $query->bindValue(2, $idcustomer);
61
-        $query->bindValue(3, $deliverybegin);
62
-        $query->bindValue(4, $deliveryend);
63
-        $query->bindValue(5, $installbegin);
64
-        $query->bindValue(6, $installend);
65
-        $query->bindValue(7, $uatbegin);
66
-        $query->bindValue(8, $uatend);
67
-        $query->bindValue(9, $billstartdate);
68
-        $query->bindValue(10, $billduedate);
69
-        $query->bindValue(11, $warrantyperiod);
70
-        $query->bindValue(12, $contractstartdate);
71
-        $query->bindValue(13, $contractperiod);
72
-        $query->bindValue(14, $projectid);
73
-
74
-        try {
75
-            $query->execute();
76
-        } catch (PDOException $e) {
77
-            die($e->getMessage());
78
-        }
79
-    }
80
-
81
-    public function delete($id)
82
-    {
83
-        $sql = 'DELETE FROM `projects` WHERE `projectid` = ?';
84
-        $query = $this->db->prepare($sql);
85
-        $query->bindValue(1, $id);
86
-
87
-        try {
88
-            $query->execute();
89
-        } catch (PDOException $e) {
90
-            die($e->getMessage());
91
-        }
92
-    }
93
-
94
-    public function project_data($id)
95
-    {
96
-        $query = $this->db->prepare('SELECT * FROM `projects` WHERE `projectid`= ?');
97
-        $query->bindValue(1, $id);
98
-
99
-        try {
100
-            $query->execute();
101
-
102
-            return $query->fetch();
103
-        } catch (PDOException $e) {
104
-            die($e->getMessage());
105
-        }
106
-    }
107
-
108
-    public function get_projects()
109
-    {
110
-        $query = $this->db->prepare('SELECT * FROM `projects` ORDER BY `projectid` DESC');
111
-
112
-        try {
113
-            $query->execute();
114
-        } catch (PDOException $e) {
115
-            die($e->getMessage());
116
-        }
117
-
118
-        return $query->fetchAll();
119
-    }
120
-
121
-    public function get_project_customer($id) //get project_data by idcustomer
122
-    {
123
-        $query = $this->db->prepare('SELECT * FROM `projects` WHERE `idcustomer`= ? ORDER BY `contractstartdate` DESC LIMIT 1');
124
-        $query->bindValue(1, $id);
125
-
126
-        try {
127
-            $query->execute();
128
-
129
-            return $query->fetch();
130
-        } catch (PDOException $e) {
131
-            die($e->getMessage());
132
-        }
133
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function project_exists($projectid)
13
+	{
14
+		$query = $this->db->prepare('SELECT COUNT(`id`) FROM `projects` WHERE `projectid`= ?');
15
+		$query->bindValue(1, $projectid);
16
+
17
+		try {
18
+			$query->execute();
19
+			$rows = $query->fetchColumn();
20
+			if ($rows == 1) {
21
+				return true;
22
+			} else {
23
+				return false;
24
+			}
25
+		} catch (PDOException $e) {
26
+			die($e->getMessage());
27
+		}
28
+	}
29
+
30
+	public function add_project($projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod)
31
+	{
32
+		$querystring = 'INSERT INTO `projects` (`projectname`,`idcustomer`, `deliverybegin`, `deliveryend`, `installbegin`, `installend`,`uatbegin`,`uatend`,`billstartdate`, `billduedate`, `warrantyperiod`, `contractstartdate`, `contractperiod`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
33
+		$query = $this->db->prepare($querystring);
34
+		$query->bindValue(1, $projectname);
35
+		$query->bindValue(2, $idcustomer);
36
+		$query->bindValue(3, $deliverybegin);
37
+		$query->bindValue(4, $deliveryend);
38
+		$query->bindValue(5, $installbegin);
39
+		$query->bindValue(6, $installend);
40
+		$query->bindValue(7, $uatbegin);
41
+		$query->bindValue(8, $uatend);
42
+		$query->bindValue(9, $billstartdate);
43
+		$query->bindValue(10, $billduedate);
44
+		$query->bindValue(11, $warrantyperiod);
45
+		$query->bindValue(12, $contractstartdate);
46
+		$query->bindValue(13, $contractperiod);
47
+
48
+		try {
49
+			$query->execute();
50
+		} catch (PDOException $e) {
51
+			die($e->getMessage());
52
+		}
53
+	}
54
+
55
+	public function update_project($projectid, $projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod)
56
+	{
57
+		$querystring = 'UPDATE `projects` SET `projectname` = ? , `idcustomer` = ? , `deliverybegin` = ? , `deliveryend` = ? , `installbegin` = ? ,`installend` = ? , `uatbegin` = ? , `uatend` = ? ,`billstartdate` = ?, `billduedate` = ? , `warrantyperiod` = ? ,`contractstartdate` = ?,`contractperiod` = ? WHERE `projectid` = ?';
58
+		$query = $this->db->prepare($querystring);
59
+		$query->bindValue(1, $projectname);
60
+		$query->bindValue(2, $idcustomer);
61
+		$query->bindValue(3, $deliverybegin);
62
+		$query->bindValue(4, $deliveryend);
63
+		$query->bindValue(5, $installbegin);
64
+		$query->bindValue(6, $installend);
65
+		$query->bindValue(7, $uatbegin);
66
+		$query->bindValue(8, $uatend);
67
+		$query->bindValue(9, $billstartdate);
68
+		$query->bindValue(10, $billduedate);
69
+		$query->bindValue(11, $warrantyperiod);
70
+		$query->bindValue(12, $contractstartdate);
71
+		$query->bindValue(13, $contractperiod);
72
+		$query->bindValue(14, $projectid);
73
+
74
+		try {
75
+			$query->execute();
76
+		} catch (PDOException $e) {
77
+			die($e->getMessage());
78
+		}
79
+	}
80
+
81
+	public function delete($id)
82
+	{
83
+		$sql = 'DELETE FROM `projects` WHERE `projectid` = ?';
84
+		$query = $this->db->prepare($sql);
85
+		$query->bindValue(1, $id);
86
+
87
+		try {
88
+			$query->execute();
89
+		} catch (PDOException $e) {
90
+			die($e->getMessage());
91
+		}
92
+	}
93
+
94
+	public function project_data($id)
95
+	{
96
+		$query = $this->db->prepare('SELECT * FROM `projects` WHERE `projectid`= ?');
97
+		$query->bindValue(1, $id);
98
+
99
+		try {
100
+			$query->execute();
101
+
102
+			return $query->fetch();
103
+		} catch (PDOException $e) {
104
+			die($e->getMessage());
105
+		}
106
+	}
107
+
108
+	public function get_projects()
109
+	{
110
+		$query = $this->db->prepare('SELECT * FROM `projects` ORDER BY `projectid` DESC');
111
+
112
+		try {
113
+			$query->execute();
114
+		} catch (PDOException $e) {
115
+			die($e->getMessage());
116
+		}
117
+
118
+		return $query->fetchAll();
119
+	}
120
+
121
+	public function get_project_customer($id) //get project_data by idcustomer
122
+	{
123
+		$query = $this->db->prepare('SELECT * FROM `projects` WHERE `idcustomer`= ? ORDER BY `contractstartdate` DESC LIMIT 1');
124
+		$query->bindValue(1, $id);
125
+
126
+		try {
127
+			$query->execute();
128
+
129
+			return $query->fetch();
130
+		} catch (PDOException $e) {
131
+			die($e->getMessage());
132
+		}
133
+	}
134 134
 }
Please login to merge, or discard this patch.
core/classes/SLA.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -2,102 +2,102 @@
 block discarded – undo
2 2
 
3 3
 class SLA
4 4
 {
5
-    private $db;
6
-
7
-    public function __construct($database)
8
-    {
9
-        $this->db = $database;
10
-    }
11
-
12
-    public function sla_exists($slaid)
13
-    {
14
-        $query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?');
15
-        $query->bindValue(1, $slaid);
16
-
17
-        try {
18
-            $query->execute();
19
-            $rows = $query->fetchColumn();
20
-            if ($rows == 1) {
21
-                return true;
22
-            } else {
23
-                return false;
24
-            }
25
-        } catch (PDOException $e) {
26
-            die($e->getMessage());
27
-        }
28
-    }
29
-
30
-    public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
31
-    {
32
-        $querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)';
33
-        $query = $this->db->prepare($querystring);
34
-        $query->bindValue(1, $slaid);
35
-        $query->bindValue(2, $namasla);
36
-        $query->bindValue(3, $responsetime);
37
-        $query->bindValue(4, $resolutiontime);
38
-        $query->bindValue(5, $slawarning);
39
-
40
-        try {
41
-            $query->execute();
42
-        } catch (PDOException $e) {
43
-            die($e->getMessage());
44
-        }
45
-    }
46
-
47
-    public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
48
-    {
49
-        $querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ?  WHERE `slaid` = ?';
50
-        $query = $this->db->prepare($querystring);
51
-        $query->bindValue(1, $namasla);
52
-        $query->bindValue(2, $responsetime);
53
-        $query->bindValue(3, $resolutiontime);
54
-        $query->bindValue(4, $slawarning);
55
-        $query->bindValue(5, $slaid);
56
-
57
-        try {
58
-            $query->execute();
59
-        } catch (PDOException $e) {
60
-            die($e->getMessage());
61
-        }
62
-    }
63
-
64
-    public function delete($id)
65
-    {
66
-        $sql = 'DELETE FROM `sla` WHERE `slaid` = ?';
67
-        $query = $this->db->prepare($sql);
68
-        $query->bindValue(1, $id);
69
-
70
-        try {
71
-            $query->execute();
72
-        } catch (PDOException $e) {
73
-            die($e->getMessage());
74
-        }
75
-    }
76
-
77
-    public function sla_data($slaid)
78
-    {
79
-        $query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?');
80
-        $query->bindValue(1, $slaid);
81
-
82
-        try {
83
-            $query->execute();
84
-
85
-            return $query->fetch();
86
-        } catch (PDOException $e) {
87
-            die($e->getMessage());
88
-        }
89
-    }
90
-
91
-    public function get_sla()
92
-    {
93
-        $query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
94
-
95
-        try {
96
-            $query->execute();
97
-        } catch (PDOException $e) {
98
-            die($e->getMessage());
99
-        }
100
-
101
-        return $query->fetchAll();
102
-    }
5
+	private $db;
6
+
7
+	public function __construct($database)
8
+	{
9
+		$this->db = $database;
10
+	}
11
+
12
+	public function sla_exists($slaid)
13
+	{
14
+		$query = $this->db->prepare('SELECT COUNT(`slaid`) FROM `sla` WHERE `slaid`= ?');
15
+		$query->bindValue(1, $slaid);
16
+
17
+		try {
18
+			$query->execute();
19
+			$rows = $query->fetchColumn();
20
+			if ($rows == 1) {
21
+				return true;
22
+			} else {
23
+				return false;
24
+			}
25
+		} catch (PDOException $e) {
26
+			die($e->getMessage());
27
+		}
28
+	}
29
+
30
+	public function add_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
31
+	{
32
+		$querystring = 'INSERT INTO `sla` (`slaid`,`namasla`,`responsetime`, `resolutiontime`, `slawarning`) VALUES (?, ?, ?, ?, ?)';
33
+		$query = $this->db->prepare($querystring);
34
+		$query->bindValue(1, $slaid);
35
+		$query->bindValue(2, $namasla);
36
+		$query->bindValue(3, $responsetime);
37
+		$query->bindValue(4, $resolutiontime);
38
+		$query->bindValue(5, $slawarning);
39
+
40
+		try {
41
+			$query->execute();
42
+		} catch (PDOException $e) {
43
+			die($e->getMessage());
44
+		}
45
+	}
46
+
47
+	public function update_sla($slaid, $namasla, $responsetime, $resolutiontime, $slawarning)
48
+	{
49
+		$querystring = 'UPDATE `sla` SET `namasla` = ? , `responsetime` = ? , `resolutiontime` = ?, `slawarning` = ?  WHERE `slaid` = ?';
50
+		$query = $this->db->prepare($querystring);
51
+		$query->bindValue(1, $namasla);
52
+		$query->bindValue(2, $responsetime);
53
+		$query->bindValue(3, $resolutiontime);
54
+		$query->bindValue(4, $slawarning);
55
+		$query->bindValue(5, $slaid);
56
+
57
+		try {
58
+			$query->execute();
59
+		} catch (PDOException $e) {
60
+			die($e->getMessage());
61
+		}
62
+	}
63
+
64
+	public function delete($id)
65
+	{
66
+		$sql = 'DELETE FROM `sla` WHERE `slaid` = ?';
67
+		$query = $this->db->prepare($sql);
68
+		$query->bindValue(1, $id);
69
+
70
+		try {
71
+			$query->execute();
72
+		} catch (PDOException $e) {
73
+			die($e->getMessage());
74
+		}
75
+	}
76
+
77
+	public function sla_data($slaid)
78
+	{
79
+		$query = $this->db->prepare('SELECT * FROM `sla` WHERE `slaid`= ?');
80
+		$query->bindValue(1, $slaid);
81
+
82
+		try {
83
+			$query->execute();
84
+
85
+			return $query->fetch();
86
+		} catch (PDOException $e) {
87
+			die($e->getMessage());
88
+		}
89
+	}
90
+
91
+	public function get_sla()
92
+	{
93
+		$query = $this->db->prepare('SELECT * FROM `sla` ORDER BY `slaid` ASC');
94
+
95
+		try {
96
+			$query->execute();
97
+		} catch (PDOException $e) {
98
+			die($e->getMessage());
99
+		}
100
+
101
+		return $query->fetchAll();
102
+	}
103 103
 }
Please login to merge, or discard this patch.
core/connect/database.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $config = [
4
-    'host'		    => 'localhost',
5
-    'username' 	=> 'root',
6
-    'password' 	=> 'root',
7
-    'dbname' 	  => 'helpdesk',
4
+	'host'		    => 'localhost',
5
+	'username' 	=> 'root',
6
+	'password' 	=> 'root',
7
+	'dbname' 	  => 'helpdesk',
8 8
 ];
9 9
 
10 10
 $db = new PDO('mysql:host='.$config['host'].';dbname='.$config['dbname'], $config['username'], $config['password']);
Please login to merge, or discard this patch.
core/init.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@
 block discarded – undo
5 5
 require_once 'connect/database.php';
6 6
 function my_autoload($class)
7 7
 {
8
-    $filename = 'classes/'.$class.'.php';
9
-    include_once $filename;
8
+	$filename = 'classes/'.$class.'.php';
9
+	include_once $filename;
10 10
 }
11 11
 spl_autoload_register('my_autoload');
12 12
 
13 13
 try {
14
-    $general = new General();
15
-    $users = new Users($db);
16
-    $customers = new Customers($db);
17
-    $projects = new Projects($db);
18
-    $tickets = new Tickets($db);
19
-    $hdnews = new HDNews($db);
20
-    $slas = new SLA($db);
21
-    $emails = new Emails($db);
14
+	$general = new General();
15
+	$users = new Users($db);
16
+	$customers = new Customers($db);
17
+	$projects = new Projects($db);
18
+	$tickets = new Tickets($db);
19
+	$hdnews = new HDNews($db);
20
+	$slas = new SLA($db);
21
+	$emails = new Emails($db);
22 22
 } catch (Exception $e) {
23
-    echo 'Caught exception: ',  $e->getMessage(), "\n";
23
+	echo 'Caught exception: ',  $e->getMessage(), "\n";
24 24
 }
Please login to merge, or discard this patch.