| @@ -211,8 +211,51 @@ | ||
| 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 | + $log['class_path'] = ''; | |
| 222 | + $log['class_info'] = ''; | |
| 223 | + | |
| 224 | + if ($log['event'] === 'modified') { | |
| 225 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 226 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 227 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 228 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.changed"); | |
| 229 | + } elseif ($log['event'] === 'quarantine') { | |
| 230 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 231 | + $log['class_path'] = "wtotem_file-table__td_changed"; | |
| 232 | + $log['class_info'] = "wtotem_file-table__td_normal"; | |
| 233 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.quarantine"); | |
| 234 | + } elseif ($log['event'] === 'infected') { | |
| 235 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.backdoor_virus"); | |
| 236 | + $log['class_path'] = "wtotem_file-table__td_critical"; | |
| 237 | + $log['class_info'] = "wtotem_file-table__td_critical"; | |
| 238 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.infected"); | |
| 239 | + } elseif ($log['event'] === 'deleted') { | |
| 240 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.deleted"); | |
| 241 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.deleted"); | |
| 242 | + }elseif ($log['event'] === 'new'){ | |
| 243 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 244 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.new"); | |
| 245 | + }elseif ($log['event'] === 'scanned'){ | |
| 246 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.info.normal"); | |
| 247 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.scanned"); | |
| 248 | + }else{ | |
| 249 | + $log['info'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 250 | + $log['description'] = WTSEC_LIBRARY_Localization::lmsg("antivirus.status.error"); | |
| 251 | + } | |
| 252 | + | |
| 253 | + $logs[$key]['node'] = $log; | |
| 254 | + } | |
| 255 | + return $logs; | |
| 256 | +} | |
| 257 | + | |
| 215 | 258 | function wtsec_getConfigs($host_id) |
| 216 | 259 | { |
| 217 | 260 | $config = WTSEC_LIBRARY_WT::getConfigs($host_id); |
| 218 | 261 | return wtsec_arrayIndex($config['data']['auth']['viewer']['sites']['one']['configs'], 'service'); |
| @@ -220,9 +263,11 @@ | ||
| 220 | 263 | |
| 221 | 264 | function wtsec_arrayIndex($array, $key){ |
| 222 | 265 | $newArray = []; |
| 223 | 266 | foreach ($array as $item){ |
| 224 | - $newArray[$item[$key]] = $item; | |
| 267 | + if(array_key_exists($key,$item)){ | |
| 268 | + $newArray[$item[$key]] = $item; | |
| 269 | + } | |
| 225 | 270 | } |
| 226 | 271 | return $newArray; |
| 227 | 272 | } |
| 228 | 273 | |
| @@ -297,5 +342,12 @@ | ||
| 297 | 342 | |
| 298 | 343 | function wtsec_getInstalledFile($service) |
| 299 | 344 | { |
| 300 | 345 | return wtsec_app()->get($service . "_installed_file"); |
| 301 | -} | |
| 346 | +} | |
| 347 | + | |
| 348 | +function wtsec_DeleteAm(){ | |
| 349 | + $host = WTSEC_LIBRARY_WT::getOwnSite(); | |
| 350 | + if(!empty($host)){ | |
| 351 | + WTSEC_LIBRARY_WT::deleteAm($host['id']); | |
| 352 | + } | |
| 353 | +} | |