@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | global $modx; |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | |
96 | 96 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
97 | 97 | if (!$insert_id) { |
98 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
98 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
99 | 99 | } else { |
100 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
101 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
100 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
101 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
102 | 102 | if (($insert_id % $trim) === 0) { |
103 | 103 | $modx->rotate_log('manager_log', $limit, $trim); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - private function getUserIP() { |
|
109 | - if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
|
110 | - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
|
111 | - $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
108 | + private function getUserIP(){ |
|
109 | + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
110 | + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { |
|
111 | + $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
112 | 112 | return trim($addr[0]); |
113 | 113 | } else { |
114 | 114 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
@@ -105,7 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - private function getUserIP() { |
|
108 | + private function getUserIP() |
|
109 | + { |
|
109 | 110 | if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
110 | 111 | if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
111 | 112 | $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
@@ -113,8 +114,7 @@ discard block |
||
113 | 114 | } else { |
114 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
115 | 116 | } |
116 | - } |
|
117 | - else { |
|
117 | + } else { |
|
118 | 118 | return $_SERVER['REMOTE_ADDR']; |
119 | 119 | } |
120 | 120 | } |