| @@ -211,8 +211,49 @@ | ||
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
| 215 | +function wtsec_AVLogsData($logs){ | |
| 216 | + foreach ($logs as $key => $log){ | |
| 217 | + $log = $log['node']; | |
| 218 | + $log['filePath'] = urldecode($log['filePath']); | |
| 219 | + $log['text'] = (strlen($log['filePath']) > 40) ? substr($log['filePath'],0,40).'...' : $log['filePath']; | |
| 220 | + $log['time'] = convertToCurrentTime($log['time']); | |
| 221 | + | |
| 222 | + if ($log['event'] === 'modified') { | |
| 223 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 224 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 225 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 226 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.changed"); | |
| 227 | + } elseif ($log['event'] === 'quarantine') { | |
| 228 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 229 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 230 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 231 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.quarantine"); | |
| 232 | + } elseif ($log['event'] === 'infected') { | |
| 233 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 234 | + $log['class_path'] = "wtotem_file-table__td_critical"; | |
| 235 | + $log['class_info'] = "wtotem_file-table__td_critical"; | |
| 236 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.infected"); | |
| 237 | + } elseif ($log['event'] === 'deleted') { | |
| 238 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.deleted"); | |
| 239 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.deleted"); | |
| 240 | + }elseif ($log['event'] === 'new'){ | |
| 241 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 242 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.new"); | |
| 243 | + }elseif ($log['event'] === 'scanned'){ | |
| 244 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 245 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.scanned"); | |
| 246 | + }else{ | |
| 247 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 248 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 249 | + } | |
| 250 | + | |
| 251 | + $logs[$key]['node'] = $log; | |
| 252 | + } | |
| 253 | + return $logs; | |
| 254 | +} | |
| 255 | + | |
| 215 | 256 | function wtsec_getConfigs($host_id) |
| 216 | 257 | { |
| 217 | 258 | $config = WTSEC_LIBRARY_WT::getConfigs($host_id); |
| 218 | 259 | return wtsec_arrayIndex($config['data']['auth']['viewer']['sites']['one']['configs'], 'service'); |
| @@ -220,9 +261,11 @@ | ||
| 220 | 261 | |
| 221 | 262 | function wtsec_arrayIndex($array, $key){ |
| 222 | 263 | $newArray = []; |
| 223 | 264 | foreach ($array as $item){ |
| 224 | - $newArray[$item[$key]] = $item; | |
| 265 | + if(array_key_exists($key,$item)){ | |
| 266 | + $newArray[$item[$key]] = $item; | |
| 267 | + } | |
| 225 | 268 | } |
| 226 | 269 | return $newArray; |
| 227 | 270 | } |
| 228 | 271 | |