@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -class Reports{
|
|
| 2 | +class Reports {
|
|
| 3 | 3 | private $db; |
| 4 | 4 | public function __construct($database) |
| 5 | 5 | { $this->db = $database; }
|
@@ -7,19 +7,19 @@ discard block |
||
| 7 | 7 | public function data_report($idreport) |
| 8 | 8 | { $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `slaid`= ?");
|
| 9 | 9 | $query->bindValue(1, $slaid); |
| 10 | - try{
|
|
| 10 | + try {
|
|
| 11 | 11 | $query->execute(); |
| 12 | 12 | return $query->fetch(); |
| 13 | - } catch(PDOException $e){
|
|
| 13 | + }catch (PDOException $e) {
|
|
| 14 | 14 | die($e->getMessage()); |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function data_report_002() |
| 19 | 19 | { $query = $this->db->prepare("SELECT * FROM `sla` ORDER BY `slaid` ASC");
|
| 20 | - try{
|
|
| 20 | + try {
|
|
| 21 | 21 | $query->execute(); |
| 22 | - }catch(PDOException $e){
|
|
| 22 | + }catch (PDOException $e) {
|
|
| 23 | 23 | die($e->getMessage()); |
| 24 | 24 | } |
| 25 | 25 | return $query->fetchAll(); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { $query = $this->db->prepare("SELECT * FROM `sla` ORDER BY `slaid` ASC");
|
| 20 | 20 | try{
|
| 21 | 21 | $query->execute(); |
| 22 | - }catch(PDOException $e){
|
|
| 22 | + } catch(PDOException $e){
|
|
| 23 | 23 | die($e->getMessage()); |
| 24 | 24 | } |
| 25 | 25 | return $query->fetchAll(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -class Projects{
|
|
| 2 | +class Projects {
|
|
| 3 | 3 | private $db; |
| 4 | 4 | public function __construct($database) |
| 5 | 5 | { $this->db = $database; }
|
@@ -9,18 +9,18 @@ discard block |
||
| 9 | 9 | try |
| 10 | 10 | { $query->execute();
|
| 11 | 11 | $rows = $query->fetchColumn(); |
| 12 | - if($rows == 1){
|
|
| 12 | + if ($rows == 1) {
|
|
| 13 | 13 | return true; |
| 14 | - }else{
|
|
| 14 | + }else {
|
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | - } catch (PDOException $e){
|
|
| 17 | + }catch (PDOException $e) {
|
|
| 18 | 18 | die($e->getMessage()); |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | - public function add_project($projectname,$idcustomer,$deliverybegin,$deliveryend,$installbegin,$installend,$uatbegin,$uatend,$billstartdate,$billduedate,$warrantyperiod,$contractstartdate,$contractperiod) |
|
| 21 | + public function add_project($projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
| 22 | 22 | { $querystring = "INSERT INTO `projects` (`projectname`,`idcustomer`, `deliverybegin`, `deliveryend`, `installbegin`, `installend`,`uatbegin`,`uatend`,`billstartdate`, `billduedate`, `warrantyperiod`, `contractstartdate`, `contractperiod`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
| 23 | - $query = $this->db->prepare($querystring); |
|
| 23 | + $query = $this->db->prepare($querystring); |
|
| 24 | 24 | $query->bindValue(1, $projectname); |
| 25 | 25 | $query->bindValue(2, $idcustomer); |
| 26 | 26 | $query->bindValue(3, $deliverybegin); |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | $query->bindValue(11, $warrantyperiod); |
| 35 | 35 | $query->bindValue(12, $contractstartdate); |
| 36 | 36 | $query->bindValue(13, $contractperiod); |
| 37 | - try{
|
|
| 37 | + try {
|
|
| 38 | 38 | $query->execute(); |
| 39 | - }catch(PDOException $e){
|
|
| 39 | + }catch (PDOException $e) {
|
|
| 40 | 40 | die($e->getMessage()); |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | - public function update_project ($projectid,$projectname,$idcustomer,$deliverybegin,$deliveryend,$installbegin,$installend,$uatbegin,$uatend,$billstartdate,$billduedate,$warrantyperiod,$contractstartdate,$contractperiod) |
|
| 43 | + public function update_project($projectid, $projectname, $idcustomer, $deliverybegin, $deliveryend, $installbegin, $installend, $uatbegin, $uatend, $billstartdate, $billduedate, $warrantyperiod, $contractstartdate, $contractperiod) |
|
| 44 | 44 | { $querystring = "UPDATE `projects` SET `projectname` = ? , `idcustomer` = ? , `deliverybegin` = ? , `deliveryend` = ? , `installbegin` = ? ,`installend` = ? , `uatbegin` = ? , `uatend` = ? ,`billstartdate` = ?, `billduedate` = ? , `warrantyperiod` = ? ,`contractstartdate` = ?,`contractperiod` = ? WHERE `projectid` = ?";
|
| 45 | - $query = $this->db->prepare($querystring); |
|
| 45 | + $query = $this->db->prepare($querystring); |
|
| 46 | 46 | $query->bindValue(1, $projectname); |
| 47 | 47 | $query->bindValue(2, $idcustomer); |
| 48 | 48 | $query->bindValue(3, $deliverybegin); |
@@ -57,40 +57,40 @@ discard block |
||
| 57 | 57 | $query->bindValue(12, $contractstartdate); |
| 58 | 58 | $query->bindValue(13, $contractperiod); |
| 59 | 59 | $query->bindValue(14, $projectid); |
| 60 | - try{
|
|
| 60 | + try {
|
|
| 61 | 61 | $query->execute(); |
| 62 | 62 | } |
| 63 | - catch(PDOException $e){
|
|
| 63 | + catch (PDOException $e) {
|
|
| 64 | 64 | die($e->getMessage()); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
| 68 | - public function delete($id){
|
|
| 69 | - $sql="DELETE FROM `projects` WHERE `projectid` = ?"; |
|
| 68 | + public function delete($id) {
|
|
| 69 | + $sql = "DELETE FROM `projects` WHERE `projectid` = ?"; |
|
| 70 | 70 | $query = $this->db->prepare($sql); |
| 71 | 71 | $query->bindValue(1, $id); |
| 72 | - try{
|
|
| 72 | + try {
|
|
| 73 | 73 | $query->execute(); |
| 74 | 74 | } |
| 75 | - catch(PDOException $e){
|
|
| 75 | + catch (PDOException $e) {
|
|
| 76 | 76 | die($e->getMessage()); |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | public function project_data($id) |
| 80 | 80 | { $query = $this->db->prepare("SELECT * FROM `projects` WHERE `projectid`= ?");
|
| 81 | 81 | $query->bindValue(1, $id); |
| 82 | - try{
|
|
| 82 | + try {
|
|
| 83 | 83 | $query->execute(); |
| 84 | 84 | return $query->fetch(); |
| 85 | - } catch(PDOException $e){
|
|
| 85 | + }catch (PDOException $e) {
|
|
| 86 | 86 | die($e->getMessage()); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | public function get_projects() |
| 90 | 90 | { $query = $this->db->prepare("SELECT * FROM `projects` ORDER BY `projectid` DESC");
|
| 91 | - try{
|
|
| 91 | + try {
|
|
| 92 | 92 | $query->execute(); |
| 93 | - }catch(PDOException $e){
|
|
| 93 | + }catch (PDOException $e) {
|
|
| 94 | 94 | die($e->getMessage()); |
| 95 | 95 | } |
| 96 | 96 | return $query->fetchAll(); |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | public function get_project_customer($id) //get project_data by idcustomer |
| 99 | 99 | { $query = $this->db->prepare("SELECT * FROM `projects` WHERE `idcustomer`= ? ORDER BY `contractstartdate` DESC LIMIT 1");
|
| 100 | 100 | $query->bindValue(1, $id); |
| 101 | - try{
|
|
| 101 | + try {
|
|
| 102 | 102 | $query->execute(); |
| 103 | 103 | return $query->fetch(); |
| 104 | - } catch(PDOException $e){
|
|
| 104 | + }catch (PDOException $e) {
|
|
| 105 | 105 | die($e->getMessage()); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | $rows = $query->fetchColumn(); |
| 12 | 12 | if($rows == 1){
|
| 13 | 13 | return true; |
| 14 | - }else{
|
|
| 14 | + } else{
|
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | } catch (PDOException $e){
|
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $query->bindValue(13, $contractperiod); |
| 37 | 37 | try{
|
| 38 | 38 | $query->execute(); |
| 39 | - }catch(PDOException $e){
|
|
| 39 | + } catch(PDOException $e){
|
|
| 40 | 40 | die($e->getMessage()); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | $query->bindValue(14, $projectid); |
| 60 | 60 | try{
|
| 61 | 61 | $query->execute(); |
| 62 | - } |
|
| 63 | - catch(PDOException $e){
|
|
| 62 | + } catch(PDOException $e){
|
|
| 64 | 63 | die($e->getMessage()); |
| 65 | 64 | } |
| 66 | 65 | |
@@ -71,8 +70,7 @@ discard block |
||
| 71 | 70 | $query->bindValue(1, $id); |
| 72 | 71 | try{
|
| 73 | 72 | $query->execute(); |
| 74 | - } |
|
| 75 | - catch(PDOException $e){
|
|
| 73 | + } catch(PDOException $e){
|
|
| 76 | 74 | die($e->getMessage()); |
| 77 | 75 | } |
| 78 | 76 | } |
@@ -90,7 +88,7 @@ discard block |
||
| 90 | 88 | { $query = $this->db->prepare("SELECT * FROM `projects` ORDER BY `projectid` DESC");
|
| 91 | 89 | try{
|
| 92 | 90 | $query->execute(); |
| 93 | - }catch(PDOException $e){
|
|
| 91 | + } catch(PDOException $e){
|
|
| 94 | 92 | die($e->getMessage()); |
| 95 | 93 | } |
| 96 | 94 | return $query->fetchAll(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -class Users{
|
|
| 2 | +class Users {
|
|
| 3 | 3 | private $db; |
| 4 | 4 | public function __construct($database) |
| 5 | 5 | { $this->db = $database; }
|
@@ -9,36 +9,36 @@ discard block |
||
| 9 | 9 | try |
| 10 | 10 | { $query->execute();
|
| 11 | 11 | $rows = $query->fetchColumn(); |
| 12 | - if($rows == 1){
|
|
| 12 | + if ($rows == 1) {
|
|
| 13 | 13 | return true; |
| 14 | - }else{
|
|
| 14 | + }else {
|
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | - } catch (PDOException $e){
|
|
| 17 | + }catch (PDOException $e) {
|
|
| 18 | 18 | die($e->getMessage()); |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | public function email_exists($email) |
| 22 | 22 | { $query = $this->db->prepare("SELECT COUNT(`id`) FROM `users` WHERE `email`= ?");
|
| 23 | 23 | $query->bindValue(1, $email); |
| 24 | - try{
|
|
| 24 | + try {
|
|
| 25 | 25 | $query->execute(); |
| 26 | 26 | $rows = $query->fetchColumn(); |
| 27 | - if($rows == 1){
|
|
| 27 | + if ($rows == 1) {
|
|
| 28 | 28 | return true; |
| 29 | - }else{
|
|
| 29 | + }else {
|
|
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | - } catch (PDOException $e){
|
|
| 32 | + }catch (PDOException $e) {
|
|
| 33 | 33 | die($e->getMessage()); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | - public function register($username,$password,$email,$fullname,$Telp,$level,$locked) |
|
| 37 | - { $time = time();
|
|
| 38 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 36 | + public function register($username, $password, $email, $fullname, $Telp, $level, $locked) |
|
| 37 | + { $time = time();
|
|
| 38 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 39 | 39 | $email_code = sha1($username + microtime()); |
| 40 | 40 | $password = sha1($password); |
| 41 | - $query = $this->db->prepare("INSERT INTO `users` (`username`,`level`, `password`, `fullname`, `email`, `Telp`,`ip`, `time`, `email_code`, `confirmed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)");
|
|
| 41 | + $query = $this->db->prepare("INSERT INTO `users` (`username`,`level`, `password`, `fullname`, `email`, `Telp`,`ip`, `time`, `email_code`, `confirmed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)");
|
|
| 42 | 42 | $query->bindValue(1, $username); |
| 43 | 43 | $query->bindValue(2, $level); |
| 44 | 44 | $query->bindValue(3, $password); |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | $query->bindValue(8, $time); |
| 50 | 50 | $query->bindValue(9, $email_code); |
| 51 | 51 | $query->bindValue(10, 1); |
| 52 | - try{
|
|
| 52 | + try {
|
|
| 53 | 53 | $query->execute(); |
| 54 | - }catch(PDOException $e){
|
|
| 54 | + }catch (PDOException $e) {
|
|
| 55 | 55 | die($e->getMessage()); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | - public function update($id,$username,$password,$email,$fullname,$Telp,$level,$locked) |
|
| 59 | - { $time = time();
|
|
| 60 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 58 | + public function update($id, $username, $password, $email, $fullname, $Telp, $level, $locked) |
|
| 59 | + { $time = time();
|
|
| 60 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 61 | 61 | $email_code = sha1($username + microtime()); |
| 62 | 62 | $password = sha1($password); |
| 63 | - $query = $this->db->prepare("UPDATE `users` SET `level` = ? , `password` = ? , `fullname` = ? , `email` = ? , `Telp` = ? ,`ip` = ? , `time` = ? , `email_code` = ? ,`confirmed` = ? WHERE `id` = ?");
|
|
| 63 | + $query = $this->db->prepare("UPDATE `users` SET `level` = ? , `password` = ? , `fullname` = ? , `email` = ? , `Telp` = ? ,`ip` = ? , `time` = ? , `email_code` = ? ,`confirmed` = ? WHERE `id` = ?");
|
|
| 64 | 64 | $query->bindValue(1, $level); |
| 65 | 65 | $query->bindValue(2, $password); |
| 66 | 66 | $query->bindValue(3, $fullname); |
@@ -71,33 +71,33 @@ discard block |
||
| 71 | 71 | $query->bindValue(8, $email_code); |
| 72 | 72 | $query->bindValue(9, $locked); |
| 73 | 73 | $query->bindValue(10, $id); |
| 74 | - try{
|
|
| 74 | + try {
|
|
| 75 | 75 | $query->execute(); |
| 76 | 76 | } |
| 77 | - catch(PDOException $e){
|
|
| 77 | + catch (PDOException $e) {
|
|
| 78 | 78 | die($e->getMessage()); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | - public function changepwd($id,$password) |
|
| 82 | - { $password = sha1($password);
|
|
| 83 | - $query = $this->db->prepare("UPDATE `users` SET `password` = ? WHERE `id` = ?");
|
|
| 81 | + public function changepwd($id, $password) |
|
| 82 | + { $password = sha1($password);
|
|
| 83 | + $query = $this->db->prepare("UPDATE `users` SET `password` = ? WHERE `id` = ?");
|
|
| 84 | 84 | $query->bindValue(1, $password); |
| 85 | 85 | $query->bindValue(2, $id); |
| 86 | - try{
|
|
| 86 | + try {
|
|
| 87 | 87 | $query->execute(); |
| 88 | 88 | } |
| 89 | - catch(PDOException $e){
|
|
| 89 | + catch (PDOException $e) {
|
|
| 90 | 90 | die($e->getMessage()); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | - public function delete($id){
|
|
| 94 | - $sql="DELETE FROM `users` WHERE `id` = ?"; |
|
| 93 | + public function delete($id) {
|
|
| 94 | + $sql = "DELETE FROM `users` WHERE `id` = ?"; |
|
| 95 | 95 | $query = $this->db->prepare($sql); |
| 96 | 96 | $query->bindValue(1, $id); |
| 97 | - try{
|
|
| 97 | + try {
|
|
| 98 | 98 | $query->execute(); |
| 99 | 99 | } |
| 100 | - catch(PDOException $e){
|
|
| 100 | + catch (PDOException $e) {
|
|
| 101 | 101 | die($e->getMessage()); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -106,19 +106,19 @@ discard block |
||
| 106 | 106 | $query->bindValue(1, $email); |
| 107 | 107 | $query->bindValue(2, $email_code); |
| 108 | 108 | $query->bindValue(3, 0); |
| 109 | - try{
|
|
| 109 | + try {
|
|
| 110 | 110 | $query->execute(); |
| 111 | 111 | $rows = $query->fetchColumn(); |
| 112 | - if($rows == 1){
|
|
| 112 | + if ($rows == 1) {
|
|
| 113 | 113 | $query_2 = $this->db->prepare("UPDATE `users` SET `confirmed` = ? WHERE `email` = ?");
|
| 114 | 114 | $query_2->bindValue(1, 1); |
| 115 | 115 | $query_2->bindValue(2, $email); |
| 116 | 116 | $query_2->execute(); |
| 117 | 117 | return true; |
| 118 | - }else{
|
|
| 118 | + }else {
|
|
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | - } catch(PDOException $e){
|
|
| 121 | + }catch (PDOException $e) {
|
|
| 122 | 122 | die($e->getMessage()); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -126,77 +126,77 @@ discard block |
||
| 126 | 126 | { $query = $this->db->prepare("SELECT COUNT(`id`) FROM `users` WHERE `username`= ? AND `confirmed` = ?");
|
| 127 | 127 | $query->bindValue(1, $username); |
| 128 | 128 | $query->bindValue(2, 1); |
| 129 | - try{
|
|
| 129 | + try {
|
|
| 130 | 130 | $query->execute(); |
| 131 | 131 | $rows = $query->fetchColumn(); |
| 132 | - if($rows == 1){
|
|
| 132 | + if ($rows == 1) {
|
|
| 133 | 133 | return true; |
| 134 | - }else{
|
|
| 134 | + }else {
|
|
| 135 | 135 | return false; |
| 136 | 136 | } |
| 137 | - } catch(PDOException $e){
|
|
| 137 | + }catch (PDOException $e) {
|
|
| 138 | 138 | die($e->getMessage()); |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | public function login($username, $password) |
| 142 | 142 | { $query = $this->db->prepare("SELECT `password`, `id` FROM `users` WHERE `username` = ?");
|
| 143 | 143 | $query->bindValue(1, $username); |
| 144 | - try{
|
|
| 144 | + try {
|
|
| 145 | 145 | $query->execute(); |
| 146 | 146 | $data = $query->fetch(); |
| 147 | - $stored_password = $data['password']; |
|
| 147 | + $stored_password = $data['password']; |
|
| 148 | 148 | $id = $data['id']; |
| 149 | - if($stored_password === sha1($password)){
|
|
| 149 | + if ($stored_password === sha1($password)) {
|
|
| 150 | 150 | return $id; |
| 151 | - }else{
|
|
| 151 | + }else {
|
|
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | - }catch(PDOException $e){
|
|
| 154 | + }catch (PDOException $e) {
|
|
| 155 | 155 | die($e->getMessage()); |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | public function userdata($id) |
| 159 | 159 | { $query = $this->db->prepare("SELECT * FROM `users` WHERE `id`= ?");
|
| 160 | 160 | $query->bindValue(1, $id); |
| 161 | - try{
|
|
| 161 | + try {
|
|
| 162 | 162 | $query->execute(); |
| 163 | 163 | return $query->fetch(); |
| 164 | - } catch(PDOException $e){
|
|
| 164 | + }catch (PDOException $e) {
|
|
| 165 | 165 | die($e->getMessage()); |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | public function get_user_by_id($id) |
| 169 | 169 | { $query = $this->db->prepare("SELECT * FROM `users` WHERE `id`= ?");
|
| 170 | 170 | $query->bindValue(1, $id); |
| 171 | - try{
|
|
| 171 | + try {
|
|
| 172 | 172 | $query->execute(); |
| 173 | 173 | return $query->fetch(); |
| 174 | - } catch(PDOException $e){
|
|
| 174 | + }catch (PDOException $e) {
|
|
| 175 | 175 | die($e->getMessage()); |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | public function get_user_by_level($level) |
| 179 | 179 | { $query = $this->db->prepare("SELECT * FROM `users` WHERE `level`= ?");
|
| 180 | 180 | $query->bindValue(1, $level); |
| 181 | - try{
|
|
| 181 | + try {
|
|
| 182 | 182 | $query->execute(); |
| 183 | - }catch(PDOException $e){
|
|
| 183 | + }catch (PDOException $e) {
|
|
| 184 | 184 | die($e->getMessage()); |
| 185 | 185 | } |
| 186 | 186 | return $query->fetchAll(); |
| 187 | 187 | } |
| 188 | 188 | public function get_users() |
| 189 | 189 | { $query = $this->db->prepare("SELECT * FROM `users` ORDER BY `time` DESC");
|
| 190 | - try{
|
|
| 190 | + try {
|
|
| 191 | 191 | $query->execute(); |
| 192 | - }catch(PDOException $e){
|
|
| 192 | + }catch (PDOException $e) {
|
|
| 193 | 193 | die($e->getMessage()); |
| 194 | 194 | } |
| 195 | 195 | return $query->fetchAll(); |
| 196 | 196 | } |
| 197 | - public function log_users($iduser,$log) |
|
| 197 | + public function log_users($iduser, $log) |
|
| 198 | 198 | { $time = time();
|
| 199 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 199 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 200 | 200 | $browser = $_SERVER['HTTP_USER_AGENT']; |
| 201 | 201 | $query = $this->db->prepare("INSERT INTO `log_users` (`iduser`,`time`,`ip`,`browser`,`log`) VALUES (?, ?, ?, ?, ?)");
|
| 202 | 202 | $query->bindValue(1, $iduser); |
@@ -204,17 +204,17 @@ discard block |
||
| 204 | 204 | $query->bindValue(3, $ip); |
| 205 | 205 | $query->bindValue(4, $browser); |
| 206 | 206 | $query->bindValue(5, $log); |
| 207 | - try{
|
|
| 207 | + try {
|
|
| 208 | 208 | $query->execute(); |
| 209 | - }catch(PDOException $e){
|
|
| 209 | + }catch (PDOException $e) {
|
|
| 210 | 210 | die($e->getMessage()); |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | public function get_users_log() |
| 214 | 214 | { $query = $this->db->prepare("SELECT * FROM `log_users` ORDER BY `time` DESC");
|
| 215 | - try{
|
|
| 215 | + try {
|
|
| 216 | 216 | $query->execute(); |
| 217 | - }catch(PDOException $e){
|
|
| 217 | + }catch (PDOException $e) {
|
|
| 218 | 218 | die($e->getMessage()); |
| 219 | 219 | } |
| 220 | 220 | return $query->fetchAll(); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | $rows = $query->fetchColumn(); |
| 12 | 12 | if($rows == 1){
|
| 13 | 13 | return true; |
| 14 | - }else{
|
|
| 14 | + } else{
|
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | } catch (PDOException $e){
|
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $rows = $query->fetchColumn(); |
| 27 | 27 | if($rows == 1){
|
| 28 | 28 | return true; |
| 29 | - }else{
|
|
| 29 | + } else{
|
|
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | 32 | } catch (PDOException $e){
|
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $query->bindValue(10, 1); |
| 52 | 52 | try{
|
| 53 | 53 | $query->execute(); |
| 54 | - }catch(PDOException $e){
|
|
| 54 | + } catch(PDOException $e){
|
|
| 55 | 55 | die($e->getMessage()); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | $query->bindValue(10, $id); |
| 74 | 74 | try{
|
| 75 | 75 | $query->execute(); |
| 76 | - } |
|
| 77 | - catch(PDOException $e){
|
|
| 76 | + } catch(PDOException $e){
|
|
| 78 | 77 | die($e->getMessage()); |
| 79 | 78 | } |
| 80 | 79 | } |
@@ -85,8 +84,7 @@ discard block |
||
| 85 | 84 | $query->bindValue(2, $id); |
| 86 | 85 | try{
|
| 87 | 86 | $query->execute(); |
| 88 | - } |
|
| 89 | - catch(PDOException $e){
|
|
| 87 | + } catch(PDOException $e){
|
|
| 90 | 88 | die($e->getMessage()); |
| 91 | 89 | } |
| 92 | 90 | } |
@@ -96,8 +94,7 @@ discard block |
||
| 96 | 94 | $query->bindValue(1, $id); |
| 97 | 95 | try{
|
| 98 | 96 | $query->execute(); |
| 99 | - } |
|
| 100 | - catch(PDOException $e){
|
|
| 97 | + } catch(PDOException $e){
|
|
| 101 | 98 | die($e->getMessage()); |
| 102 | 99 | } |
| 103 | 100 | } |
@@ -115,7 +112,7 @@ discard block |
||
| 115 | 112 | $query_2->bindValue(2, $email); |
| 116 | 113 | $query_2->execute(); |
| 117 | 114 | return true; |
| 118 | - }else{
|
|
| 115 | + } else{
|
|
| 119 | 116 | return false; |
| 120 | 117 | } |
| 121 | 118 | } catch(PDOException $e){
|
@@ -131,7 +128,7 @@ discard block |
||
| 131 | 128 | $rows = $query->fetchColumn(); |
| 132 | 129 | if($rows == 1){
|
| 133 | 130 | return true; |
| 134 | - }else{
|
|
| 131 | + } else{
|
|
| 135 | 132 | return false; |
| 136 | 133 | } |
| 137 | 134 | } catch(PDOException $e){
|
@@ -148,10 +145,10 @@ discard block |
||
| 148 | 145 | $id = $data['id']; |
| 149 | 146 | if($stored_password === sha1($password)){
|
| 150 | 147 | return $id; |
| 151 | - }else{
|
|
| 148 | + } else{
|
|
| 152 | 149 | return false; |
| 153 | 150 | } |
| 154 | - }catch(PDOException $e){
|
|
| 151 | + } catch(PDOException $e){
|
|
| 155 | 152 | die($e->getMessage()); |
| 156 | 153 | } |
| 157 | 154 | } |
@@ -180,7 +177,7 @@ discard block |
||
| 180 | 177 | $query->bindValue(1, $level); |
| 181 | 178 | try{
|
| 182 | 179 | $query->execute(); |
| 183 | - }catch(PDOException $e){
|
|
| 180 | + } catch(PDOException $e){
|
|
| 184 | 181 | die($e->getMessage()); |
| 185 | 182 | } |
| 186 | 183 | return $query->fetchAll(); |
@@ -189,7 +186,7 @@ discard block |
||
| 189 | 186 | { $query = $this->db->prepare("SELECT * FROM `users` ORDER BY `time` DESC");
|
| 190 | 187 | try{
|
| 191 | 188 | $query->execute(); |
| 192 | - }catch(PDOException $e){
|
|
| 189 | + } catch(PDOException $e){
|
|
| 193 | 190 | die($e->getMessage()); |
| 194 | 191 | } |
| 195 | 192 | return $query->fetchAll(); |
@@ -206,7 +203,7 @@ discard block |
||
| 206 | 203 | $query->bindValue(5, $log); |
| 207 | 204 | try{
|
| 208 | 205 | $query->execute(); |
| 209 | - }catch(PDOException $e){
|
|
| 206 | + } catch(PDOException $e){
|
|
| 210 | 207 | die($e->getMessage()); |
| 211 | 208 | } |
| 212 | 209 | } |
@@ -214,7 +211,7 @@ discard block |
||
| 214 | 211 | { $query = $this->db->prepare("SELECT * FROM `log_users` ORDER BY `time` DESC");
|
| 215 | 212 | try{
|
| 216 | 213 | $query->execute(); |
| 217 | - }catch(PDOException $e){
|
|
| 214 | + } catch(PDOException $e){
|
|
| 218 | 215 | die($e->getMessage()); |
| 219 | 216 | } |
| 220 | 217 | return $query->fetchAll(); |
@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | require 'core/init.php'; |
| 4 | 4 | $general->logged_out_protect(); |
| 5 | 5 | $user = $users->userdata($_SESSION['loginid']); |
| 6 | -if($user['level'] == "Admin" || $user['level'] == "Manager") |
|
| 7 | -{$akses=true;}
|
|
| 6 | +if ($user['level'] == "Admin" || $user['level'] == "Manager") |
|
| 7 | +{$akses = true; }
|
|
| 8 | 8 | else |
| 9 | -{$akses=false;}
|
|
| 10 | -if ($akses=False) |
|
| 11 | -{exit("You don't have permission to access this page!");}
|
|
| 12 | -$tickets = $tickets->get_opened_tickets(); |
|
| 13 | -$tickets_count = count($tickets); |
|
| 9 | +{$akses = false; }
|
|
| 10 | +if ($akses = False) |
|
| 11 | +{exit("You don't have permission to access this page!"); }
|
|
| 12 | +$tickets = $tickets->get_opened_tickets(); |
|
| 13 | +$tickets_count = count($tickets); |
|
| 14 | 14 | ?> |
| 15 | 15 | <!DOCTYPE HTML> |
| 16 | 16 | <html> |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | $currenttime = time(); |
| 66 | 66 | foreach ($tickets as $ticket) {
|
| 67 | 67 | $sla = $slas->sla_data($ticket['sla']); |
| 68 | - $documenteddate=$ticket['documenteddate']; |
|
| 69 | - $resolutiontime=$sla['resolutiontime']; |
|
| 70 | - $slawarning=$sla['slawarning']; |
|
| 71 | - $slagoaltime=strtotime("+$resolutiontime hours",$documenteddate);
|
|
| 72 | - $slawarningtime=strtotime("+$slawarning hours",$documenteddate);
|
|
| 68 | + $documenteddate = $ticket['documenteddate']; |
|
| 69 | + $resolutiontime = $sla['resolutiontime']; |
|
| 70 | + $slawarning = $sla['slawarning']; |
|
| 71 | + $slagoaltime = strtotime("+$resolutiontime hours", $documenteddate);
|
|
| 72 | + $slawarningtime = strtotime("+$slawarning hours", $documenteddate);
|
|
| 73 | 73 | if ($currenttime > $slagoaltime) |
| 74 | - {$slabgcolor="#FF0000";$slatxtcolor="#ffffff";}
|
|
| 74 | + {$slabgcolor = "#FF0000"; $slatxtcolor = "#ffffff"; }
|
|
| 75 | 75 | else if ($currenttime >= $slawarningtime) |
| 76 | - {$slabgcolor="#FFFF00";$slatxtcolor="#000000";}
|
|
| 77 | - else {$slabgcolor="#00FF00";$slatxtcolor="#000000";}
|
|
| 76 | + {$slabgcolor = "#FFFF00"; $slatxtcolor = "#000000"; }
|
|
| 77 | + else {$slabgcolor = "#00FF00"; $slatxtcolor = "#000000"; }
|
|
| 78 | 78 | $customer = $customers->customer_data($ticket['idcustomer']); |
| 79 | 79 | $user = $users->userdata($ticket['assignee']); |
| 80 | - echo '<tr><td><a href=ticketedituser.php?id='.$ticket['id']. '>'.$ticket['ticketnumber'].'</a></td>'. |
|
| 80 | + echo '<tr><td><a href=ticketedituser.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'. |
|
| 81 | 81 | '<td style="background-color:'.$slabgcolor.';color:'.$slatxtcolor.';">'.$sla['namasla'].'</td>'. |
| 82 | 82 | '<td>'.$customer['namacustomer'].'</td>'. |
| 83 | - '<td>'.date('d-M-Y H:i',$ticket['reporteddate']).'</td>'.
|
|
| 83 | + '<td>'.date('d-M-Y H:i', $ticket['reporteddate']).'</td>'.
|
|
| 84 | 84 | '<td>'.$ticket['reportedby'].'</td>'. |
| 85 | 85 | '<td>'.$ticket['problemsummary'].'</td>'. |
| 86 | 86 | '<td>'.$ticket['ticketstatus'].'</td>'. |
@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | $general->logged_out_protect(); |
| 5 | 5 | $user = $users->userdata($_SESSION['loginid']); |
| 6 | 6 | if($user['level'] == "Admin" || $user['level'] == "Manager") |
| 7 | -{$akses=true;}
|
|
| 8 | -else |
|
| 7 | +{$akses=true;} else
|
|
| 9 | 8 | {$akses=false;}
|
| 10 | 9 | if ($akses=False) |
| 11 | 10 | {exit("You don't have permission to access this page!");}
|
@@ -71,10 +70,8 @@ discard block |
||
| 71 | 70 | $slagoaltime=strtotime("+$resolutiontime hours",$documenteddate);
|
| 72 | 71 | $slawarningtime=strtotime("+$slawarning hours",$documenteddate);
|
| 73 | 72 | if ($currenttime > $slagoaltime) |
| 74 | - {$slabgcolor="#FF0000";$slatxtcolor="#ffffff";}
|
|
| 75 | - else if ($currenttime >= $slawarningtime) |
|
| 76 | - {$slabgcolor="#FFFF00";$slatxtcolor="#000000";}
|
|
| 77 | - else {$slabgcolor="#00FF00";$slatxtcolor="#000000";}
|
|
| 73 | + {$slabgcolor="#FF0000";$slatxtcolor="#ffffff";} else if ($currenttime >= $slawarningtime)
|
|
| 74 | + {$slabgcolor="#FFFF00";$slatxtcolor="#000000";} else {$slabgcolor="#00FF00";$slatxtcolor="#000000";}
|
|
| 78 | 75 | $customer = $customers->customer_data($ticket['idcustomer']); |
| 79 | 76 | $user = $users->userdata($ticket['assignee']); |
| 80 | 77 | echo '<tr><td><a href=ticketedituser.php?id='.$ticket['id']. '>'.$ticket['ticketnumber'].'</a></td>'. |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | require 'core/init.php'; |
| 3 | 3 | $general->logged_out_protect(); |
| 4 | 4 | $user = $users->userdata($_SESSION['loginid']); |
| 5 | -$tickets = $tickets->get_tickets_by_resolver_not_closed($user['username']); |
|
| 6 | -$tickets_count = count($tickets); |
|
| 5 | +$tickets = $tickets->get_tickets_by_resolver_not_closed($user['username']); |
|
| 6 | +$tickets_count = count($tickets); |
|
| 7 | 7 | ?> |
| 8 | 8 | <!DOCTYPE HTML> |
| 9 | 9 | <html> |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | $sla = $slas->sla_data($ticket['sla']); |
| 56 | 56 | $customer = $customers->customer_data($ticket['idcustomer']); |
| 57 | 57 | $user = $users->userdata($ticket['assignee']); |
| 58 | - echo '<tr><td><a href=ticketedit.php?id='.$ticket['id']. '>'.$ticket['ticketnumber'].'</a></td>'. |
|
| 58 | + echo '<tr><td><a href=ticketedit.php?id='.$ticket['id'].'>'.$ticket['ticketnumber'].'</a></td>'. |
|
| 59 | 59 | '<td>'.$sla['namasla'].'</td>'. |
| 60 | 60 | '<td>'.$customer['namacustomer'].'</td>'. |
| 61 | - '<td>'.date('d-M-Y',$ticket['reporteddate']).'</td>'.
|
|
| 61 | + '<td>'.date('d-M-Y', $ticket['reporteddate']).'</td>'.
|
|
| 62 | 62 | '<td>'.$ticket['reportedby'].'</td>'. |
| 63 | 63 | '<td>'.$ticket['problemsummary'].'</td>'. |
| 64 | 64 | '<td>'.$ticket['ticketstatus'].'</td>'. |
@@ -2,15 +2,15 @@ discard block |
||
| 2 | 2 | require 'core/init.php'; |
| 3 | 3 | $general->logged_out_protect(); |
| 4 | 4 | if (isset($_POST['submit'])) |
| 5 | -{ $namacustomer = $_POST['namacustomer'];
|
|
| 6 | - $password = $_POST['password']; |
|
| 5 | +{ $namacustomer = $_POST['namacustomer'];
|
|
| 6 | + $password = $_POST['password']; |
|
| 7 | 7 | $alamat = $_POST['alamat']; |
| 8 | - $Telp = $_POST['telp']; |
|
| 8 | + $Telp = $_POST['telp']; |
|
| 9 | 9 | $email = $_POST['email']; |
| 10 | - $PIC = $_POST['PIC']; |
|
| 11 | - $selesperson = $_POST['selesperson']; |
|
| 12 | - $customerproduct= $_POST['customerproduct']; |
|
| 13 | - $customers->add_customer($namacustomer,$alamat,$Telp,$email,$PIC,$selesperson,$customerproduct); |
|
| 10 | + $PIC = $_POST['PIC']; |
|
| 11 | + $selesperson = $_POST['selesperson']; |
|
| 12 | + $customerproduct = $_POST['customerproduct']; |
|
| 13 | + $customers->add_customer($namacustomer, $alamat, $Telp, $email, $PIC, $selesperson, $customerproduct); |
|
| 14 | 14 | header('Location: customerlist.php');
|
| 15 | 15 | exit(); |
| 16 | 16 | } |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | </form> |
| 121 | 121 | |
| 122 | 122 | <?php |
| 123 | - if(empty($errors) === false){
|
|
| 124 | - echo '<p class=errormsg>' . implode('</p><p class=errormsg>', $errors) . '</p>';
|
|
| 123 | + if (empty($errors) === false) {
|
|
| 124 | + echo '<p class=errormsg>'.implode('</p><p class=errormsg>', $errors).'</p>';
|
|
| 125 | 125 | } |
| 126 | 126 | ?> |
| 127 | 127 | </body> |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require 'core/init.php'; |
| 3 | 3 | $general->logged_out_protect(); |
| 4 | -$id = $_GET['id']; |
|
| 4 | +$id = $_GET['id']; |
|
| 5 | 5 | $news = $hdnews->news_data($id); |
| 6 | 6 | ?> |
| 7 | 7 | <!DOCTYPE HTML> |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | <p style="font-family:arial;color:red;font-size:16px;">Helpdesk Breaking News</p> |
| 23 | 23 | <table class="formtable"> |
| 24 | 24 | <?php |
| 25 | - echo '<tr><td> From :'.$news['createdby']. '</td></tr>'. |
|
| 26 | - '<tr><td>'. date('d-M-Y',$news['createdon']) .'</td></tr>'.
|
|
| 25 | + echo '<tr><td> From :'.$news['createdby'].'</td></tr>'. |
|
| 26 | + '<tr><td>'.date('d-M-Y', $news['createdon']).'</td></tr>'.
|
|
| 27 | 27 | '<tr><td><p style="font-family:arial;color:black;font-size:20px;">'.$news['title'].'</p></td></tr>'. |
| 28 | 28 | '<tr><td><p style="font-family:arial;color:black;font-size:14px;">'.nl2br($news['detail']).'</p></td></tr>'; |
| 29 | 29 | ?> |
@@ -2,11 +2,11 @@ discard block |
||
| 2 | 2 | require 'core/init.php'; |
| 3 | 3 | $general->logged_out_protect(); |
| 4 | 4 | $user = $users->userdata($_SESSION['loginid']); |
| 5 | -if($user['level'] != "Admin") |
|
| 5 | +if ($user['level'] != "Admin") |
|
| 6 | 6 | { exit("You don't have permission to access this page!"); }
|
| 7 | 7 | |
| 8 | -$members = $customers->get_customers(); |
|
| 9 | -$member_count = count($members); |
|
| 8 | +$members = $customers->get_customers(); |
|
| 9 | +$member_count = count($members); |
|
| 10 | 10 | ?> |
| 11 | 11 | <!DOCTYPE HTML> |
| 12 | 12 | <html> |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | <tbody> |
| 63 | 63 | <?php |
| 64 | 64 | foreach ($members as $member) |
| 65 | - { if (@$member['confirmed']=='1')
|
|
| 66 | - {$locked='No';}
|
|
| 65 | + { if (@$member['confirmed'] == '1')
|
|
| 66 | + {$locked = 'No'; }
|
|
| 67 | 67 | else |
| 68 | - {$locked='Yes';}
|
|
| 69 | - $disp_id_customer=sprintf("%04s", $member['idcustomer']);
|
|
| 70 | - echo '<tr><td><a href=customeredit.php?id='.$member['idcustomer']. '>'.$disp_id_customer.'</a></td>'. |
|
| 68 | + {$locked = 'Yes'; }
|
|
| 69 | + $disp_id_customer = sprintf("%04s", $member['idcustomer']);
|
|
| 70 | + echo '<tr><td><a href=customeredit.php?id='.$member['idcustomer'].'>'.$disp_id_customer.'</a></td>'. |
|
| 71 | 71 | '<td>'.$member['namacustomer'].'</td>'. |
| 72 | 72 | '<td>'.$member['alamat'].'</td>'. |
| 73 | 73 | '<td>'.$member['Telp'].'</td>'. |
| 74 | 74 | '<td>'.$member['PIC'].'</td>'. |
| 75 | 75 | '<td>'.$member['selesperson'].'</td>'. |
| 76 | 76 | '<td>'.$member['customerproduct'].'</td>'. |
| 77 | - '<td><a href=customerdel.php?id='.$member['idcustomer']. ' onclick="return delete_confirm();">del</a></td></tr>'; |
|
| 77 | + '<td><a href=customerdel.php?id='.$member['idcustomer'].' onclick="return delete_confirm();">del</a></td></tr>'; |
|
| 78 | 78 | } |
| 79 | 79 | ?> |
| 80 | 80 | </tbody> |
@@ -63,8 +63,7 @@ |
||
| 63 | 63 | <?php |
| 64 | 64 | foreach ($members as $member) |
| 65 | 65 | { if (@$member['confirmed']=='1')
|
| 66 | - {$locked='No';}
|
|
| 67 | - else |
|
| 66 | + {$locked='No';} else
|
|
| 68 | 67 | {$locked='Yes';}
|
| 69 | 68 | $disp_id_customer=sprintf("%04s", $member['idcustomer']);
|
| 70 | 69 | echo '<tr><td><a href=customeredit.php?id='.$member['idcustomer']. '>'.$disp_id_customer.'</a></td>'. |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | //if($user['level'] != "Admin") |
| 6 | 6 | //{ exit("You don't have permission to access this page!"); } |
| 7 | 7 | $tickets = $tickets->get_tickets(); |
| 8 | -$json='['; |
|
| 8 | +$json = '['; |
|
| 9 | 9 | foreach ($tickets as $ticket) |
| 10 | -{ $customer=$customers->customer_data($ticket['idcustomer']); |
|
| 10 | +{ $customer = $customers->customer_data($ticket['idcustomer']); |
|
| 11 | 11 | $userassignee = $users->userdata($ticket['assignee']); |
| 12 | - $json.='{"Product": "'. $customer['customerproduct'] . '",'. |
|
| 13 | - '"Company": "'.$customer['namacustomer']. '",'. |
|
| 14 | - '"Assignee": "'.$userassignee['fullname']. '",'. |
|
| 15 | - '"Status": "'.$ticket['ticketstatus']. '"},'; |
|
| 12 | + $json .= '{"Product": "'.$customer['customerproduct'].'",'. |
|
| 13 | + '"Company": "'.$customer['namacustomer'].'",'. |
|
| 14 | + '"Assignee": "'.$userassignee['fullname'].'",'. |
|
| 15 | + '"Status": "'.$ticket['ticketstatus'].'"},'; |
|
| 16 | 16 | } |
| 17 | 17 | echo substr($json, 0, -1).']'; |
| 18 | 18 | |